diff --git a/.github/deploy.ts b/.github/deploy.ts index d8e5345..468b62d 100644 --- a/.github/deploy.ts +++ b/.github/deploy.ts @@ -1,7 +1,7 @@ import * as Client from "ssh2-sftp-client"; import * as archiver from "archiver"; import { platform, arch } from "os"; -import { createWriteStream } from "fs"; +import { createWriteStream, readdirSync } from "fs"; let sftp = new Client(); @@ -16,6 +16,8 @@ sftp let output = createWriteStream("app.zip"), archive = archiver("zip"); + console.log(readdirSync(`../dist/`)); + archive.directory( `../dist/PreMiD-${platform()}-${arch()}`, `PreMiD-${platform()}-${arch()}` diff --git a/installer_assets/PreMiD_x32.xml b/installer_assets/PreMiD_x32.xml deleted file mode 100644 index 6c6626a..0000000 --- a/installer_assets/PreMiD_x32.xml +++ /dev/null @@ -1,236 +0,0 @@ - - PreMiD - PreMiD - 2.0 - ${product_fullname}-${product_version}-installer_32bit.${platform_exec_suffix} - 0 - appIcon.png - - - default - Default Component - 1 - 1 - 1 - - - Program Files - ${installdir} - programfiles - all - - - ../tmp/update.ini - - - - - Program Files - ${installdir} - programfileslinux - linux - - - Program Files - ${installdir} - programfileswindows - windows - - - ../dist/PreMiD-win32-ia32/* - - - appIcon.ico - - - updater.exe - - - - - Program Files - ${installdir} - programfilesosx - osx - - - updater.app - - - ../dist/PreMiD-darwin-x64/PreMiD.app - - - - - - - - ${product_fullname} - 0 - 0 - ${installdir}/PreMID.exe - - - ${installdir}/ - - - - - - - 0 - ${product_fullname}.exe - Killing ${product_fullname} - 0 - - - windows - - - - - pkill - PreMiD - ${env(USER)} - 0 - ${installdir}/ - - - osx - - - is_running - PreMiD - - - - - ${windows_folder_local_appdata}\premid\Update.exe - --uninstall - - - 1 - ${windows_folder_local_appdata}\premid - - - - - windows - - - ${windows_folder_local_appdata}\premid\PreMiD.exe - - - - - - - 0 - PreMID.exe - & - Launching PreMiD - 0 - 0 - ${installdir} - - - windows - - - - - escaped_installdir - - \\ - ${installdir} - - - open - ${escaped_installdir}/PreMiD.app - Launching PreMiD - ${env(USER)} - 0 - ${installdir}/ - - - osx - - - - - ${installdir}/update - - - 1 - ${installdir} - - - ${windows_folder_local_appdata}\premid - - - windows - - - - - - - 0 - ${product_fullname}.exe - Killing ${product_fullname} - 0 - - - windows - - - - - pkill - PreMiD - ${env(USER)} - 0 - ${installdir}/ - - - osx - - - is_running - PreMiD - - - - - ${installdir}/update/ - - - 1 - ${windows_folder_appdata}/${product_fullname} - - - unattended - 0 - 1 - osx-intel osx-x86_64 - ../dist/installer - ${installdir}/appIcon.ico - 1 - minimal - Timeraa - appIcon.ico - - - installdir - Installer.Parameter.installdir.description - Installer.Parameter.installdir.explanation - - ${platform_install_prefix}/${product_shortname} - 0 - prefix - 1 - 0 - 40 - - - diff --git a/installer_assets/PreMiD_x64.xml b/installer_assets/installer.xml similarity index 83% rename from installer_assets/PreMiD_x64.xml rename to installer_assets/installer.xml index 0fe3815..9d09ed9 100644 --- a/installer_assets/PreMiD_x64.xml +++ b/installer_assets/installer.xml @@ -1,10 +1,11 @@ PreMiD PreMiD - 2.0 + {{VERSION}} ${product_fullname}-${product_version}-installer_64bit.${platform_exec_suffix} 0 - appIcon.png + ../installer_assets/appIcon.png + ../installer_assets/appIcon.icns default @@ -20,7 +21,7 @@ all - ../tmp/update.ini + update.ini @@ -37,13 +38,13 @@ windows - ../dist/PreMiD-win32-x64/* + ../dist/PACKAGEDNAME/* - appIcon.ico + ../installer_assets/appIcon.ico - updater.exe + ../installer_assets/updater.exe @@ -54,10 +55,10 @@ osx - updater.app + ../installer_assets/updater.app - ../dist/PreMiD-darwin-x64/PreMiD.app + ../dist/PACKAGEDNAME/PreMiD.app @@ -68,7 +69,7 @@ ${product_fullname} 0 0 - ${installdir}/PreMID.exe + ${installdir}/PreMiD.exe ${installdir}/ @@ -122,11 +123,29 @@ + + ${windows_folder_common_appdata}\${system_username}\premid\Update.exe + --uninstall + + + 1 + ${windows_folder_common_appdata}\${system_username}\premid + + + + + windows + + + ${windows_folder_common_appdata}\${system_username}\premid\PreMiD.exe + + + 0 - PreMID.exe + PreMiD.exe & Launching PreMiD 0 @@ -212,13 +231,15 @@ unattended 0 1 - osx-intel osx-x86_64 + user + onlyIfNewer + eu.Timeraa.PreMiD ../dist/installer ${installdir}/appIcon.ico 1 minimal Timeraa - appIcon.ico + ../installer_assets/appIcon.ico installdir @@ -234,4 +255,3 @@ - diff --git a/installer_assets/updater.xml b/installer_assets/updater.xml index 9966c94..458b11c 100644 --- a/installer_assets/updater.xml +++ b/installer_assets/updater.xml @@ -8,5 +8,4 @@ 1 ./ updater.${platform_exec_suffix} - osx-intel osx-x86_64 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b9deaa0..2412cd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "premid", - "version": "2.0.4", + "version": "2.0.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 52981cb..5eee7e8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "premid", "productName": "PreMiD", "description": "Discord Rich Presence for websites.", - "version": "2.0.4", + "version": "2.0.5", "repository": "https://github.com/PreMiD/PreMiD", "scripts": { "init": "tsc && tsc pkg devMode && node devMode.js compile", diff --git a/pkg.ts b/pkg.ts index eba0a8e..0f55e93 100644 --- a/pkg.ts +++ b/pkg.ts @@ -1,5 +1,5 @@ import * as electronPackager from "electron-packager"; -import { platform } from "os"; +import { platform, arch } from "os"; import { existsSync, readFileSync, writeFileSync } from "fs"; import { resolve } from "path"; import { exec } from "child_process"; @@ -11,7 +11,7 @@ import * as ora from "ora"; (async () => { let response = { os: "current", - arch: "current", + arch: "all", installer: false }; @@ -90,7 +90,26 @@ import * as ora from "ora"; } ]); - if (!response.os) return; + //#region WIP + let installerXml = readFileSync(`installer_assets/installer.xml`, "utf-8"); + + installerXml = installerXml.replace( + "{{VERSION}}", + require("./package.json").version + ); + installerXml = installerXml.replace( + /(PACKAGEDNAME)/g, + `PreMiD-${platform()}-${arch()}` + ); + + ensureDirSync("tmp"); + writeFileSync("tmp/installer.xml", installerXml); + //#endregion + + if (!response.os) { + process.exit(); + return; + } let icon: string; @@ -109,7 +128,7 @@ import * as ora from "ora"; removeSync("./dist/app/updater.exe"); let spinner = ora("Packaging app").start(), - packagingOptions = { + packagingOptions: electronPackager.Options = { dir: "./dist/app", out: "./dist", darwinDarkModeSupport: true, @@ -120,7 +139,9 @@ import * as ora from "ora"; appCategoryType: "Utilities", appCopyright: `Timeraa 2018-${new Date().getFullYear()}`, prune: true, + // @ts-ignore arch: response.arch, + // @ts-ignore platform: response.os }; @@ -132,6 +153,7 @@ import * as ora from "ora"; if (!response.installer) { spinner.text = "Done!"; spinner.succeed(); + process.exit(); return; } @@ -166,6 +188,7 @@ import * as ora from "ora"; if (!existsSync(bitRockBuilder) || !existsSync(bitRockUpdater)) { spinner.fail("Bitrock installation not found."); + process.exit(); return; } @@ -180,12 +203,13 @@ import * as ora from "ora"; updater.once("exit", (code, signal) => { if (![0, 1].includes(code)) { spinner.fail(`Updater failed with code ${code}: ${signal}`); + process.exit(); return; } spinner.text = "Building installer"; let builder = exec( - `"${bitRockBuilder}" build installer_assets/PreMiD_x64.xml ${ + `"${bitRockBuilder}" build tmp/installer.xml ${ platform() === "win32" ? "windows" : "osx" }` ); @@ -195,11 +219,13 @@ import * as ora from "ora"; if (code !== 0) { spinner.fail(`Error code: ${code}`); + process.exit(); return; } spinner.text = "Done!"; spinner.succeed(); + process.exit(); return; }); }); diff --git a/tsconfig.json b/tsconfig.json index 475df2a..e7309aa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,12 +3,12 @@ "module": "commonjs", "target": "es2018", "sourceMap": true, - "baseUrl": ".", "outDir": "dist/app", "removeComments": true, - "esModuleInterop": true + "esModuleInterop": true, + "typeRoots": ["@types/*"] }, - "include": ["src/**/*"], + "include": ["@types/*", "src/**/*"], "exclude": [ "devMode.ts", "pkg.ts",