electron-builder-squirrel-windows 26.0.5 → 26.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { Arch, SquirrelWindowsOptions, Target } from "app-builder-lib";
|
|
2
|
-
import { WinPackager } from "app-builder-lib/out/winPackager";
|
|
1
|
+
import { Arch, SquirrelWindowsOptions, Target, WinPackager } from "app-builder-lib";
|
|
3
2
|
import { Options as SquirrelOptions } from "electron-winstaller";
|
|
4
3
|
export default class SquirrelWindowsTarget extends Target {
|
|
5
4
|
private readonly packager;
|
|
6
5
|
readonly outDir: string;
|
|
7
6
|
readonly options: SquirrelWindowsOptions;
|
|
8
|
-
private appDirectory;
|
|
9
|
-
private outputDirectory;
|
|
10
7
|
constructor(packager: WinPackager, outDir: string);
|
|
8
|
+
private prepareSignedVendorDirectory;
|
|
11
9
|
build(appOutDir: string, arch: Arch): Promise<void>;
|
|
12
10
|
private get appName();
|
|
13
11
|
private select7zipArch;
|
|
14
|
-
|
|
12
|
+
private createNuspecTemplateWithProjectUrl;
|
|
13
|
+
computeEffectiveDistOptions(appDirectory: string, outputDirectory: string, setupFile: string): Promise<SquirrelOptions>;
|
|
15
14
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const builder_util_1 = require("builder-util");
|
|
4
|
-
const app_builder_lib_1 = require("app-builder-lib");
|
|
5
4
|
const filename_1 = require("builder-util/out/filename");
|
|
5
|
+
const app_builder_lib_1 = require("app-builder-lib");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const fs = require("fs");
|
|
8
|
-
const
|
|
8
|
+
const os = require("os");
|
|
9
9
|
const electron_winstaller_1 = require("electron-winstaller");
|
|
10
10
|
class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
11
11
|
constructor(packager, outDir) {
|
|
@@ -14,8 +14,28 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
14
14
|
this.outDir = outDir;
|
|
15
15
|
//tslint:disable-next-line:no-object-literal-type-assertion
|
|
16
16
|
this.options = { ...this.packager.platformSpecificBuildOptions, ...this.packager.config.squirrelWindows };
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
}
|
|
18
|
+
async prepareSignedVendorDirectory() {
|
|
19
|
+
// If not specified will use the Squirrel.Windows that is shipped with electron-installer(https://github.com/electron/windows-installer/tree/main/vendor)
|
|
20
|
+
// After https://github.com/electron-userland/electron-builder-binaries/pull/56 merged, will add `electron-builder-binaries` to get the latest version of squirrel.
|
|
21
|
+
let vendorDirectory = this.options.customSquirrelVendorDir || path.join(require.resolve("electron-winstaller/package.json"), "..", "vendor");
|
|
22
|
+
if ((0, builder_util_1.isEmptyOrSpaces)(vendorDirectory) || !fs.existsSync(vendorDirectory)) {
|
|
23
|
+
builder_util_1.log.warn({ vendorDirectory }, "unable to access Squirrel.Windows vendor directory, falling back to default electron-winstaller");
|
|
24
|
+
vendorDirectory = path.join(require.resolve("electron-winstaller/package.json"), "..", "vendor");
|
|
25
|
+
}
|
|
26
|
+
const tmpVendorDirectory = await this.packager.info.tempDirManager.createTempDir({ prefix: "squirrel-windows-vendor" });
|
|
27
|
+
// Copy entire vendor directory to temp directory
|
|
28
|
+
await fs.promises.cp(vendorDirectory, tmpVendorDirectory, { recursive: true });
|
|
29
|
+
builder_util_1.log.debug({ from: vendorDirectory, to: tmpVendorDirectory }, "copied vendor directory");
|
|
30
|
+
const files = await fs.promises.readdir(tmpVendorDirectory);
|
|
31
|
+
for (const file of files) {
|
|
32
|
+
if (["Squirrel.exe", "StubExecutable.exe"].includes(file)) {
|
|
33
|
+
const filePath = path.join(tmpVendorDirectory, file);
|
|
34
|
+
builder_util_1.log.debug({ file: filePath }, "signing vendor executable");
|
|
35
|
+
await this.packager.sign(filePath);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return tmpVendorDirectory;
|
|
19
39
|
}
|
|
20
40
|
async build(appOutDir, arch) {
|
|
21
41
|
const packager = this.packager;
|
|
@@ -24,28 +44,35 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
24
44
|
const setupFile = packager.expandArtifactNamePattern(this.options, "exe", arch, "${productName} Setup ${version}.${ext}");
|
|
25
45
|
const installerOutDir = path.join(this.outDir, `squirrel-windows${(0, app_builder_lib_1.getArchSuffix)(arch)}`);
|
|
26
46
|
const artifactPath = path.join(installerOutDir, setupFile);
|
|
47
|
+
const msiArtifactPath = path.join(installerOutDir, packager.expandArtifactNamePattern(this.options, "msi", arch, "${productName} Setup ${version}.${ext}"));
|
|
27
48
|
await packager.info.callArtifactBuildStarted({
|
|
28
49
|
targetPresentableName: "Squirrel.Windows",
|
|
29
50
|
file: artifactPath,
|
|
30
51
|
arch,
|
|
31
52
|
});
|
|
32
|
-
|
|
33
|
-
builder_util_1.log.warn("For windows consider only distributing 64-bit or use nsis target, see https://github.com/electron-userland/electron-builder/issues/359#issuecomment-214851130");
|
|
34
|
-
}
|
|
35
|
-
this.appDirectory = appOutDir;
|
|
36
|
-
this.outputDirectory = installerOutDir;
|
|
37
|
-
const distOptions = await this.computeEffectiveDistOptions();
|
|
38
|
-
if (distOptions.vendorDirectory) {
|
|
39
|
-
this.select7zipArch(distOptions.vendorDirectory, arch);
|
|
40
|
-
}
|
|
53
|
+
const distOptions = await this.computeEffectiveDistOptions(appOutDir, installerOutDir, setupFile);
|
|
41
54
|
await (0, electron_winstaller_1.createWindowsInstaller)(distOptions);
|
|
55
|
+
await packager.signAndEditResources(artifactPath, arch, installerOutDir);
|
|
56
|
+
if (this.options.msi) {
|
|
57
|
+
await packager.sign(msiArtifactPath);
|
|
58
|
+
}
|
|
59
|
+
const safeArtifactName = (ext) => `${sanitizedName}-Setup-${version}${(0, app_builder_lib_1.getArchSuffix)(arch)}.${ext}`;
|
|
42
60
|
await packager.info.callArtifactBuildCompleted({
|
|
43
61
|
file: artifactPath,
|
|
44
62
|
target: this,
|
|
45
63
|
arch,
|
|
46
|
-
safeArtifactName:
|
|
64
|
+
safeArtifactName: safeArtifactName("exe"),
|
|
47
65
|
packager: this.packager,
|
|
48
66
|
});
|
|
67
|
+
if (this.options.msi) {
|
|
68
|
+
await packager.info.callArtifactBuildCompleted({
|
|
69
|
+
file: msiArtifactPath,
|
|
70
|
+
target: this,
|
|
71
|
+
arch,
|
|
72
|
+
safeArtifactName: safeArtifactName("msi"),
|
|
73
|
+
packager: this.packager,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
49
76
|
const packagePrefix = `${this.appName}-${(0, electron_winstaller_1.convertVersion)(version)}-`;
|
|
50
77
|
packager.info.dispatchArtifactCreated({
|
|
51
78
|
file: path.join(installerOutDir, `${packagePrefix}full.nupkg`),
|
|
@@ -71,13 +98,28 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
71
98
|
get appName() {
|
|
72
99
|
return this.options.name || this.packager.appInfo.name;
|
|
73
100
|
}
|
|
74
|
-
select7zipArch(vendorDirectory
|
|
75
|
-
//
|
|
76
|
-
|
|
101
|
+
select7zipArch(vendorDirectory) {
|
|
102
|
+
// https://github.com/electron/windows-installer/blob/main/script/select-7z-arch.js
|
|
103
|
+
// Even if we're cross-compiling for a different arch like arm64,
|
|
104
|
+
// we still need to use the 7-Zip executable for the host arch
|
|
105
|
+
const resolvedArch = os.arch;
|
|
77
106
|
fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.exe`), path.join(vendorDirectory, "7z.exe"));
|
|
78
107
|
fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.dll`), path.join(vendorDirectory, "7z.dll"));
|
|
79
108
|
}
|
|
80
|
-
async
|
|
109
|
+
async createNuspecTemplateWithProjectUrl() {
|
|
110
|
+
const templatePath = path.resolve(__dirname, "..", "template.nuspectemplate");
|
|
111
|
+
const projectUrl = await this.packager.appInfo.computePackageUrl();
|
|
112
|
+
if (projectUrl != null) {
|
|
113
|
+
const nuspecTemplate = await this.packager.info.tempDirManager.getTempFile({ prefix: "template", suffix: ".nuspectemplate" });
|
|
114
|
+
let templateContent = await fs.promises.readFile(templatePath, "utf8");
|
|
115
|
+
const searchString = "<copyright><%- copyright %></copyright>";
|
|
116
|
+
templateContent = templateContent.replace(searchString, `${searchString}\n <projectUrl>${projectUrl}</projectUrl>`);
|
|
117
|
+
await fs.promises.writeFile(nuspecTemplate, templateContent);
|
|
118
|
+
return nuspecTemplate;
|
|
119
|
+
}
|
|
120
|
+
return templatePath;
|
|
121
|
+
}
|
|
122
|
+
async computeEffectiveDistOptions(appDirectory, outputDirectory, setupFile) {
|
|
81
123
|
const packager = this.packager;
|
|
82
124
|
let iconUrl = this.options.iconUrl;
|
|
83
125
|
if (iconUrl == null) {
|
|
@@ -91,42 +133,27 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
|
|
|
91
133
|
}
|
|
92
134
|
checkConflictingOptions(this.options);
|
|
93
135
|
const appInfo = packager.appInfo;
|
|
94
|
-
// If not specified will use the Squirrel.Windows that is shipped with electron-installer(https://github.com/electron/windows-installer/tree/main/vendor)
|
|
95
|
-
// After https://github.com/electron-userland/electron-builder-binaries/pull/56 merged, will add `electron-builder-binaries` to get the latest version of squirrel.
|
|
96
|
-
let vendorDirectory = this.options.customSquirrelVendorDir;
|
|
97
|
-
if ((0, builder_util_1.isEmptyOrSpaces)(vendorDirectory) || !fs.existsSync(vendorDirectory)) {
|
|
98
|
-
builder_util_1.log.warn({ vendorDirectory }, "unable to access Squirrel.Windows vendor directory, falling back to default electron-winstaller");
|
|
99
|
-
vendorDirectory = undefined;
|
|
100
|
-
}
|
|
101
136
|
const options = {
|
|
102
|
-
appDirectory:
|
|
103
|
-
outputDirectory:
|
|
137
|
+
appDirectory: appDirectory,
|
|
138
|
+
outputDirectory: outputDirectory,
|
|
104
139
|
name: this.options.useAppIdAsId ? appInfo.id : this.appName,
|
|
140
|
+
title: appInfo.productName || appInfo.name,
|
|
105
141
|
version: appInfo.version,
|
|
106
142
|
description: appInfo.description,
|
|
107
|
-
exe: `${
|
|
143
|
+
exe: `${appInfo.productFilename || this.options.name || appInfo.productName}.exe`,
|
|
108
144
|
authors: appInfo.companyName || "",
|
|
145
|
+
nuspecTemplate: await this.createNuspecTemplateWithProjectUrl(),
|
|
109
146
|
iconUrl,
|
|
110
147
|
copyright: appInfo.copyright,
|
|
111
|
-
vendorDirectory,
|
|
112
|
-
nuspecTemplate: path.join(__dirname, "..", "template.nuspectemplate"),
|
|
113
148
|
noMsi: !this.options.msi,
|
|
149
|
+
usePackageJson: false,
|
|
114
150
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
await (0, promises_1.writeFile)(nuspecTemplate, templateContent);
|
|
122
|
-
options.nuspecTemplate = nuspecTemplate;
|
|
123
|
-
}
|
|
124
|
-
if (await (await packager.signingManager.value).cscInfo.value) {
|
|
125
|
-
options.windowsSign = {
|
|
126
|
-
hookFunction: async (file) => {
|
|
127
|
-
await packager.sign(file);
|
|
128
|
-
},
|
|
129
|
-
};
|
|
151
|
+
options.vendorDirectory = await this.prepareSignedVendorDirectory();
|
|
152
|
+
this.select7zipArch(options.vendorDirectory);
|
|
153
|
+
options.fixUpPaths = true;
|
|
154
|
+
options.setupExe = setupFile;
|
|
155
|
+
if (this.options.msi) {
|
|
156
|
+
options.setupMsi = setupFile.replace(".exe", ".msi");
|
|
130
157
|
}
|
|
131
158
|
if ((0, builder_util_1.isEmptyOrSpaces)(options.description)) {
|
|
132
159
|
options.description = this.options.name || appInfo.productName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SquirrelWindowsTarget.js","sourceRoot":"","sources":["../src/SquirrelWindowsTarget.ts"],"names":[],"mappings":";;AAAA,+CAA8E;AAC9E,qDAAqF;AAErF,wDAA4D;AAC5D,6BAA4B;AAC5B,yBAAwB;AACxB,0CAAiD;AAC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;QACpK,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,wCAAyB,CAAC,UAAU,IAAI,iCAAiC,CAAC,CAAA;QACtF,CAAC;IACH,CAAC;IAED,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;QACvB,kBAAG,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAA;QACrG,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,CAAA;IAC9B,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,SAAS,EAAE,CAAC;QAC5C,MAAM,IAAI,wCAAyB,CAAC,kDAAkD,GAAG,kBAAkB,CAAC,CAAA;IAC9G,CAAC;AACH,CAAC","sourcesContent":["import { InvalidConfigurationError, log, isEmptyOrSpaces } from \"builder-util\"\nimport { Arch, getArchSuffix, SquirrelWindowsOptions, Target } from \"app-builder-lib\"\nimport { WinPackager } from \"app-builder-lib/out/winPackager\"\nimport { sanitizeFileName } from \"builder-util/out/filename\"\nimport * as path from \"path\"\nimport * as fs from \"fs\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Options as SquirrelOptions, createWindowsInstaller, convertVersion } from \"electron-winstaller\"\n\nexport default class SquirrelWindowsTarget extends Target {\n //tslint:disable-next-line:no-object-literal-type-assertion\n readonly options: SquirrelWindowsOptions = { ...this.packager.platformSpecificBuildOptions, ...this.packager.config.squirrelWindows } as SquirrelWindowsOptions\n private appDirectory: string = \"\"\n private outputDirectory: string = \"\"\n\n constructor(\n private readonly packager: WinPackager,\n readonly outDir: string\n ) {\n super(\"squirrel\")\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const version = packager.appInfo.version\n const sanitizedName = sanitizeFileName(this.appName)\n\n const setupFile = packager.expandArtifactNamePattern(this.options, \"exe\", arch, \"${productName} Setup ${version}.${ext}\")\n const installerOutDir = path.join(this.outDir, `squirrel-windows${getArchSuffix(arch)}`)\n const artifactPath = path.join(installerOutDir, setupFile)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"Squirrel.Windows\",\n file: artifactPath,\n arch,\n })\n\n if (arch === Arch.ia32) {\n log.warn(\"For windows consider only distributing 64-bit or use nsis target, see https://github.com/electron-userland/electron-builder/issues/359#issuecomment-214851130\")\n }\n\n this.appDirectory = appOutDir\n this.outputDirectory = installerOutDir\n const distOptions = await this.computeEffectiveDistOptions()\n if (distOptions.vendorDirectory) {\n this.select7zipArch(distOptions.vendorDirectory, arch)\n }\n\n await createWindowsInstaller(distOptions)\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n target: this,\n arch,\n safeArtifactName: `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.exe`,\n packager: this.packager,\n })\n\n const packagePrefix = `${this.appName}-${convertVersion(version)}-`\n packager.info.dispatchArtifactCreated({\n file: path.join(installerOutDir, `${packagePrefix}full.nupkg`),\n target: this,\n arch,\n packager,\n })\n if (distOptions.remoteReleases != null) {\n packager.info.dispatchArtifactCreated({\n file: path.join(installerOutDir, `${packagePrefix}delta.nupkg`),\n target: this,\n arch,\n packager,\n })\n }\n\n packager.info.dispatchArtifactCreated({\n file: path.join(installerOutDir, \"RELEASES\"),\n target: this,\n arch,\n packager,\n })\n }\n\n private get appName() {\n return this.options.name || this.packager.appInfo.name\n }\n\n private select7zipArch(vendorDirectory: string, arch: Arch) {\n // Copy the 7-Zip executable for the configured architecture.\n const resolvedArch = getArchSuffix(arch) === \"\" ? process.arch : getArchSuffix(arch)\n fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.exe`), path.join(vendorDirectory, \"7z.exe\"))\n fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.dll`), path.join(vendorDirectory, \"7z.dll\"))\n }\n\n async computeEffectiveDistOptions(): Promise<SquirrelOptions> {\n const packager = this.packager\n let iconUrl = this.options.iconUrl\n if (iconUrl == null) {\n const info = await packager.info.repositoryInfo\n if (info != null) {\n iconUrl = `https://github.com/${info.user}/${info.project}/blob/master/${packager.info.relativeBuildResourcesDirname}/icon.ico?raw=true`\n }\n\n if (iconUrl == null) {\n throw new InvalidConfigurationError(\"squirrelWindows.iconUrl is not specified, please see https://www.electron.build/squirrel-windows#SquirrelWindowsOptions-iconUrl\")\n }\n }\n\n checkConflictingOptions(this.options)\n\n const appInfo = packager.appInfo\n // If not specified will use the Squirrel.Windows that is shipped with electron-installer(https://github.com/electron/windows-installer/tree/main/vendor)\n // After https://github.com/electron-userland/electron-builder-binaries/pull/56 merged, will add `electron-builder-binaries` to get the latest version of squirrel.\n let vendorDirectory = this.options.customSquirrelVendorDir\n if (isEmptyOrSpaces(vendorDirectory) || !fs.existsSync(vendorDirectory)) {\n log.warn({ vendorDirectory }, \"unable to access Squirrel.Windows vendor directory, falling back to default electron-winstaller\")\n vendorDirectory = undefined\n }\n\n const options: SquirrelOptions = {\n appDirectory: this.appDirectory,\n outputDirectory: this.outputDirectory,\n name: this.options.useAppIdAsId ? appInfo.id : this.appName,\n version: appInfo.version,\n description: appInfo.description,\n exe: `${this.packager.platformSpecificBuildOptions.executableName || this.options.name || appInfo.productName}.exe`,\n authors: appInfo.companyName || \"\",\n iconUrl,\n copyright: appInfo.copyright,\n vendorDirectory,\n nuspecTemplate: path.join(__dirname, \"..\", \"template.nuspectemplate\"),\n noMsi: !this.options.msi,\n }\n\n const projectUrl = await appInfo.computePackageUrl()\n if (projectUrl != null) {\n const nuspecTemplate = await this.packager.info.tempDirManager.getTempFile({ prefix: \"template\", suffix: \".nuspectemplate\" })\n let templateContent = await readFile(path.resolve(__dirname, \"..\", \"template.nuspectemplate\"), \"utf8\")\n const searchString = \"<copyright><%- copyright %></copyright>\"\n templateContent = templateContent.replace(searchString, `${searchString}\\n <projectUrl>${projectUrl}</projectUrl>`)\n await writeFile(nuspecTemplate, templateContent)\n options.nuspecTemplate = nuspecTemplate\n }\n\n if (await (await packager.signingManager.value).cscInfo.value) {\n options.windowsSign = {\n hookFunction: async (file: string) => {\n await packager.sign(file)\n },\n }\n }\n\n if (isEmptyOrSpaces(options.description)) {\n options.description = this.options.name || appInfo.productName\n }\n\n if (options.remoteToken == null) {\n options.remoteToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN\n }\n\n if (this.options.remoteReleases === true) {\n const info = await packager.info.repositoryInfo\n if (info == null) {\n log.warn(\"remoteReleases set to true, but cannot get repository info\")\n } else {\n options.remoteReleases = `https://github.com/${info.user}/${info.project}`\n log.info({ remoteReleases: options.remoteReleases }, `remoteReleases is set`)\n }\n } else if (typeof this.options.remoteReleases === \"string\" && !isEmptyOrSpaces(this.options.remoteReleases)) {\n options.remoteReleases = this.options.remoteReleases\n }\n\n if (!(\"loadingGif\" in options)) {\n const resourceList = await packager.resourceList\n if (resourceList.includes(\"install-spinner.gif\")) {\n options.loadingGif = path.join(packager.buildResourcesDir, \"install-spinner.gif\")\n }\n }\n\n return options\n }\n}\n\nfunction checkConflictingOptions(options: any) {\n for (const name of [\"outputDirectory\", \"appDirectory\", \"exe\", \"fixUpPaths\", \"usePackageJson\", \"extraFileSpecs\", \"extraMetadataSpecs\", \"skipUpdateIcon\", \"setupExe\"]) {\n if (name in options) {\n throw new InvalidConfigurationError(`Option ${name} is ignored, do not specify it.`)\n }\n }\n\n if (\"noMsi\" in options) {\n log.warn(`noMsi is deprecated, please specify as \"msi\": true if you want to create an MSI installer`)\n options.msi = !options.noMsi\n }\n\n const msi = options.msi\n if (msi != null && typeof msi !== \"boolean\") {\n throw new InvalidConfigurationError(`msi expected to be boolean value, but string '\"${msi}\"' was specified`)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SquirrelWindowsTarget.js","sourceRoot":"","sources":["../src/SquirrelWindowsTarget.ts"],"names":[],"mappings":";;AAAA,+CAA8E;AAC9E,wDAA4D;AAC5D,qDAAkG;AAClG,6BAA4B;AAC5B,yBAAwB;AACxB,yBAAwB;AACxB,6DAAwG;AAExG,MAA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CAAA;YAChD,IAAI,YAAY,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAAC;gBACjD,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAA;YACnF,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAzMD,wCAyMC;AAED,SAAS,uBAAuB,CAAC,OAAY;IAC3C,KAAK,MAAM,IAAI,IAAI,CAAC,iBAAiB,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,UAAU,CAAC,EAAE,CAAC;QACpK,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,wCAAyB,CAAC,UAAU,IAAI,iCAAiC,CAAC,CAAA;QACtF,CAAC;IACH,CAAC;IAED,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;QACvB,kBAAG,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAA;QACrG,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,CAAA;IAC9B,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,SAAS,EAAE,CAAC;QAC5C,MAAM,IAAI,wCAAyB,CAAC,kDAAkD,GAAG,kBAAkB,CAAC,CAAA;IAC9G,CAAC;AACH,CAAC","sourcesContent":["import { InvalidConfigurationError, log, isEmptyOrSpaces } from \"builder-util\"\nimport { sanitizeFileName } from \"builder-util/out/filename\"\nimport { Arch, getArchSuffix, SquirrelWindowsOptions, Target, WinPackager } from \"app-builder-lib\"\nimport * as path from \"path\"\nimport * as fs from \"fs\"\nimport * as os from \"os\"\nimport { Options as SquirrelOptions, createWindowsInstaller, convertVersion } from \"electron-winstaller\"\n\nexport default class SquirrelWindowsTarget extends Target {\n //tslint:disable-next-line:no-object-literal-type-assertion\n readonly options: SquirrelWindowsOptions = { ...this.packager.platformSpecificBuildOptions, ...this.packager.config.squirrelWindows } as SquirrelWindowsOptions\n\n constructor(\n private readonly packager: WinPackager,\n readonly outDir: string\n ) {\n super(\"squirrel\")\n }\n\n private async prepareSignedVendorDirectory(): Promise<string> {\n // If not specified will use the Squirrel.Windows that is shipped with electron-installer(https://github.com/electron/windows-installer/tree/main/vendor)\n // After https://github.com/electron-userland/electron-builder-binaries/pull/56 merged, will add `electron-builder-binaries` to get the latest version of squirrel.\n let vendorDirectory = this.options.customSquirrelVendorDir || path.join(require.resolve(\"electron-winstaller/package.json\"), \"..\", \"vendor\")\n if (isEmptyOrSpaces(vendorDirectory) || !fs.existsSync(vendorDirectory)) {\n log.warn({ vendorDirectory }, \"unable to access Squirrel.Windows vendor directory, falling back to default electron-winstaller\")\n vendorDirectory = path.join(require.resolve(\"electron-winstaller/package.json\"), \"..\", \"vendor\")\n }\n\n const tmpVendorDirectory = await this.packager.info.tempDirManager.createTempDir({ prefix: \"squirrel-windows-vendor\" })\n // Copy entire vendor directory to temp directory\n await fs.promises.cp(vendorDirectory, tmpVendorDirectory, { recursive: true })\n log.debug({ from: vendorDirectory, to: tmpVendorDirectory }, \"copied vendor directory\")\n\n const files = await fs.promises.readdir(tmpVendorDirectory)\n for (const file of files) {\n if ([\"Squirrel.exe\", \"StubExecutable.exe\"].includes(file)) {\n const filePath = path.join(tmpVendorDirectory, file)\n log.debug({ file: filePath }, \"signing vendor executable\")\n await this.packager.sign(filePath)\n }\n }\n\n return tmpVendorDirectory\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const version = packager.appInfo.version\n const sanitizedName = sanitizeFileName(this.appName)\n\n const setupFile = packager.expandArtifactNamePattern(this.options, \"exe\", arch, \"${productName} Setup ${version}.${ext}\")\n const installerOutDir = path.join(this.outDir, `squirrel-windows${getArchSuffix(arch)}`)\n const artifactPath = path.join(installerOutDir, setupFile)\n const msiArtifactPath = path.join(installerOutDir, packager.expandArtifactNamePattern(this.options, \"msi\", arch, \"${productName} Setup ${version}.${ext}\"))\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"Squirrel.Windows\",\n file: artifactPath,\n arch,\n })\n\n const distOptions = await this.computeEffectiveDistOptions(appOutDir, installerOutDir, setupFile)\n await createWindowsInstaller(distOptions)\n\n await packager.signAndEditResources(artifactPath, arch, installerOutDir)\n if (this.options.msi) {\n await packager.sign(msiArtifactPath)\n }\n\n const safeArtifactName = (ext: string) => `${sanitizedName}-Setup-${version}${getArchSuffix(arch)}.${ext}`\n\n await packager.info.callArtifactBuildCompleted({\n file: artifactPath,\n target: this,\n arch,\n safeArtifactName: safeArtifactName(\"exe\"),\n packager: this.packager,\n })\n\n if (this.options.msi) {\n await packager.info.callArtifactBuildCompleted({\n file: msiArtifactPath,\n target: this,\n arch,\n safeArtifactName: safeArtifactName(\"msi\"),\n packager: this.packager,\n })\n }\n\n const packagePrefix = `${this.appName}-${convertVersion(version)}-`\n packager.info.dispatchArtifactCreated({\n file: path.join(installerOutDir, `${packagePrefix}full.nupkg`),\n target: this,\n arch,\n packager,\n })\n if (distOptions.remoteReleases != null) {\n packager.info.dispatchArtifactCreated({\n file: path.join(installerOutDir, `${packagePrefix}delta.nupkg`),\n target: this,\n arch,\n packager,\n })\n }\n\n packager.info.dispatchArtifactCreated({\n file: path.join(installerOutDir, \"RELEASES\"),\n target: this,\n arch,\n packager,\n })\n }\n\n private get appName() {\n return this.options.name || this.packager.appInfo.name\n }\n\n private select7zipArch(vendorDirectory: string) {\n // https://github.com/electron/windows-installer/blob/main/script/select-7z-arch.js\n // Even if we're cross-compiling for a different arch like arm64,\n // we still need to use the 7-Zip executable for the host arch\n const resolvedArch = os.arch\n fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.exe`), path.join(vendorDirectory, \"7z.exe\"))\n fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.dll`), path.join(vendorDirectory, \"7z.dll\"))\n }\n\n private async createNuspecTemplateWithProjectUrl() {\n const templatePath = path.resolve(__dirname, \"..\", \"template.nuspectemplate\")\n const projectUrl = await this.packager.appInfo.computePackageUrl()\n if (projectUrl != null) {\n const nuspecTemplate = await this.packager.info.tempDirManager.getTempFile({ prefix: \"template\", suffix: \".nuspectemplate\" })\n let templateContent = await fs.promises.readFile(templatePath, \"utf8\")\n const searchString = \"<copyright><%- copyright %></copyright>\"\n templateContent = templateContent.replace(searchString, `${searchString}\\n <projectUrl>${projectUrl}</projectUrl>`)\n await fs.promises.writeFile(nuspecTemplate, templateContent)\n return nuspecTemplate\n }\n return templatePath\n }\n\n async computeEffectiveDistOptions(appDirectory: string, outputDirectory: string, setupFile: string): Promise<SquirrelOptions> {\n const packager = this.packager\n let iconUrl = this.options.iconUrl\n if (iconUrl == null) {\n const info = await packager.info.repositoryInfo\n if (info != null) {\n iconUrl = `https://github.com/${info.user}/${info.project}/blob/master/${packager.info.relativeBuildResourcesDirname}/icon.ico?raw=true`\n }\n\n if (iconUrl == null) {\n throw new InvalidConfigurationError(\"squirrelWindows.iconUrl is not specified, please see https://www.electron.build/squirrel-windows#SquirrelWindowsOptions-iconUrl\")\n }\n }\n\n checkConflictingOptions(this.options)\n const appInfo = packager.appInfo\n const options: SquirrelOptions = {\n appDirectory: appDirectory,\n outputDirectory: outputDirectory,\n name: this.options.useAppIdAsId ? appInfo.id : this.appName,\n title: appInfo.productName || appInfo.name,\n version: appInfo.version,\n description: appInfo.description,\n exe: `${appInfo.productFilename || this.options.name || appInfo.productName}.exe`,\n authors: appInfo.companyName || \"\",\n nuspecTemplate: await this.createNuspecTemplateWithProjectUrl(),\n iconUrl,\n copyright: appInfo.copyright,\n noMsi: !this.options.msi,\n usePackageJson: false,\n }\n\n options.vendorDirectory = await this.prepareSignedVendorDirectory()\n this.select7zipArch(options.vendorDirectory)\n options.fixUpPaths = true\n options.setupExe = setupFile\n if (this.options.msi) {\n options.setupMsi = setupFile.replace(\".exe\", \".msi\")\n }\n\n if (isEmptyOrSpaces(options.description)) {\n options.description = this.options.name || appInfo.productName\n }\n\n if (options.remoteToken == null) {\n options.remoteToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN\n }\n\n if (this.options.remoteReleases === true) {\n const info = await packager.info.repositoryInfo\n if (info == null) {\n log.warn(\"remoteReleases set to true, but cannot get repository info\")\n } else {\n options.remoteReleases = `https://github.com/${info.user}/${info.project}`\n log.info({ remoteReleases: options.remoteReleases }, `remoteReleases is set`)\n }\n } else if (typeof this.options.remoteReleases === \"string\" && !isEmptyOrSpaces(this.options.remoteReleases)) {\n options.remoteReleases = this.options.remoteReleases\n }\n\n if (!(\"loadingGif\" in options)) {\n const resourceList = await packager.resourceList\n if (resourceList.includes(\"install-spinner.gif\")) {\n options.loadingGif = path.join(packager.buildResourcesDir, \"install-spinner.gif\")\n }\n }\n\n return options\n }\n}\n\nfunction checkConflictingOptions(options: any) {\n for (const name of [\"outputDirectory\", \"appDirectory\", \"exe\", \"fixUpPaths\", \"usePackageJson\", \"extraFileSpecs\", \"extraMetadataSpecs\", \"skipUpdateIcon\", \"setupExe\"]) {\n if (name in options) {\n throw new InvalidConfigurationError(`Option ${name} is ignored, do not specify it.`)\n }\n }\n\n if (\"noMsi\" in options) {\n log.warn(`noMsi is deprecated, please specify as \"msi\": true if you want to create an MSI installer`)\n options.msi = !options.noMsi\n }\n\n const msi = options.msi\n if (msi != null && typeof msi !== \"boolean\") {\n throw new InvalidConfigurationError(`msi expected to be boolean value, but string '\"${msi}\"' was specified`)\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-builder-squirrel-windows",
|
|
3
|
-
"version": "26.0.
|
|
3
|
+
"version": "26.0.7",
|
|
4
4
|
"main": "out/SquirrelWindowsTarget.js",
|
|
5
5
|
"author": "Vladimir Krivosheev",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"electron-winstaller": "5.4.0",
|
|
20
|
-
"app-builder-lib": "26.0.
|
|
21
|
-
"builder-util": "26.0.
|
|
20
|
+
"app-builder-lib": "26.0.7",
|
|
21
|
+
"builder-util": "26.0.7"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/archiver": "5.3.1",
|