Skip to content

Commit

Permalink
feat: disable universal patch added, updated builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Venipa committed Nov 5, 2024
1 parent 98a3de6 commit 52db3db
Show file tree
Hide file tree
Showing 4 changed files with 856 additions and 159 deletions.
1 change: 1 addition & 0 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ directories:
files:
- "!**/.vscode/*"
- "!**/{dist_electron,.github,screenshots}/*"
- "!{dist_electron,.github,screenshots}/*"
- "!.*/*"
- "!src/*"
- "!electron.vite.config.{js,ts,mjs,cjs}"
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"start": "electron-vite preview",
"dev": "electron-vite dev --watch",
"build": "npm run typecheck && electron-vite build",
"postinstall": "electron-builder install-app-deps",
"postinstall": "patch-package --patch-dir patches && electron-builder install-app-deps",
"release:nocheck": "cross-env NODE_ENV=production electron-vite build && electron-builder",
"release": "cross-env NODE_ENV=production npm run build && electron-builder",
"build:unpack": "npm run build && electron-builder --dir",
Expand Down Expand Up @@ -92,13 +92,14 @@
"clsx": "^2.1.1",
"cross-env": "^7.0.3",
"electron": "^33.0.2",
"electron-builder": "^24.13.3",
"electron-builder": "26.0.0-alpha.3",
"electron-devtools-installer": "^3.2.0",
"electron-vite": "^2.3.0",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.26.0",
"mini-svg-data-uri": "^1.4.4",
"node-gyp": "^10.2.0",
"patch-package": "^8.0.0",
"postcss-import": "^14.1.0",
"prettier": "^3.3.3",
"sass-embedded": "^1.80.6",
Expand Down
138 changes: 138 additions & 0 deletions patches/app-builder-lib+26.0.0-alpha.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
diff --git a/node_modules/app-builder-lib/out/codeSign/signManager.js b/node_modules/app-builder-lib/out/codeSign/signManager.js
new file mode 100644
index 0000000..09883b3
--- /dev/null
+++ b/node_modules/app-builder-lib/out/codeSign/signManager.js
@@ -0,0 +1,10 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.SignManager = void 0;
+class SignManager {
+ constructor(packager) {
+ this.packager = packager;
+ }
+}
+exports.SignManager = SignManager;
+//# sourceMappingURL=signManager.js.map
\ No newline at end of file
diff --git a/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js b/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js
index e79c555..31aee98 100644
--- a/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js
+++ b/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js
@@ -56,8 +56,15 @@ class NsisTarget extends core_1.Target {
}
nsisUtil_1.NsisTargetOptions.resolve(this.options);
}
+ buildUniversalInstaller() {
+ const buildSeparateInstallers = this.options.buildUniversalInstaller === false;
+ return !buildSeparateInstallers;
+ }
build(appOutDir, arch) {
this.archs.set(arch, appOutDir);
+ if (!this.buildUniversalInstaller()) {
+ return this.buildInstaller(new Map().set(arch, appOutDir));
+ }
return Promise.resolve();
}
get isBuildDifferentialAware() {
@@ -94,7 +101,10 @@ class NsisTarget extends core_1.Target {
return await createPackageFileInfo(archiveFile);
}
}
- get installerFilenamePattern() {
+ installerFilenamePattern(primaryArch, defaultArch) {
+ if (!this.buildUniversalInstaller()) {
+ return "${productName} " + (this.isPortable ? "" : "Setup ") + "${version}" + (primaryArch != null ? (0, builder_util_1.getArchSuffix)(primaryArch, defaultArch) : "") + ".${ext}";
+ }
// tslint:disable:no-invalid-template-strings
return "${productName} " + (this.isPortable ? "" : "Setup ") + "${version}.${ext}";
}
@@ -102,8 +112,11 @@ class NsisTarget extends core_1.Target {
return this.name === "portable";
}
async finishBuild() {
+ if (!this.buildUniversalInstaller()) {
+ return this.packageHelper.finishBuild();
+ }
try {
- const { pattern } = this.packager.artifactPatternConfig(this.options, this.installerFilenamePattern);
+ const { pattern } = this.packager.artifactPatternConfig(this.options, this.installerFilenamePattern());
const builds = new Set([this.archs]);
if (pattern.includes("${arch}") && this.archs.size > 1) {
;
@@ -119,12 +132,13 @@ class NsisTarget extends core_1.Target {
}
}
async buildInstaller(archs) {
- var _a, _b;
+ var _a, _b, _c;
const primaryArch = archs.size === 1 ? ((_a = archs.keys().next().value) !== null && _a !== void 0 ? _a : null) : null;
const packager = this.packager;
const appInfo = packager.appInfo;
const options = this.options;
- const installerFilename = packager.expandArtifactNamePattern(options, "exe", primaryArch, this.installerFilenamePattern, false, this.packager.platformSpecificBuildOptions.defaultArch);
+ const defaultArch = (_b = (0, platformPackager_1.chooseNotNull)(this.packager.platformSpecificBuildOptions.defaultArch, this.packager.config.defaultArch)) !== null && _b !== void 0 ? _b : undefined;
+ const installerFilename = packager.expandArtifactNamePattern(options, "exe", primaryArch, this.installerFilenamePattern(primaryArch, defaultArch), false, defaultArch);
const oneClick = options.oneClick !== false;
const installerPath = path.join(this.outDir, installerFilename);
const logFields = {
@@ -160,7 +174,7 @@ class NsisTarget extends core_1.Target {
BUILD_RESOURCES_DIR: packager.info.buildResourcesDir,
APP_PACKAGE_NAME: (0, targetUtil_1.getWindowsInstallationAppPackageName)(appInfo.name),
};
- if ((_b = options.customNsisBinary) === null || _b === void 0 ? void 0 : _b.debugLogging) {
+ if ((_c = options.customNsisBinary) === null || _c === void 0 ? void 0 : _c.debugLogging) {
defines.ENABLE_LOGGING_ELECTRON_BUILDER = null;
}
if (uninstallAppKey !== guid) {
@@ -279,7 +293,7 @@ class NsisTarget extends core_1.Target {
defines.UNINSTALLER_OUT_FILE = definesUninstaller.UNINSTALLER_OUT_FILE;
await this.executeMakensis(defines, commands, sharedHeader + (await this.computeFinalScript(script, true, archs)));
await Promise.all([packager.sign(installerPath), defines.UNINSTALLER_OUT_FILE == null ? Promise.resolve() : (0, fs_extra_1.unlink)(defines.UNINSTALLER_OUT_FILE)]);
- const safeArtifactName = (0, platformPackager_1.computeSafeArtifactNameIfNeeded)(installerFilename, () => this.generateGitHubInstallerName());
+ const safeArtifactName = (0, platformPackager_1.computeSafeArtifactNameIfNeeded)(installerFilename, () => this.generateGitHubInstallerName(primaryArch, defaultArch));
let updateInfo;
if (this.isWebInstaller) {
updateInfo = (0, differentialUpdateInfoBuilder_1.createNsisWebDifferentialUpdateInfo)(installerPath, packageFiles);
@@ -300,10 +314,11 @@ class NsisTarget extends core_1.Target {
isWriteUpdateInfo: !this.isPortable,
});
}
- generateGitHubInstallerName() {
+ generateGitHubInstallerName(primaryArch, defaultArch) {
const appInfo = this.packager.appInfo;
const classifier = appInfo.name.toLowerCase() === appInfo.name ? "setup-" : "Setup-";
- return `${appInfo.name}-${this.isPortable ? "" : classifier}${appInfo.version}.exe`;
+ const archSuffix = !this.buildUniversalInstaller() && primaryArch != null ? (0, builder_util_1.getArchSuffix)(primaryArch, defaultArch) : "";
+ return `${appInfo.name}-${this.isPortable ? "" : classifier}${appInfo.version}${archSuffix}.exe`;
}
get isUnicodeEnabled() {
return this.options.unicode !== false;
diff --git a/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js b/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js
index 9b75baa..b7a707d 100644
--- a/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js
+++ b/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js
@@ -1,6 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebInstallerTarget = void 0;
+const builder_util_1 = require("builder-util");
const PublishManager_1 = require("../../publish/PublishManager");
const NsisTarget_1 = require("./NsisTarget");
/** @private */
@@ -27,8 +28,13 @@ class WebInstallerTarget extends NsisTarget_1.NsisTarget {
defines.APP_PACKAGE_URL_IS_INCOMPLETE = null;
defines.APP_PACKAGE_URL = appPackageUrl;
}
- get installerFilenamePattern() {
- // tslint:disable:no-invalid-template-strings
+ buildUniversalInstaller() {
+ if (this.options.buildUniversalInstaller === false) {
+ builder_util_1.log.warn({ buildUniversalInstaller: true }, "only universal builds are supported for nsis-web installers, overriding setting");
+ }
+ return true;
+ }
+ installerFilenamePattern(_primaryArch, _defaultArch) {
return "${productName} Web Setup ${version}.${ext}";
}
generateGitHubInstallerName() {
Loading

0 comments on commit 52db3db

Please sign in to comment.