diff --git a/installer_assets/PreMiD-Upgrade.xml b/installer_assets/PreMiD-Upgrade.xml
new file mode 100644
index 0000000..e94230e
--- /dev/null
+++ b/installer_assets/PreMiD-Upgrade.xml
@@ -0,0 +1,463 @@
+
+ PreMiD
+ PreMiD
+ 2.1
+ upgrader.${platform_exec_suffix}
+ 0
+ ../LICENSE
+ 0
+ leftSide.png
+ logo.png
+ logo.png
+
+
+ default
+ Default Component
+ 1
+ 1
+ 1
+
+
+ Program Files
+ ${installdir}
+ programfiles
+ all
+
+
+ Uninstall
+ ${installdir}/${uninstallerName}
+
+ Uninstall ${product_fullname}
+ ${installdir}
+ all
+ 0
+ 0
+ ${installdir}/${uninstallerName}.exe
+
+
+ ${installdir}
+
+
+
+
+ Program Files
+ ${installdir}
+ programfileslinux
+ linux
+
+
+ Program Files
+ ${installdir}
+ programfileslinux64
+ linux-x64
+
+
+ Program Files
+ ${installdir}
+ programfileswindows
+ windows
+
+
+ Program Files
+ ${installdir}
+ programfileswindows64
+ windows-x64
+
+
+ Program Files
+ ${installdir}
+ programfilesosx
+ osx
+
+
+
+
+ Uninstall ${product_fullname}
+ Uninstall ${product_fullname}
+ 0
+ 0
+ ${installdir}/${uninstallerName}.exe
+
+
+ ${installdir}/
+
+
+ Rich Presence for web services.
+ PreMiD
+ 0
+ 0
+ ${installdir}/PreMiD.${platform_exec_suffix}
+
+
+
+
+
+
+
+
+
+ project.installationType
+ upgrade
+
+
+ ${installdir}
+
+
+
+
+
+
+ Killing ${product_fullname}...
+
+
+ 0
+ ${product_fullname}.exe
+ 0
+
+
+ windows
+
+
+
+
+ pkill
+ PreMiD
+ ${env(USER)}
+ 0
+ ${installdir}/
+
+
+ osx
+
+
+ is_running
+ PreMiD
+
+
+
+
+
+
+
+
+
+
+
+ HKEY_LOCAL_MACHINE\Software\${project.windowsSoftwareRegistryPrefix}
+ Version
+ oldVersion
+
+
+
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${project.fullName} ${oldVersion}
+
+
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\${project.fullName} ${oldVersion}
+
+
+
+
+
+
+
+
+
+ Couldn't download release... Try again later.
+ Downloading latest release...
+
+
+ ${platform_name}
+ ${system_temp_directory}/PreMiD-release.zip
+ https://dl.premid.app/PreMiD-win32-x64.zip
+
+
+ windows-x64
+
+
+
+
+ ${platform_name}
+ ${system_temp_directory}/PreMiD-release.zip
+ https://dl.premid.app/PreMiD-win32-x86.zip
+
+
+ windows-x86
+
+
+
+
+ ${platform_name}
+ ${system_temp_directory}/PreMiD-release.zip
+ https://dl.premid.app/PreMiD-osx.zip
+
+
+ osx
+
+
+
+
+
+
+
+
+ 0
+ ${installdir}
+ Extracting release...
+ ${system_temp_directory}/PreMiD-release.zip
+
+
+ 1
+ ${installdir}/
+
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\agjnjboanicjcpenljmaaigopkgdnihi
+ update_url
+ Adding Extension (Chrome only)
+ REG_SZ
+ https://clients2.google.com/service/update2/crx
+ 64
+
+
+ windows
+
+
+
+
+
+
+ Killing ${product_fullname}...
+
+
+ 0
+ ${product_fullname}.exe
+ 0
+
+
+ windows
+
+
+
+
+ pkill
+ PreMiD
+ ${env(USER)}
+ 0
+ ${installdir}/
+
+
+ osx
+
+
+ is_running
+ PreMiD
+
+
+
+
+
+
+
+
+
+
+ yes
+ Uninstall browser extension?
+ removeExtension
+
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\agjnjboanicjcpenljmaaigopkgdnihi
+
+
+
+ ${removeExtension}
+
+
+
+
+
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\agjnjboanicjcpenljmaaigopkgdnihi
+ exists
+
+ 64
+
+
+
+
+ 1
+ lzham-ultra
+ unattended
+ Rich Presence for web services.
+ 1
+ 0
+ 1
+ 1
+ user
+ upgrade
+ utf-8
+ appIcon.icns
+ eu.Timeraa.PreMiD
+ appIcon.icns
+ ../dist/installer
+ onlyIfNewer
+ C:/Users/metzf/Documents/Development/PreMiD/PreMiD/installer_assets/appIcon.ico
+ https://discord.gg/PreMiD
+ https://premid.app
+ utf-8
+ 1
+ 1
+ 1
+ Rich Presence for web services.
+ https://api.premid.app/app/update
+ Timeraa
+ 200
+ appIcon.ico
+ Rich Presence for web services.
+ appIcon.ico
+
+
+ en
+ utf-8
+ ../LICENSE
+
+
+
+
+ installdir
+ Installer.Parameter.installdir.description
+ Installer.Parameter.installdir.explanation
+
+ ${platform_install_prefix}/${product_shortname}
+ 0
+ yes
+ prefix
+ yes
+ 0
+ 40
+
+
+ post_install_page
+ Installation Finished
+
+
+
+ installation
+
+
+ general
+ General
+
+
+
+
+ addDesktop
+ Create Desktop Icon
+
+ false
+ false
+ checkbox-left
+
+
+ launchApp
+ Launch App
+
+ true
+ true
+ checkbox-left
+
+
+ windows
+
+
+
+
+ extra
+ Extra
+
+
+
+
+ openStore
+ Open Presence Store
+
+ true
+ true
+ checkbox-left
+
+
+
+
+ ${windows_folder_desktopdirectory}
+
+
+ ${addDesktop}
+
+
+
+
+ Rich Presence for web services.
+ PreMiD
+ 0
+ 0
+ ${installdir}/PreMiD.${platform_exec_suffix}
+
+
+
+
+
+
+
+ 0
+ PreMiD.exe
+ &
+ Launching PreMiD...
+ 0
+ ${installdir}
+
+
+ windows
+
+
+ ${launchApp}
+
+
+
+
+ 0
+ open
+ ${installdir}/PreMiD.app
+ Launching PreMiD...
+ ${env(USER)}
+ 0
+ 0
+
+
+ osx
+
+
+ ${launchApp}
+
+
+
+
+ https://premid.app/store
+
+
+ ${openStore}
+
+
+
+
+
+
+
+
+
+ windows
+
+
+
+
diff --git a/installer_assets/PreMiD.xml b/installer_assets/PreMiD.xml
new file mode 100644
index 0000000..9f9076d
--- /dev/null
+++ b/installer_assets/PreMiD.xml
@@ -0,0 +1,460 @@
+
+ PreMiD
+ PreMiD
+ latest
+ ${product_shortname}-${platform_name}-installer.${platform_exec_suffix}
+ 0
+ ../LICENSE
+ leftSide.png
+ logo.png
+ logo.png
+
+
+ default
+ Default Component
+ 1
+ 1
+ 1
+
+
+ Program Files
+ ${installdir}
+ programfiles
+ all
+
+
+ Uninstall
+ ${installdir}/${uninstallerName}
+
+ Uninstall ${product_fullname}
+ ${installdir}
+ all
+ 0
+ 0
+ ${installdir}/${uninstallerName}.exe
+
+
+ ${installdir}
+
+
+
+
+ Program Files
+ ${installdir}
+ programfileslinux
+ linux
+
+
+ Program Files
+ ${installdir}
+ programfileslinux64
+ linux-x64
+
+
+ Program Files
+ ${installdir}
+ programfileswindows
+ windows
+
+
+ Program Files
+ ${installdir}
+ programfileswindows64
+ windows-x64
+
+
+ Program Files
+ ${installdir}
+ programfilesosx
+ osx
+
+
+
+
+ Uninstall ${product_fullname}
+ Uninstall ${product_fullname}
+ 0
+ 0
+ ${installdir}/${uninstallerName}.exe
+
+
+ ${installdir}/
+
+
+ Rich Presence for web services.
+ PreMiD
+ 0
+ 0
+ ${installdir}/PreMiD.${platform_exec_suffix}
+
+
+
+
+
+
+
+
+
+ project.installationType
+ upgrade
+
+
+ ${installdir}
+
+
+
+
+
+
+ Killing ${product_fullname}...
+
+
+ 0
+ ${product_fullname}.exe
+ 0
+
+
+ windows
+
+
+
+
+ pkill
+ PreMiD
+ ${env(USER)}
+ 0
+ ${installdir}/
+
+
+ osx
+
+
+ is_running
+ PreMiD
+
+
+
+
+
+
+
+
+
+
+
+ HKEY_LOCAL_MACHINE\Software\${project.windowsSoftwareRegistryPrefix}
+ Version
+ oldVersion
+
+
+
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${project.fullName} ${oldVersion}
+
+
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\${project.fullName} ${oldVersion}
+
+
+
+
+
+
+
+
+
+ Couldn't download release... Try again later.
+ Downloading latest release...
+
+
+ ${platform_name}
+ ${system_temp_directory}/PreMiD-release.zip
+ https://dl.premid.app/PreMiD-win32-x64.zip
+
+
+ windows-x64
+
+
+
+
+ ${platform_name}
+ ${system_temp_directory}/PreMiD-release.zip
+ https://dl.premid.app/PreMiD-win32-x86.zip
+
+
+ windows-x86
+
+
+
+
+ ${platform_name}
+ ${system_temp_directory}/PreMiD-release.zip
+ https://dl.premid.app/PreMiD-osx.zip
+
+
+ osx
+
+
+
+
+
+
+
+
+ 0
+ ${installdir}
+ Extracting release...
+ ${system_temp_directory}/PreMiD-release.zip
+
+
+ 1
+ ${installdir}/
+
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\agjnjboanicjcpenljmaaigopkgdnihi
+ update_url
+ Adding Extension (Chrome only)
+ REG_SZ
+ https://clients2.google.com/service/update2/crx
+ 64
+
+
+ windows
+
+
+
+
+
+
+ Killing ${product_fullname}...
+
+
+ 0
+ ${product_fullname}.exe
+ 0
+
+
+ windows
+
+
+
+
+ pkill
+ PreMiD
+ ${env(USER)}
+ 0
+ ${installdir}/
+
+
+ osx
+
+
+ is_running
+ PreMiD
+
+
+
+
+
+
+
+
+
+
+ yes
+ Uninstall browser extension?
+ removeExtension
+
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\agjnjboanicjcpenljmaaigopkgdnihi
+
+
+
+ ${removeExtension}
+
+
+
+
+
+
+ HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Google\Chrome\Extensions\agjnjboanicjcpenljmaaigopkgdnihi
+ exists
+
+ 64
+
+
+
+
+ 1
+ lzham-ultra
+ Rich Presence for web services.
+ 1
+ 0
+ 1
+ 1
+ user
+ utf-8
+ appIcon.icns
+ eu.Timeraa.PreMiD
+ appIcon.icns
+ ../dist/installer
+ onlyIfNewer
+ C:/Users/metzf/Documents/Development/PreMiD/PreMiD/installer_assets/appIcon.ico
+ https://discord.gg/PreMiD
+ https://premid.app
+ utf-8
+ 1
+ 1
+ 1
+ Rich Presence for web services.
+ https://api.premid.app/app/update
+ Timeraa
+ 200
+ appIcon.ico
+ Rich Presence for web services.
+ appIcon.ico
+
+
+ en
+ utf-8
+ ../LICENSE
+
+
+
+
+ installdir
+ Installer.Parameter.installdir.description
+ Installer.Parameter.installdir.explanation
+
+ ${platform_install_prefix}/${product_shortname}
+ 0
+ yes
+ prefix
+ yes
+ 0
+ 40
+
+
+ post_install_page
+ Installation Finished
+
+
+
+ installation
+
+
+ general
+ General
+
+
+
+
+ addDesktop
+ Create Desktop Icon
+
+ false
+ false
+ checkbox-left
+
+
+ launchApp
+ Launch App
+
+ true
+ true
+ checkbox-left
+
+
+ windows
+
+
+
+
+ extra
+ Extra
+
+
+
+
+ openStore
+ Open Presence Store
+
+ true
+ true
+ checkbox-left
+
+
+
+
+ ${windows_folder_desktopdirectory}
+
+
+ ${addDesktop}
+
+
+
+
+ Rich Presence for web services.
+ PreMiD
+ 0
+ 0
+ ${installdir}/PreMiD.${platform_exec_suffix}
+
+
+
+
+
+
+
+ 0
+ PreMiD.exe
+ &
+ Launching PreMiD...
+ 0
+ ${installdir}
+
+
+ windows
+
+
+ ${launchApp}
+
+
+
+
+ 0
+ open
+ ${installdir}/PreMiD.app
+ Launching PreMiD...
+ ${env(USER)}
+ 0
+ 0
+
+
+ osx
+
+
+ ${launchApp}
+
+
+
+
+ https://premid.app/store
+
+
+ ${openStore}
+
+
+
+
+
+
+
+
+
+ windows
+
+
+
+
diff --git a/installer_assets/installer.xml b/installer_assets/installer.xml
deleted file mode 100644
index 7022be2..0000000
--- a/installer_assets/installer.xml
+++ /dev/null
@@ -1,265 +0,0 @@
-
- PreMiD
- PreMiD
- VERSION
- ${product_fullname}-${product_version}-installer_64bit.${platform_exec_suffix}
- 0
- ../installer_assets/appIcon.png
- ../installer_assets/appIcon.icns
-
-
- default
- Default Component
- 1
- 1
- 1
-
-
- Program Files
- ${installdir}
- programfiles
- all
-
-
- update.ini
-
-
-
-
- Program Files
- ${installdir}
- programfileslinux
- linux
-
-
- Program Files
- ${installdir}
- programfileswindows
- windows
-
-
- ../dist/PACKAGEDNAME/*
-
-
- ../installer_assets/appIcon.ico
-
-
- ../installer_assets/updater.exe
-
-
-
-
- Program Files
- ${installdir}
- programfilesosx
- osx
-
-
- ../installer_assets/updater.app
-
-
- ../dist/PACKAGEDNAME/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
-
-
-
-
- ${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
- &
- 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
- 1
- 0
- 1
- user
- onlyIfNewer
- eu.Timeraa.PreMiD
- ../dist/installer
- onlyIfNewer
- Your Rich Presence for web services!
- ${installdir}/appIcon.ico
- https://discord.premid.app
- https://premid.app
- 1
- 1
- 1
- 1
- minimal
- Timeraa
- ../installer_assets/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/leftSide.png b/installer_assets/leftSide.png
new file mode 100644
index 0000000..c8daebe
Binary files /dev/null and b/installer_assets/leftSide.png differ
diff --git a/installer_assets/logo.png b/installer_assets/logo.png
new file mode 100644
index 0000000..3968836
Binary files /dev/null and b/installer_assets/logo.png differ
diff --git a/installer_assets/update.ini b/installer_assets/update.ini
index 782758f..11e257b 100644
--- a/installer_assets/update.ini
+++ b/installer_assets/update.ini
@@ -1,6 +1,6 @@
[Update]
-url=https://api.premid.app/app/update/64bit/
-version_id= ?
+url=https://api.premid.app/app/update/
+version_id=?
check_for_updates=1
-update_download_location=${installer_directory}/update
+update_download_location=${installer_directory}
diff --git a/installer_assets/updater.xml b/installer_assets/updater.xml
index 458b11c..82baf8a 100644
--- a/installer_assets/updater.xml
+++ b/installer_assets/updater.xml
@@ -6,6 +6,6 @@
1
asInvoker
1
- ./
+ ../dist/app/
updater.${platform_exec_suffix}
\ No newline at end of file
diff --git a/pkg.ts b/pkg.ts
index 0f55e93..b73f295 100644
--- a/pkg.ts
+++ b/pkg.ts
@@ -1,6 +1,6 @@
import * as electronPackager from "electron-packager";
import { platform, arch } from "os";
-import { existsSync, readFileSync, writeFileSync } from "fs";
+import { existsSync, readFileSync, writeFileSync, copyFileSync } from "fs";
import { resolve } from "path";
import { exec } from "child_process";
import { removeSync, ensureDirSync } from "fs-extra";
@@ -9,225 +9,192 @@ import * as prompts from "prompts";
import * as ora from "ora";
(async () => {
- let response = {
- os: "current",
- arch: "all",
- installer: false
- };
+ let response = {
+ os: "current",
+ arch: "all",
+ installer: false
+ };
- if (process.env.NODE_ENV !== "DePloY")
- response = await prompts([
- {
- type: "select",
- name: "arch",
- message: "What architecture?",
- choices: [
- {
- title: "current",
- value: "current"
- },
- {
- title: "all",
- value: "all"
- },
- {
- title: "arm64",
- value: "arm64"
- },
- {
- title: "armv7l",
- value: "armv7l"
- },
- {
- title: "ia32",
- value: "ia32"
- },
- {
- title: "mips64el",
- value: "mips64el"
- },
- {
- title: "x64",
- value: "x64"
- }
- ]
- },
- {
- type: "select",
- name: "os",
- message: "What operating system?",
- choices: [
- {
- title: "current",
- value: "current"
- },
- {
- title: "all",
- value: "all"
- },
- {
- title: "darwin",
- value: "darwin"
- },
- {
- title: "linux",
- value: "linux"
- },
- {
- title: "mas",
- value: "mas"
- },
- {
- title: "win32",
- value: "win32"
- }
- ]
- },
- {
- type: "confirm",
- name: "installer",
- message: "With installer?"
- }
- ]);
+ if (process.env.NODE_ENV !== "DePloY")
+ response = await prompts([
+ {
+ type: "select",
+ name: "arch",
+ message: "What architecture?",
+ choices: [
+ {
+ title: "current",
+ value: "current"
+ },
+ {
+ title: "all",
+ value: "all"
+ },
+ {
+ title: "arm64",
+ value: "arm64"
+ },
+ {
+ title: "armv7l",
+ value: "armv7l"
+ },
+ {
+ title: "ia32",
+ value: "ia32"
+ },
+ {
+ title: "mips64el",
+ value: "mips64el"
+ },
+ {
+ title: "x64",
+ value: "x64"
+ }
+ ]
+ },
+ {
+ type: "select",
+ name: "os",
+ message: "What operating system?",
+ choices: [
+ {
+ title: "current",
+ value: "current"
+ },
+ {
+ title: "all",
+ value: "all"
+ },
+ {
+ title: "darwin",
+ value: "darwin"
+ },
+ {
+ title: "linux",
+ value: "linux"
+ },
+ {
+ title: "mas",
+ value: "mas"
+ },
+ {
+ title: "win32",
+ value: "win32"
+ }
+ ]
+ },
+ {
+ name: "installer",
+ type: "confirm",
+ message: "Updater?"
+ }
+ ]);
- //#region WIP
- let installerXml = readFileSync(`installer_assets/installer.xml`, "utf-8");
+ if (!response.os) {
+ process.exit();
+ }
- installerXml = installerXml.replace(
- "{{VERSION}}",
- require("./package.json").version
- );
- installerXml = installerXml.replace(
- /(PACKAGEDNAME)/g,
- `PreMiD-${platform()}-${arch()}`
- );
+ let icon: string;
- ensureDirSync("tmp");
- writeFileSync("tmp/installer.xml", installerXml);
- //#endregion
+ if (
+ response.os == "darwin" ||
+ (response.os === "current" && platform() === "darwin")
+ )
+ icon = "./installer_assets/appIcon.icns";
+ if (["ia32", "x64"].includes(response.arch) || platform() === "win32")
+ icon = "./installer_assets/appIcon.ico";
- if (!response.os) {
- process.exit();
- return;
- }
+ if (existsSync("./dist/app/update.ini")) removeSync("./dist/app/update.ini");
+ if (existsSync("./dist/app/updater.app"))
+ removeSync("./dist/app/updater.app");
+ if (existsSync("./dist/app/updater.exe"))
+ removeSync("./dist/app/updater.exe");
- let icon: string;
+ let versionId = "0" + require("./package.json").version.replace(/[.]/g, ""),
+ updateIni = parse(readFileSync("./installer_assets/update.ini", "utf-8"));
- if (
- response.os == "darwin" ||
- (response.os === "current" && platform() === "darwin")
- )
- icon = "./installer_assets/appIcon.icns";
- if (["ia32", "x64"].includes(response.arch) || platform() === "win32")
- icon = "./installer_assets/appIcon.ico";
+ updateIni.Update.version_id = versionId;
- if (existsSync("./dist/app/update.ini")) removeSync("./dist/app/update.ini");
- if (existsSync("./dist/app/updater.app"))
- removeSync("./dist/app/updater.app");
- if (existsSync("./dist/app/updater.exe"))
- removeSync("./dist/app/updater.exe");
+ writeFileSync("./dist/app/update.ini", stringify(updateIni));
- let spinner = ora("Packaging app").start(),
- packagingOptions: electronPackager.Options = {
- dir: "./dist/app",
- out: "./dist",
- darwinDarkModeSupport: true,
- icon: icon,
- overwrite: true,
- quiet: true,
- appBundleId: "eu.Timeraa.PreMiD",
- appCategoryType: "Utilities",
- appCopyright: `Timeraa 2018-${new Date().getFullYear()}`,
- prune: true,
- // @ts-ignore
- arch: response.arch,
- // @ts-ignore
- platform: response.os
- };
+ let spinner = ora("Packaging app").start(),
+ packagingOptions: electronPackager.Options = {
+ dir: "./dist/app",
+ out: "./dist",
+ darwinDarkModeSupport: true,
+ icon: icon,
+ overwrite: true,
+ quiet: true,
+ appBundleId: "eu.Timeraa.PreMiD",
+ appCategoryType: "Utilities",
+ appCopyright: `Timeraa 2018-${new Date().getFullYear()}`,
+ prune: true,
+ // @ts-ignore
+ arch: response.arch,
+ // @ts-ignore
+ platform: response.os
+ };
- if (response.arch === "current") delete packagingOptions.arch;
- if (response.os === "current") delete packagingOptions.platform;
+ if (response.arch === "current") delete packagingOptions.arch;
+ if (response.os === "current") delete packagingOptions.platform;
- // @ts-ignore
- electronPackager(packagingOptions).then(() => {
- if (!response.installer) {
- spinner.text = "Done!";
- spinner.succeed();
- process.exit();
- return;
- }
+ // @ts-ignore
+ electronPackager(packagingOptions).then(() => {
+ if (!response.installer) {
+ spinner.text = "Done!";
+ spinner.succeed();
+ process.exit();
+ }
- let versionId = "0" + require("./package.json").version.replace(/[.]/g, ""),
- updateIni = parse(readFileSync("./installer_assets/update.ini", "utf-8"));
+ let bitRockUpdater = "";
- updateIni.Update.version_id = versionId;
+ if (platform() === "win32") {
+ bitRockUpdater = resolve(
+ "C:/Program Files (x86)/BitRock InstallBuilder Enterprise 19.12.0/autoupdate/bin/customize.exe"
+ );
+ }
- ensureDirSync("./tmp");
- writeFileSync("./tmp/update.ini", stringify(updateIni));
+ if (platform() === "darwin") {
+ bitRockUpdater = resolve(
+ "/Applications/Installbuilder/autoupdate/bin/customize.sh"
+ );
+ }
- let bitRockBuilder = "",
- bitRockUpdater = "";
+ if (!existsSync(bitRockUpdater)) {
+ spinner.fail("Bitrock installation not found.");
+ process.exit();
+ }
- if (platform() === "win32") {
- bitRockBuilder = resolve(
- "C:/Program Files (x86)/BitRock InstallBuilder Enterprise 19.8.0/bin/builder-cli.exe"
- );
- bitRockUpdater = resolve(
- "C:/Program Files (x86)/BitRock InstallBuilder Enterprise 19.8.0/autoupdate/bin/customize.exe"
- );
- }
+ spinner.text = "Building updater";
- if (platform() === "darwin") {
- bitRockBuilder = resolve(
- "/Applications/Installbuilder/bin/Builder.app/Contents/MacOS/installbuilder.sh"
- );
- bitRockUpdater = resolve(
- "/Applications/Installbuilder/autoupdate/bin/customize.sh"
- );
- }
+ let updater = exec(
+ `"${bitRockUpdater}" build installer_assets/updater.xml ${
+ platform() === "win32" ? "windows" : "osx"
+ }`
+ );
- if (!existsSync(bitRockBuilder) || !existsSync(bitRockUpdater)) {
- spinner.fail("Bitrock installation not found.");
- process.exit();
- return;
- }
+ updater.once("exit", (code, signal) => {
+ if (![0, 1].includes(code)) {
+ spinner.fail(`Updater failed with code ${code}: ${signal}`);
+ process.exit();
+ }
- spinner.text = "Building updater";
+ copyFileSync(
+ "./dist/app/update.ini",
+ `./dist/PreMiD-${
+ response.os === "current" ? platform() : response.os
+ }-${response.arch === "current" ? arch() : response.arch}/update.ini`
+ );
- let updater = exec(
- `"${bitRockUpdater}" build installer_assets/updater.xml ${
- platform() === "win32" ? "windows" : "osx"
- }`
- );
+ copyFileSync(
+ "./dist/app/updater.exe",
+ `./dist/PreMiD-${
+ response.os === "current" ? platform() : response.os
+ }-${response.arch === "current" ? arch() : response.arch}/updater.exe`
+ );
- 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 tmp/installer.xml ${
- platform() === "win32" ? "windows" : "osx"
- }`
- );
-
- builder.once("exit", code => {
- removeSync("./tmp");
-
- if (code !== 0) {
- spinner.fail(`Error code: ${code}`);
- process.exit();
- return;
- }
-
- spinner.text = "Done!";
- spinner.succeed();
- process.exit();
- return;
- });
- });
- });
+ spinner.succeed();
+ process.exit();
+ });
+ });
})();