mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2026-02-06 11:17:36 +00:00
Add update script (#990)
* add update script * fix formatting * spacing * typo * spacing * new line
This commit is contained in:
parent
1b655b9e4d
commit
45cc488ebc
2
.github/workflows/latest.yml
vendored
2
.github/workflows/latest.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
run: |
|
||||
cd /mnt/HDD/public
|
||||
chmod -R 755 .EmulatorJS/
|
||||
- name: Update Stable
|
||||
- name: Update Latest
|
||||
run: |
|
||||
cd /mnt/HDD/public/.EmulatorJS/
|
||||
git fetch --all
|
||||
|
||||
@ -205,7 +205,7 @@ If you want to help with localization, please check out the [localization](data/
|
||||
<!-- 🎮 🎮 🎮 🎮 🎮 🎮 🎮 🎮 🎮 Quicklinks 🎮 🎮 🎮 🎮 🎮 🎮 🎮 🎮 🎮 --->
|
||||
|
||||
[Configurator]: https://emulatorjs.org/editor
|
||||
[Contributors]: docs/Contributors.md
|
||||
[Contributors]: docs/contributors.md
|
||||
[Website]: https://emulatorjs.org/
|
||||
[Usage]: https://emulatorjs.org/docs/
|
||||
[Demo]: https://demo.emulatorjs.org/
|
||||
|
||||
File diff suppressed because one or more lines are too long
6
data/src/socket.io.min.js
vendored
6
data/src/socket.io.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1 +1,5 @@
|
||||
{ "read_me": "CURRENT_VERSION IS NO LONGER UPDATED. USE VERION", "current_version": 999999, "version": "4.2.1" }
|
||||
{
|
||||
"read_me": "CURRENT_VERSION IS NO LONGER UPDATED. USE VERSION",
|
||||
"current_version": 999999,
|
||||
"version": "4.2.1"
|
||||
}
|
||||
|
||||
46
docs/contributors.json
Normal file
46
docs/contributors.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"ignore": [
|
||||
"ethanaobrien",
|
||||
"allancoding",
|
||||
"michael-j-green",
|
||||
"ElectronicsArchiver"
|
||||
],
|
||||
"missing": [
|
||||
{
|
||||
"login": "jurcaalexandrucristian",
|
||||
"contributions": 1,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/74395896?v=4",
|
||||
"html_url": "https://github.com/jurcaalexandrucristian"
|
||||
},
|
||||
{
|
||||
"login": "Grey41",
|
||||
"contributions": 2,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/85015029?v=4",
|
||||
"html_url": "https://github.com/Grey41"
|
||||
},
|
||||
{
|
||||
"login": "eric183",
|
||||
"contributions": 1,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/10773980?v=4",
|
||||
"html_url": "https://github.com/eric183"
|
||||
},
|
||||
{
|
||||
"login": "Protektor-Desura",
|
||||
"contributions": 1,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1195496?v=4",
|
||||
"html_url": "https://github.com/Protektor-Desura"
|
||||
},
|
||||
{
|
||||
"login": "cheesykyle",
|
||||
"contributions": 1,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/17484761?v=4",
|
||||
"html_url": "https://github.com/cheesykyle"
|
||||
},
|
||||
{
|
||||
"login": "imneckro",
|
||||
"contributions": 1,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/42493772?v=4",
|
||||
"html_url": "https://github.com/imneckro"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -68,78 +68,35 @@
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<a href="https://github.com/n-at" target="_blank" title="n-at - Alexey Nurgaliev">![Avatar Alexey]</a>
|
||||
<a href="https://github.com/angelmarfil" target="_blank" title="angelmarfil - Angel Marfil">![Avatar angelmarfil]</a>
|
||||
<a href="https://github.com/incredibleIdea" target="_blank" title="incredibleIdea">![Avatar incredibleIdea]</a>
|
||||
<a href="https://github.com/gantoine" target="_blank" title="gantoine - Georges-Antoine Assi">![Avatar gantoine]</a>
|
||||
<a href="https://github.com/Grey41" target="_blank" title="Grey41 - Grey Hope">![Avatar Grey]</a>
|
||||
<a href="https://github.com/E-Sh4rk" target="_blank" title="E-Sh4rk - Mickaël Laurent"><img src="https://github.com/E-Sh4rk.png?size=95" width="95px"></a>
|
||||
<a href="https://github.com/pastisme" target="_blank" title="pastisme">![Avatar pastisme]</a>
|
||||
<a href="https://github.com/iGoodie" target="_blank" title="iGoodie - Anılcan Metinyurt">![Avatar iGoodie]</a>
|
||||
<a href="https://github.com/ZhaoTonggang" target="_blank" title="ZhaoTonggang - 赵彤刚">![Avatar ZhaoTonggang]</a>
|
||||
<a href="https://github.com/iits-reza" target="_blank" title="iits-reza - Reza Mohammadi">![Avatar iits-reza]</a>
|
||||
<a href="https://github.com/t3chnob0y" target="_blank" title="t3chnob0y">![Avatar t3chnob0y]</a>
|
||||
<a href="https://github.com/kellenmace" target="_blank" title="kellenmace - Kellen Mace">![Avatar kellenmace]</a>
|
||||
<a href="https://github.com/pjft" target="_blank" title="pjft"><img src="https://github.com/pjft.png?size=95" width="95px"></a>
|
||||
<a href="https://github.com/IvanMazzoli" target="_blank" title="IvanMazzoli">![Avatar IvanMazzoli]</a>
|
||||
<a href="https://github.com/jonas0b1011001" target="_blank" title="jonas0b1011001">![Avatar jonas0b1011001]</a>
|
||||
<a href="https://github.com/TimKieu" target="_blank" title="TimKieu"><img src="https://github.com/TimKieu.png?size=95" width="95px"></a>
|
||||
<a href="https://github.com/MattiaPell" target="_blank" title="MattiaPell">![Avatar MattiaPell]</a>
|
||||
<a href="https://github.com/andrigamerita" target="_blank" title="andrigamerita">![Avatar andrigamerita]</a>
|
||||
<a href="https://github.com/oyepriyansh" target="_blank" title="oyepriyansh - Priyansh Prajapat">![Avatar Priyansh]</a>
|
||||
<a href="https://github.com/debuggerx01" target="_blank" title="debuggerx01">![Avatar debuggerx01]</a>
|
||||
<a href="https://github.com/eric183" target="_blank" title="eric183 - ericKuang">![Avatar ericKuang]</a>
|
||||
<a href="https://github.com/Protektor-Desura" target="_blank" title="Protektor-Desura - Protektor">![Avatar Protektor]</a>
|
||||
<a href="https://github.com/cheesykyle" target="_blank" title="CheesyKyle - Kyle Steffel">![Avatar Kyle]</a>
|
||||
<a href="https://github.com/imneckro" target="_blank" title="ImNekro - ck-oneman">![Avatar Nekro]</a>
|
||||
</div>
|
||||
<!-- Others -->
|
||||
<a href="https://github.com/n-at" target="_blank" title="n-at - Contributions: 40" alt="n-at"><img src="https://avatars.githubusercontent.com/u/2185280?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/gantoine" target="_blank" title="gantoine - Contributions: 4" alt="gantoine"><img src="https://avatars.githubusercontent.com/u/3247106?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/angelmarfil" target="_blank" title="angelmarfil - Contributions: 3" alt="angelmarfil"><img src="https://avatars.githubusercontent.com/u/59626670?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/E-Sh4rk" target="_blank" title="E-Sh4rk - Contributions: 2" alt="E-Sh4rk"><img src="https://avatars.githubusercontent.com/u/13153243?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/incredibleIdea" target="_blank" title="incredibleIdea - Contributions: 2" alt="incredibleIdea"><img src="https://avatars.githubusercontent.com/u/23035551?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/pastisme" target="_blank" title="pastisme - Contributions: 2" alt="pastisme"><img src="https://avatars.githubusercontent.com/u/166672781?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/Grey41" target="_blank" title="Grey41 - Contributions: 2" alt="Grey41"><img src="https://avatars.githubusercontent.com/u/85015029?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/ZhaoTonggang" target="_blank" title="ZhaoTonggang - Contributions: 1" alt="ZhaoTonggang"><img src="https://avatars.githubusercontent.com/u/81669862?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/t3chnob0y" target="_blank" title="t3chnob0y - Contributions: 1" alt="t3chnob0y"><img src="https://avatars.githubusercontent.com/u/18381004?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/pjft" target="_blank" title="pjft - Contributions: 1" alt="pjft"><img src="https://avatars.githubusercontent.com/u/22025709?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/noel-forester" target="_blank" title="noel-forester - Contributions: 1" alt="noel-forester"><img src="https://avatars.githubusercontent.com/u/62397558?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/jonas0b1011001" target="_blank" title="jonas0b1011001 - Contributions: 1" alt="jonas0b1011001"><img src="https://avatars.githubusercontent.com/u/43352574?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/debuggerx01" target="_blank" title="debuggerx01 - Contributions: 1" alt="debuggerx01"><img src="https://avatars.githubusercontent.com/u/19624835?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/andrigamerita" target="_blank" title="andrigamerita - Contributions: 1" alt="andrigamerita"><img src="https://avatars.githubusercontent.com/u/37557992?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/TimKieu" target="_blank" title="TimKieu - Contributions: 1" alt="TimKieu"><img src="https://avatars.githubusercontent.com/u/90356683?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/iits-reza" target="_blank" title="iits-reza - Contributions: 1" alt="iits-reza"><img src="https://avatars.githubusercontent.com/u/56708670?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/oyepriyansh" target="_blank" title="oyepriyansh - Contributions: 1" alt="oyepriyansh"><img src="https://avatars.githubusercontent.com/u/83062406?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/MattiaPell" target="_blank" title="MattiaPell - Contributions: 1" alt="MattiaPell"><img src="https://avatars.githubusercontent.com/u/47603639?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/kellenmace" target="_blank" title="kellenmace - Contributions: 1" alt="kellenmace"><img src="https://avatars.githubusercontent.com/u/5306336?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/IvanMazzoli" target="_blank" title="IvanMazzoli - Contributions: 1" alt="IvanMazzoli"><img src="https://avatars.githubusercontent.com/u/7896815?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/iGoodie" target="_blank" title="iGoodie - Contributions: 1" alt="iGoodie"><img src="https://avatars.githubusercontent.com/u/8591785?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/jurcaalexandrucristian" target="_blank" title="jurcaalexandrucristian - Contributions: 1" alt="jurcaalexandrucristian"><img src="https://avatars.githubusercontent.com/u/74395896?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/eric183" target="_blank" title="eric183 - Contributions: 1" alt="eric183"><img src="https://avatars.githubusercontent.com/u/10773980?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/Protektor-Desura" target="_blank" title="Protektor-Desura - Contributions: 1" alt="Protektor-Desura"><img src="https://avatars.githubusercontent.com/u/1195496?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/cheesykyle" target="_blank" title="cheesykyle - Contributions: 1" alt="cheesykyle"><img src="https://avatars.githubusercontent.com/u/17484761?v=4&size=95" width="95px"></a>
|
||||
<a href="https://github.com/imneckro" target="_blank" title="imneckro - Contributions: 1" alt="imneckro"><img src="https://avatars.githubusercontent.com/u/42493772?v=4&size=95" width="95px"></a>
|
||||
|
||||
|
||||
<!------------------------------------------------------------------------------>
|
||||
|
||||
[Avatar Nekro]: https://github.com/imneckro.png?size=95
|
||||
|
||||
[Avatar Grey]: https://github.com/Grey41.png?size=95
|
||||
|
||||
[Avatar Kyle]: https://github.com/cheesykyle.png?size=95
|
||||
|
||||
[Avatar Protektor]: https://github.com/Protektor-Desura.png?size=95
|
||||
|
||||
[Avatar ericKuang]: https://github.com/eric183.png?size=95
|
||||
|
||||
[Avatar incredibleIdea]: https://github.com/incredibleIdea.png?size=95
|
||||
|
||||
[Avatar Alexey]: https://github.com/n-at.png?size=95
|
||||
|
||||
[Avatar Mickaël]: https://github.com/E-Sh4rk.png?size=95
|
||||
|
||||
[Avatar andrigamerita]: https://github.com/andrigamerita.png?size=95
|
||||
|
||||
[Avatar Priyansh]: https://github.com/oyepriyansh.png?size=95
|
||||
|
||||
[Avatar debuggerx01]: https://github.com/debuggerx01.png?size=95
|
||||
|
||||
[Avatar gantoine]: https://github.com/gantoine.png?size=95
|
||||
|
||||
[Avatar angelmarfil]: https://github.com/angelmarfil.png?size=95
|
||||
|
||||
[Avatar MattiaPell]: https://github.com/MattiaPell.png?size=95
|
||||
|
||||
[Avatar jonas0b1011001]: https://github.com/jonas0b1011001.png?size=95
|
||||
|
||||
[Avatar IvanMazzoli]: https://github.com/IvanMazzoli.png?size=95
|
||||
|
||||
[Avatar iGoodie]: https://github.com/iGoodie.png?size=95
|
||||
|
||||
[Avatar ZhaoTonggang]: https://github.com/ZhaoTonggang.png?size=95
|
||||
|
||||
[Avatar pastisme]: https://github.com/pastisme.png?size=95
|
||||
|
||||
[Avatar t3chnob0y]: https://github.com/t3chnob0y.png?size=95
|
||||
|
||||
[Avatar iits-reza]: https://github.com/iits-reza.png?size=95
|
||||
|
||||
[Avatar kellenmace]: https://github.com/kellenmace.png?size=95
|
||||
<!-- Others End -->
|
||||
|
||||
<!----------------------------------{ Ethan }----------------------------------->
|
||||
[Badge Ethan GitHub]: https://img.shields.io/badge/Ethan_O'_Brien-181717.svg?style=for-the-badge&logo=GitHub&logoColor=white
|
||||
@ -16,15 +16,18 @@
|
||||
"scripts": {
|
||||
"start": "http-server",
|
||||
"minify": "node minify/minify.js",
|
||||
"build": "node build.js"
|
||||
"build": "node build.js",
|
||||
"update": "node update.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"http-server": "^14.1.1",
|
||||
"@node-minify/clean-css": "^9.0.1",
|
||||
"@node-minify/core": "^9.0.2",
|
||||
"@node-minify/terser": "^9.0.1",
|
||||
"http-server": "^14.1.1",
|
||||
"node-7z": "^3.0.0",
|
||||
"node-fetch": "^3.3.2"
|
||||
"node-fetch": "^3.3.2",
|
||||
"nipplejs": "^0.10.2",
|
||||
"socket.io": "^4.8.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@emulatorjs/cores": "latest"
|
||||
|
||||
126
update.js
Normal file
126
update.js
Normal file
@ -0,0 +1,126 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import fetch from 'node-fetch';
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const versionArg = args.find(arg => arg.startsWith('--ejs_v='));
|
||||
const devArg = args.find(arg => arg.startsWith('--dev='));
|
||||
const update_version = versionArg ? versionArg.split('=')[1] : process.env.ejs_v;
|
||||
const dev = devArg ? devArg.split('=')[1] : null;
|
||||
let version;
|
||||
|
||||
try {
|
||||
const packageJsonPath = path.resolve('package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
version = packageJson.version;
|
||||
} catch(error) {
|
||||
console.error("Error reading version from package.json:", error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const updateDependencies = async () => {
|
||||
const socket_io = path.resolve('node_modules', 'socket.io', 'client-dist', 'socket.io.min.js');
|
||||
const ejs_socket_io = path.resolve('data', 'src', 'socket.io.min.js');
|
||||
const nipplejs = path.resolve('node_modules', 'nipplejs', 'dist', 'nipplejs.js');
|
||||
const ejs_nipplejs = path.resolve('data', 'src', 'nipplejs.js');
|
||||
|
||||
try {
|
||||
fs.copyFileSync(socket_io, ejs_socket_io);
|
||||
} catch(error) {
|
||||
console.error("Error updating socket.io:", error.message);
|
||||
}
|
||||
|
||||
try {
|
||||
fs.copyFileSync(nipplejs, ejs_nipplejs);
|
||||
} catch(error) {
|
||||
console.error("Error updating nipplejs:", error.message);
|
||||
}
|
||||
console.log("Updated socket.io and nipplejs.");
|
||||
};
|
||||
|
||||
const updateVersion = async (newVersion) => {
|
||||
const packageJsonPath = path.resolve('package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
packageJson.version = newVersion;
|
||||
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 4) + '\n');
|
||||
console.log(`Updated version to ${newVersion} in package.json.`);
|
||||
|
||||
const versionJsonPath = path.resolve('data', 'version.json');
|
||||
const versionJson = JSON.parse(fs.readFileSync(versionJsonPath, 'utf8'));
|
||||
versionJson.version = newVersion;
|
||||
fs.writeFileSync(versionJsonPath, JSON.stringify(versionJson, null, 4) + '\n');
|
||||
console.log(`Updated version to ${newVersion} in data/version.json.`);
|
||||
|
||||
const coresJsonPath = path.resolve('data', 'cores', 'package.json');
|
||||
const coresJson = JSON.parse(fs.readFileSync(coresJsonPath, 'utf8'));
|
||||
coresJson.version = newVersion;
|
||||
fs.writeFileSync(coresJsonPath, JSON.stringify(coresJson, null, 4) + '\n');
|
||||
console.log(`Updated version to ${newVersion} in data/cores/package.json.`);
|
||||
|
||||
const emulatorJsPath = path.resolve('data', 'src', 'emulator.js');
|
||||
const emulatorJs = fs.readFileSync(emulatorJsPath, 'utf8');
|
||||
let updatedEmulatorJs = "";
|
||||
if (dev === "true") {
|
||||
updatedEmulatorJs = emulatorJs.replace(/this\.ejs_version\s*=\s*".*?";/, `this.ejs_version = "${newVersion}-dev";`);
|
||||
} else {
|
||||
updatedEmulatorJs = emulatorJs.replace(/this\.ejs_version\s*=\s*".*?";/, `this.ejs_version = "${newVersion}";`);
|
||||
}
|
||||
fs.writeFileSync(emulatorJsPath, updatedEmulatorJs);
|
||||
console.log(`Updated version to ${newVersion} in data/src/emulator.js.`);
|
||||
};
|
||||
|
||||
const fetchContributors = async () => {
|
||||
const url = 'https://api.github.com/repos/EmulatorJS/EmulatorJS/contributors';
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch contributors: ${response.statusText}`);
|
||||
}
|
||||
return await response.json();
|
||||
} catch(error) {
|
||||
console.error("Error fetching contributors:", error.message);
|
||||
}
|
||||
};
|
||||
|
||||
const updateContributors = async () => {
|
||||
const contributors = await fetchContributors();
|
||||
const ignoredContributors = JSON.parse(fs.readFileSync(path.resolve('docs', 'contributors.json'), 'utf8')).ignore;
|
||||
const missingContributors = JSON.parse(fs.readFileSync(path.resolve('docs', 'contributors.json'), 'utf8')).missing;
|
||||
if (!contributors) return;
|
||||
const sortedContributors = contributors
|
||||
.concat(missingContributors)
|
||||
.sort((a, b) => b.contributions - a.contributions)
|
||||
.filter(contributor => !ignoredContributors.includes(contributor.login));
|
||||
const uniqueContributors = Array.from(new Set(sortedContributors.map(contributor => contributor.login)))
|
||||
.map(login => sortedContributors.find(contributor => contributor.login === login));
|
||||
const finalContributors = uniqueContributors.sort((a, b) => b.contributions - a.contributions);
|
||||
let contributorReadme = ""
|
||||
finalContributors
|
||||
.forEach(contributor => {
|
||||
contributorReadme += `<a href="${contributor.html_url}" target="_blank" title="${contributor.login} - Contributions: ${contributor.contributions}" alt="${contributor.login}"><img src="${contributor.avatar_url}&size=95" width="95px"></a> \n`;
|
||||
});
|
||||
const contributorsPath = path.resolve('docs', 'contributors.md');
|
||||
const contributorsReadme = fs.readFileSync(contributorsPath, 'utf8');
|
||||
const startLine = contributorsReadme.split('\n').findIndex(line => line.startsWith("<!-- Others -->")) + 1;
|
||||
const endLine = contributorsReadme.split('\n').findIndex(line => line.startsWith("<!-- Others End -->")) - 1;
|
||||
const updatedContributorsReadme = contributorsReadme.split('\n').filter((line, index) => index < startLine || index > endLine).join('\n');
|
||||
const newContributorsReadme = updatedContributorsReadme.replace("<!-- Others -->", `<!-- Others -->\n${contributorReadme}`);
|
||||
fs.writeFileSync(contributorsPath, newContributorsReadme);
|
||||
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}`);
|
||||
}
|
||||
|
||||
console.log("Updating EmulatorJS dependencies...");
|
||||
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