aboutsummaryrefslogtreecommitdiff
path: root/generator/index.js
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-05-19 18:38:27 +0200
committerRaindropsSys <raindrops@equestria.dev>2024-05-19 18:38:27 +0200
commit50d630d1234d5cef6c7c457d44215e3ff404696e (patch)
tree353af747aa495e664cc2fe9fc6df5e6b44ca0297 /generator/index.js
parentfcdb5ca193406ef02dba8db4d7684d8c74089552 (diff)
downloadatomic-50d630d1234d5cef6c7c457d44215e3ff404696e.tar.gz
atomic-50d630d1234d5cef6c7c457d44215e3ff404696e.tar.bz2
atomic-50d630d1234d5cef6c7c457d44215e3ff404696e.zip
Updated 6 files and added 2 filesHEADmane
Diffstat (limited to 'generator/index.js')
-rw-r--r--generator/index.js27
1 files changed, 22 insertions, 5 deletions
diff --git a/generator/index.js b/generator/index.js
index 0b92105..ce42e6a 100644
--- a/generator/index.js
+++ b/generator/index.js
@@ -16,6 +16,11 @@ cp.execSync("npm install electron@latest --platform=darwin --arch=x64", { cwd: "
fs.renameSync("./work/node_modules/electron/dist", "./work/electron-darwin-x64");
fs.rmSync("./work/node_modules", { recursive: true });
+console.log("# Downloading Electron for Windows x64");
+cp.execSync("npm install electron@latest --platform=win32 --arch=x64", { cwd: "./work", stdio: "inherit" });
+fs.renameSync("./work/node_modules/electron/dist", "./work/electron-win32-x64");
+fs.rmSync("./work/node_modules", { recursive: true });
+
let version = fs.readFileSync("./work/electron-darwin-arm64/version").toString().trim();
console.log("# Electron version: " + version);
@@ -29,6 +34,9 @@ fs.renameSync("./work/electron-darwin-arm64/Electron.app", "./work/root/arm/Atom
fs.renameSync("./work/root/x64/AtomicRuntime.framework/Contents/MacOS/Electron", "./work/root/x64/AtomicRuntime.framework/Contents/MacOS/Atomic");
fs.renameSync("./work/root/arm/AtomicRuntime.framework/Contents/MacOS/Electron", "./work/root/arm/AtomicRuntime.framework/Contents/MacOS/Atomic");
+fs.renameSync("./work/electron-win32-x64", "./work/root/x64/AtomicRuntime");
+fs.renameSync("./work/root/x64/AtomicRuntime/electron.exe", "./work/root/x64/AtomicRuntime/atomic.exe");
+
fs.rmSync("./work/root/arm/AtomicRuntime.framework/Contents/Info.plist");
fs.rmSync("./work/root/arm/AtomicRuntime.framework/Contents/PkgInfo");
fs.rmSync("./work/root/x64/AtomicRuntime.framework/Contents/Info.plist");
@@ -52,7 +60,7 @@ for (let file of fs.readdirSync("../converter/").filter(i => i.startsWith("launc
fs.copyFileSync("../converter/" + file, "./work/root/launcher/Atomic/Launcher/" + file);
}
-console.log("# Generating installer");
+console.log("# Generating installer for macOS x64");
let data = plist['parse'](fs.readFileSync("./Atomic-x64.pkgproj").toString());
data["PACKAGES"].filter(i => i["PACKAGE_SETTINGS"]["NAME"] === "Atomic Runtime")[0]["PACKAGE_SETTINGS"]["VERSION"] = version;
@@ -63,6 +71,12 @@ fs.writeFileSync("./Atomic-x64-work.pkgproj", plist['build'](data)
.replaceAll("<data/>", "<data></data>")
);
+cp.execSync("packagesbuild ./Atomic-x64-work.pkgproj", { stdio: "inherit" });
+
+console.log("# Generating installer for macOS ARM");
+
+cp.execSync("packagesbuild ./Atomic-ARM-work.pkgproj", { stdio: "inherit" });
+
data = plist['parse'](fs.readFileSync("./Atomic-ARM.pkgproj").toString());
data["PACKAGES"].filter(i => i["PACKAGE_SETTINGS"]["NAME"] === "Atomic Runtime")[0]["PACKAGE_SETTINGS"]["VERSION"] = version;
fs.writeFileSync("./Atomic-ARM-work.pkgproj", plist['build'](data)
@@ -72,18 +86,21 @@ fs.writeFileSync("./Atomic-ARM-work.pkgproj", plist['build'](data)
.replaceAll("<data/>", "<data></data>")
);
-cp.execSync("packagesbuild ./Atomic-x64-work.pkgproj", { stdio: "inherit" });
-cp.execSync("packagesbuild ./Atomic-ARM-work.pkgproj", { stdio: "inherit" });
+console.log("# Generating installer for Windows x64");
+fs.writeFileSync("./windows-work.iss", fs.readFileSync("./windows.iss").toString().replace(/#define MyAppVersion "(.*)"/gm, '#define MyAppVersion "' + version + '"'));
+cp.execSync("wine ~/.wine/drive_c/Program\\ Files\\ \\(x86\\)/Inno\\ Setup\\ 6/ISCC.exe \"Z:\\Volumes\\Projects\\atomic\\generator\\windows-work.iss\"", { stdio: "inherit" });
console.log("# Cleaning up");
fs.renameSync("./build/ARM/Atomic.pkg", "./build/Atomic-Mac-ARM64.pkg");
fs.renameSync("./build/x64/Atomic.pkg", "./build/Atomic-Mac-x64.pkg");
-fs.rmdirSync("./build/ARM");
-fs.rmdirSync("./build/x64");
+fs.rmSync("./build/ARM", { recursive: true });
+fs.rmSync("./build/x64", { recursive: true });
fs.rmSync("./work", { recursive: true });
fs.rmSync("./Atomic-ARM-work.pkgproj");
fs.rmSync("./Atomic-x64-work.pkgproj");
+fs.rmSync("./windows-work.iss");
console.log("# Publishing to GitLab");
cp.execSync(`curl -v --header "PRIVATE-TOKEN: $(cat ~/.deploy.txt)" --header "Content-Type: multipart/form-data" --upload-file Atomic-Mac-ARM64.pkg https://source.equestria.dev/api/v4/projects/186/packages/generic/atomic/${version}/Atomic-Mac-ARM64.pkg`, { cwd: "./build" });
cp.execSync(`curl -v --header "PRIVATE-TOKEN: $(cat ~/.deploy.txt)" --header "Content-Type: multipart/form-data" --upload-file Atomic-Mac-x64.pkg https://source.equestria.dev/api/v4/projects/186/packages/generic/atomic/${version}/Atomic-Mac-x64.pkg`, { cwd: "./build" });
+cp.execSync(`curl -v --header "PRIVATE-TOKEN: $(cat ~/.deploy.txt)" --header "Content-Type: multipart/form-data" --upload-file Atomic-Win32-x64.exe https://source.equestria.dev/api/v4/projects/186/packages/generic/atomic/${version}/Atomic-Win32-x64.exe`, { cwd: "./build" });