mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2026-02-06 11:17:36 +00:00
Refactor scripts to meet ES2020 compliance.
This commit is contained in:
parent
200fa5a4e9
commit
21b83ca54d
2
.github/workflows/eslint.yml
vendored
2
.github/workflows/eslint.yml
vendored
@ -23,4 +23,4 @@ jobs:
|
||||
run: npm install
|
||||
|
||||
- name: Run ESLint
|
||||
run: npx eslint . --max-warnings 0
|
||||
run: npx eslint .
|
||||
|
||||
26
build.js
26
build.js
@ -99,14 +99,15 @@ if (!build_type) {
|
||||
return JSON.parse(fs.readFileSync(coresJsonPath, 'utf8'));
|
||||
};
|
||||
|
||||
if (build_type === "emulatorjs") {
|
||||
console.log(`Current EmulatorJS Version: ${version}`);
|
||||
removeLogo();
|
||||
console.log("Ready to build EmulatorJS!");
|
||||
} else if (build_type === "get-cores") {
|
||||
const cores = await getCores();
|
||||
console.log(JSON.stringify(cores.map(coreName => coreName.name)));
|
||||
} else if (build_type === "cores") {
|
||||
const main = async () => {
|
||||
if (build_type === "emulatorjs") {
|
||||
console.log(`Current EmulatorJS Version: ${version}`);
|
||||
removeLogo();
|
||||
console.log("Ready to build EmulatorJS!");
|
||||
} else if (build_type === "get-cores") {
|
||||
const cores = await getCores();
|
||||
console.log(JSON.stringify(cores.map(coreName => coreName.name)));
|
||||
} else if (build_type === "cores") {
|
||||
console.log(`Current EmulatorJS Version: ${version}`);
|
||||
console.log("Building cores...");
|
||||
const allCores = await getCores();
|
||||
@ -177,7 +178,10 @@ if (!build_type) {
|
||||
packageJson.dependencies[`@emulatorjs/core-${core}`] = "latest";
|
||||
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 4), 'utf8');
|
||||
}
|
||||
console.log("EmulatorJS cores built successfully!");
|
||||
console.log("Ready to build EmulatorJS!");
|
||||
}
|
||||
console.log("EmulatorJS cores built successfully!");
|
||||
console.log("Ready to build EmulatorJS!");
|
||||
}
|
||||
};
|
||||
|
||||
main();
|
||||
}
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
class GamepadHandler {
|
||||
gamepads;
|
||||
timeout;
|
||||
listeners;
|
||||
constructor() {
|
||||
this.buttonLabels = {
|
||||
0: 'BUTTON_1',
|
||||
|
||||
@ -14,10 +14,10 @@ async function doMinify() {
|
||||
input: path.join(rootPath, "data/src/*.js"),
|
||||
output: path.join(rootPath, "data/emulator.min.js"),
|
||||
})
|
||||
.catch(function (err) {
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
})
|
||||
.then(function() {
|
||||
.then(() => {
|
||||
console.log("Minified JS");
|
||||
});
|
||||
await minify({
|
||||
@ -25,14 +25,16 @@ async function doMinify() {
|
||||
input: path.join(rootPath, "data/emulator.css"),
|
||||
output: path.join(rootPath, "data/emulator.min.css"),
|
||||
})
|
||||
.catch(function (err) {
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
})
|
||||
.then(function() {
|
||||
.then(() => {
|
||||
console.log("Minified CSS");
|
||||
});
|
||||
}
|
||||
|
||||
console.log("Minifying");
|
||||
await doMinify();
|
||||
console.log("Minifying Done!");
|
||||
(async () => {
|
||||
await doMinify();
|
||||
console.log("Minifying Done!");
|
||||
})();
|
||||
|
||||
34
update.js
34
update.js
@ -116,20 +116,22 @@ const updateContributors = async () => {
|
||||
console.log("Updated Contributors.md with new contributors.");
|
||||
}
|
||||
|
||||
console.log(`Current EmulatorJS Version: ${version}`);
|
||||
if (!update_version) {
|
||||
console.warn("Warning: Version number not provided.");
|
||||
} else {
|
||||
console.log(`Updating EmulatorJS Version number to: ${update_version}`);
|
||||
}
|
||||
(async () => {
|
||||
console.log(`Current EmulatorJS Version: ${version}`);
|
||||
if (!update_version) {
|
||||
console.warn("Warning: Version number not provided.");
|
||||
} else {
|
||||
console.log(`Updating EmulatorJS Version number to: ${update_version}`);
|
||||
}
|
||||
|
||||
console.log("Updating EmulatorJS dependencies...");
|
||||
if (depsArg) {
|
||||
await updateDependencies();
|
||||
}
|
||||
if (update_version || dev === "false" || dev === "true") {
|
||||
console.log("Updating EmulatorJS version...");
|
||||
await updateVersion(update_version || version);
|
||||
}
|
||||
await updateContributors();
|
||||
console.log("Updating EmulatorJS completed.");
|
||||
console.log("Updating EmulatorJS dependencies...");
|
||||
if (depsArg) {
|
||||
await updateDependencies();
|
||||
}
|
||||
if (update_version || dev === "false" || dev === "true") {
|
||||
console.log("Updating EmulatorJS version...");
|
||||
await updateVersion(update_version || version);
|
||||
}
|
||||
await updateContributors();
|
||||
console.log("Updating EmulatorJS completed.");
|
||||
})();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user