electron-builder-squirrel-windows 26.0.2 → 26.0.4

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,12 +1,15 @@
1
1
  import { Arch, SquirrelWindowsOptions, Target } from "app-builder-lib";
2
2
  import { WinPackager } from "app-builder-lib/out/winPackager";
3
- import { SquirrelOptions } from "./squirrelPack";
3
+ import { Options as SquirrelOptions } from "electron-winstaller";
4
4
  export default class SquirrelWindowsTarget extends Target {
5
5
  private readonly packager;
6
6
  readonly outDir: string;
7
7
  readonly options: SquirrelWindowsOptions;
8
+ private appDirectory;
9
+ private outputDirectory;
8
10
  constructor(packager: WinPackager, outDir: string);
9
11
  build(appOutDir: string, arch: Arch): Promise<void>;
10
12
  private get appName();
13
+ private select7zipArch;
11
14
  computeEffectiveDistOptions(): Promise<SquirrelOptions>;
12
15
  }
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const app_builder_lib_1 = require("app-builder-lib");
4
- const binDownload_1 = require("app-builder-lib/out/binDownload");
5
3
  const builder_util_1 = require("builder-util");
4
+ const app_builder_lib_1 = require("app-builder-lib");
6
5
  const filename_1 = require("builder-util/out/filename");
7
6
  const path = require("path");
8
- const squirrelPack_1 = require("./squirrelPack");
7
+ const fs = require("fs");
8
+ const promises_1 = require("fs/promises");
9
+ const electron_winstaller_1 = require("electron-winstaller");
9
10
  class SquirrelWindowsTarget extends app_builder_lib_1.Target {
10
11
  constructor(packager, outDir) {
11
12
  super("squirrel");
@@ -13,14 +14,14 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
13
14
  this.outDir = outDir;
14
15
  //tslint:disable-next-line:no-object-literal-type-assertion
15
16
  this.options = { ...this.packager.platformSpecificBuildOptions, ...this.packager.config.squirrelWindows };
17
+ this.appDirectory = "";
18
+ this.outputDirectory = "";
16
19
  }
17
20
  async build(appOutDir, arch) {
18
21
  const packager = this.packager;
19
22
  const version = packager.appInfo.version;
20
23
  const sanitizedName = (0, filename_1.sanitizeFileName)(this.appName);
21
- // tslint:disable-next-line:no-invalid-template-strings
22
24
  const setupFile = packager.expandArtifactNamePattern(this.options, "exe", arch, "${productName} Setup ${version}.${ext}");
23
- const packageFile = `${sanitizedName}-${(0, squirrelPack_1.convertVersion)(version)}-full.nupkg`;
24
25
  const installerOutDir = path.join(this.outDir, `squirrel-windows${(0, app_builder_lib_1.getArchSuffix)(arch)}`);
25
26
  const artifactPath = path.join(installerOutDir, setupFile);
26
27
  await packager.info.callArtifactBuildStarted({
@@ -31,9 +32,13 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
31
32
  if (arch === app_builder_lib_1.Arch.ia32) {
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");
33
34
  }
35
+ this.appDirectory = appOutDir;
36
+ this.outputDirectory = installerOutDir;
34
37
  const distOptions = await this.computeEffectiveDistOptions();
35
- const squirrelBuilder = new squirrelPack_1.SquirrelBuilder(distOptions, installerOutDir, packager);
36
- await squirrelBuilder.buildInstaller({ setupFile, packageFile }, appOutDir, this.outDir, arch);
38
+ if (distOptions.vendorDirectory) {
39
+ this.select7zipArch(distOptions.vendorDirectory, arch);
40
+ }
41
+ await (0, electron_winstaller_1.createWindowsInstaller)(distOptions);
37
42
  await packager.info.callArtifactBuildCompleted({
38
43
  file: artifactPath,
39
44
  target: this,
@@ -41,7 +46,7 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
41
46
  safeArtifactName: `${sanitizedName}-Setup-${version}${(0, app_builder_lib_1.getArchSuffix)(arch)}.exe`,
42
47
  packager: this.packager,
43
48
  });
44
- const packagePrefix = `${this.appName}-${(0, squirrelPack_1.convertVersion)(version)}-`;
49
+ const packagePrefix = `${this.appName}-${(0, electron_winstaller_1.convertVersion)(version)}-`;
45
50
  packager.info.dispatchArtifactCreated({
46
51
  file: path.join(installerOutDir, `${packagePrefix}full.nupkg`),
47
52
  target: this,
@@ -66,6 +71,12 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
66
71
  get appName() {
67
72
  return this.options.name || this.packager.appInfo.name;
68
73
  }
74
+ select7zipArch(vendorDirectory, arch) {
75
+ // Copy the 7-Zip executable for the configured architecture.
76
+ const resolvedArch = (0, app_builder_lib_1.getArchSuffix)(arch) === "" ? process.arch : (0, app_builder_lib_1.getArchSuffix)(arch);
77
+ fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.exe`), path.join(vendorDirectory, "7z.exe"));
78
+ fs.copyFileSync(path.join(vendorDirectory, `7z-${resolvedArch}.dll`), path.join(vendorDirectory, "7z.dll"));
79
+ }
69
80
  async computeEffectiveDistOptions() {
70
81
  const packager = this.packager;
71
82
  let iconUrl = this.options.iconUrl;
@@ -80,35 +91,49 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
80
91
  }
81
92
  checkConflictingOptions(this.options);
82
93
  const appInfo = packager.appInfo;
83
- const projectUrl = await appInfo.computePackageUrl();
84
- const appName = this.appName;
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
+ }
85
101
  const options = {
86
- name: appName,
87
- productName: this.options.name || appInfo.productName,
88
- appId: this.options.useAppIdAsId ? appInfo.id : appName,
102
+ appDirectory: this.appDirectory,
103
+ outputDirectory: this.outputDirectory,
104
+ name: this.options.useAppIdAsId ? appInfo.id : this.appName,
89
105
  version: appInfo.version,
90
106
  description: appInfo.description,
91
- // better to explicitly set to empty string, to avoid any nugget errors
107
+ exe: `${this.packager.platformSpecificBuildOptions.executableName || this.options.name || appInfo.productName}.exe`,
92
108
  authors: appInfo.companyName || "",
93
109
  iconUrl,
94
- extraMetadataSpecs: projectUrl == null ? null : `\n <projectUrl>${projectUrl}</projectUrl>`,
95
110
  copyright: appInfo.copyright,
96
- packageCompressionLevel: parseInt((process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL || packager.compression === "store" ? 0 : 9), 10),
97
- vendorPath: await (0, binDownload_1.getBinFromUrl)("Squirrel.Windows", "1.9.0", "zJHk4CMATM7jHJ2ojRH1n3LkOnaIezDk5FAzJmlSEQSiEdRuB4GGLCegLDtsRCakfHIVfKh3ysJHLjynPkXwhQ=="),
98
- ...this.options,
111
+ vendorDirectory,
112
+ nuspecTemplate: path.join(__dirname, "..", "template.nuspectemplate"),
113
+ noMsi: !this.options.msi,
99
114
  };
115
+ const projectUrl = await appInfo.computePackageUrl();
116
+ if (projectUrl != null) {
117
+ const nuspecTemplate = await this.packager.info.tempDirManager.getTempFile({ prefix: "template", suffix: ".nuspectemplate" });
118
+ let templateContent = await (0, promises_1.readFile)(path.resolve(__dirname, "..", "template.nuspectemplate"), "utf8");
119
+ const searchString = "<copyright><%- copyright %></copyright>";
120
+ templateContent = templateContent.replace(searchString, `${searchString}\n <projectUrl>${projectUrl}</projectUrl>`);
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
+ };
130
+ }
100
131
  if ((0, builder_util_1.isEmptyOrSpaces)(options.description)) {
101
- options.description = options.productName;
132
+ options.description = this.options.name || appInfo.productName;
102
133
  }
103
134
  if (options.remoteToken == null) {
104
135
  options.remoteToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN;
105
136
  }
106
- if (!("loadingGif" in options)) {
107
- const resourceList = await packager.resourceList;
108
- if (resourceList.includes("install-spinner.gif")) {
109
- options.loadingGif = path.join(packager.buildResourcesDir, "install-spinner.gif");
110
- }
111
- }
112
137
  if (this.options.remoteReleases === true) {
113
138
  const info = await packager.info.repositoryInfo;
114
139
  if (info == null) {
@@ -119,6 +144,15 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
119
144
  builder_util_1.log.info({ remoteReleases: options.remoteReleases }, `remoteReleases is set`);
120
145
  }
121
146
  }
147
+ else if (typeof this.options.remoteReleases === "string" && !(0, builder_util_1.isEmptyOrSpaces)(this.options.remoteReleases)) {
148
+ options.remoteReleases = this.options.remoteReleases;
149
+ }
150
+ if (!("loadingGif" in options)) {
151
+ const resourceList = await packager.resourceList;
152
+ if (resourceList.includes("install-spinner.gif")) {
153
+ options.loadingGif = path.join(packager.buildResourcesDir, "install-spinner.gif");
154
+ }
155
+ }
122
156
  return options;
123
157
  }
124
158
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SquirrelWindowsTarget.js","sourceRoot":"","sources":["../src/SquirrelWindowsTarget.ts"],"names":[],"mappings":";;AAAA,qDAAqF;AACrF,iEAA+D;AAE/D,+CAA8E;AAC9E,wDAA4D;AAC5D,6BAA4B;AAC5B,iDAAiF;AAEjF,MAAqB,qBAAsB,SAAQ,wBAAM;IAIvD,YACmB,QAAqB,EAC7B,MAAc;QAEvB,KAAK,CAAC,UAAU,CAAC,CAAA;QAHA,aAAQ,GAAR,QAAQ,CAAa;QAC7B,WAAM,GAAN,MAAM,CAAQ;QALzB,2DAA2D;QAClD,YAAO,GAA2B,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,EAA4B,CAAA;IAO/J,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,SAAiB,EAAE,IAAU;QACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAA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;CACF;AAvID,wCAuIC;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 { Arch, getArchSuffix, SquirrelWindowsOptions, Target } from \"app-builder-lib\"\nimport { getBinFromUrl } from \"app-builder-lib/out/binDownload\"\nimport { WinPackager } from \"app-builder-lib/out/winPackager\"\nimport { InvalidConfigurationError, isEmptyOrSpaces, log } from \"builder-util\"\nimport { sanitizeFileName } from \"builder-util/out/filename\"\nimport * as path from \"path\"\nimport { convertVersion, SquirrelBuilder, SquirrelOptions } from \"./squirrelPack\"\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 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 // tslint:disable-next-line:no-invalid-template-strings\n const setupFile = packager.expandArtifactNamePattern(this.options, \"exe\", arch, \"${productName} Setup ${version}.${ext}\")\n const packageFile = `${sanitizedName}-${convertVersion(version)}-full.nupkg`\n\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 const distOptions = await this.computeEffectiveDistOptions()\n const squirrelBuilder = new SquirrelBuilder(distOptions, installerOutDir, packager)\n await squirrelBuilder.buildInstaller({ setupFile, packageFile }, appOutDir, this.outDir, arch)\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 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 const projectUrl = await appInfo.computePackageUrl()\n const appName = this.appName\n const options: SquirrelOptions = {\n name: appName,\n productName: this.options.name || appInfo.productName,\n appId: this.options.useAppIdAsId ? appInfo.id : appName,\n version: appInfo.version,\n description: appInfo.description,\n // better to explicitly set to empty string, to avoid any nugget errors\n authors: appInfo.companyName || \"\",\n iconUrl,\n extraMetadataSpecs: projectUrl == null ? null : `\\n <projectUrl>${projectUrl}</projectUrl>`,\n copyright: appInfo.copyright,\n packageCompressionLevel: parseInt((process.env.ELECTRON_BUILDER_COMPRESSION_LEVEL || packager.compression === \"store\" ? 0 : 9) as any, 10),\n vendorPath: await getBinFromUrl(\"Squirrel.Windows\", \"1.9.0\", \"zJHk4CMATM7jHJ2ojRH1n3LkOnaIezDk5FAzJmlSEQSiEdRuB4GGLCegLDtsRCakfHIVfKh3ysJHLjynPkXwhQ==\"),\n ...(this.options as any),\n }\n\n if (isEmptyOrSpaces(options.description)) {\n options.description = options.productName\n }\n\n if (options.remoteToken == null) {\n options.remoteToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN\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 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 }\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,qDAAqF;AAErF,wDAA4D;AAC5D,6BAA4B;AAC5B,yBAAwB;AACxB,0CAAiD;AACjD,6DAAwG;AAExG,MAAqB,qBAAsB,SAAQ,wBAAM;IAMvD,YACmB,QAAqB,EAC7B,MAAc;QAEvB,KAAK,CAAC,UAAU,CAAC,CAAA;QAHA,aAAQ,GAAR,QAAQ,CAAa;QAC7B,WAAM,GAAN,MAAM,CAAQ;QAPzB,2DAA2D;QAClD,YAAO,GAA2B,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,EAA4B,CAAA;QACvJ,iBAAY,GAAW,EAAE,CAAA;QACzB,oBAAe,GAAW,EAAE,CAAA;IAOpC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,SAAiB,EAAE,IAAU;QACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAA;QACxC,MAAM,aAAa,GAAG,IAAA,2BAAgB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAEp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c,CAAA;QACtD,CAAC;QAED,IAAI,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC,EAAE,CAAC;YAC/B,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,YAAY,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;AA3KD,wCA2KC;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 { 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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electron-builder-squirrel-windows",
3
- "version": "26.0.2",
3
+ "version": "26.0.4",
4
4
  "main": "out/SquirrelWindowsTarget.js",
5
5
  "author": "Vladimir Krivosheev",
6
6
  "license": "MIT",
@@ -12,13 +12,13 @@
12
12
  "bugs": "https://github.com/electron-userland/electron-builder/issues",
13
13
  "homepage": "https://github.com/electron-userland/electron-builder",
14
14
  "files": [
15
- "out"
15
+ "out",
16
+ "template.nuspectemplate"
16
17
  ],
17
18
  "dependencies": {
18
- "archiver": "^5.3.1",
19
- "fs-extra": "^10.1.0",
20
- "app-builder-lib": "26.0.2",
21
- "builder-util": "26.0.1"
19
+ "electron-winstaller": "5.4.0",
20
+ "app-builder-lib": "26.0.4",
21
+ "builder-util": "26.0.4"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/archiver": "5.3.1",
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
3
+ <metadata>
4
+ <id><%- name %></id>
5
+ <title><%- title %></title>
6
+ <version><%- version %></version>
7
+ <authors><%- authors %></authors>
8
+ <owners><%- owners %></owners>
9
+ <iconUrl><%- iconUrl %></iconUrl>
10
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
11
+ <description><%- description %></description>
12
+ <copyright><%- copyright %></copyright>
13
+ </metadata>
14
+ <files>
15
+ <file src="locales\**" target="lib\net45\locales" />
16
+ <file src="resources\**" target="lib\net45\resources" />
17
+ <file src="*.bin" target="lib\net45" />
18
+ <file src="*.dll" target="lib\net45" />
19
+ <file src="*.pak" target="lib\net45" />
20
+ <file src="*.exe.config" target="lib\net45" />
21
+ <file src="*.exe.sig" target="lib\net45" />
22
+ <file src="icudtl.dat" target="lib\net45\icudtl.dat" />
23
+ <file src="Squirrel.exe" target="lib\net45\squirrel.exe" />
24
+ <file src="LICENSE.electron.txt" target="lib\net45\LICENSE.electron.txt" />
25
+ <file src="LICENSES.chromium.html" target="lib\net45\LICENSES.chromium.html" />
26
+ <file src="<%- exe %>" target="lib\net45\<%- exe %>" />
27
+ <% additionalFiles.forEach(function(f) { %>
28
+ <file src="<%- f.src %>" target="<%- f.target %>" />
29
+ <% }); %>
30
+ </files>
31
+ </package>
@@ -1,33 +0,0 @@
1
- import { WinPackager } from "app-builder-lib/out/winPackager";
2
- import { Arch } from "builder-util";
3
- export declare function convertVersion(version: string): string;
4
- export interface SquirrelOptions {
5
- vendorPath: string;
6
- remoteReleases?: string;
7
- remoteToken?: string;
8
- loadingGif?: string;
9
- productName: string;
10
- appId?: string;
11
- name: string;
12
- packageCompressionLevel?: number;
13
- version: string;
14
- msi?: any;
15
- description?: string;
16
- iconUrl?: string;
17
- authors?: string;
18
- extraMetadataSpecs?: string;
19
- copyright?: string;
20
- }
21
- export interface OutFileNames {
22
- setupFile: string;
23
- packageFile: string;
24
- }
25
- export declare class SquirrelBuilder {
26
- private readonly options;
27
- private readonly outputDirectory;
28
- private readonly packager;
29
- constructor(options: SquirrelOptions, outputDirectory: string, packager: WinPackager);
30
- buildInstaller(outFileNames: OutFileNames, appOutDir: string, outDir: string, arch: Arch): Promise<void>;
31
- private releasify;
32
- private createEmbeddedArchiveFile;
33
- }
@@ -1,229 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SquirrelBuilder = void 0;
4
- exports.convertVersion = convertVersion;
5
- const archive_1 = require("app-builder-lib/out/targets/archive");
6
- const wine_1 = require("app-builder-lib/out/wine");
7
- const archiver = require("archiver");
8
- const builder_util_1 = require("builder-util");
9
- const fs_extra_1 = require("fs-extra");
10
- const fs = require("fs/promises");
11
- const path = require("path");
12
- function convertVersion(version) {
13
- const parts = version.split("-");
14
- const mainVersion = parts.shift();
15
- if (parts.length > 0) {
16
- return [mainVersion, parts.join("-").replace(/\./g, "")].join("-");
17
- }
18
- else {
19
- return mainVersion;
20
- }
21
- }
22
- function syncReleases(outputDirectory, options) {
23
- builder_util_1.log.info("syncing releases to build delta package");
24
- const args = (0, wine_1.prepareWindowsExecutableArgs)(["-u", options.remoteReleases, "-r", outputDirectory], path.join(options.vendorPath, "SyncReleases.exe"));
25
- if (options.remoteToken) {
26
- args.push("-t", options.remoteToken);
27
- }
28
- return (0, builder_util_1.spawn)(process.platform === "win32" ? path.join(options.vendorPath, "SyncReleases.exe") : "mono", args);
29
- }
30
- class SquirrelBuilder {
31
- constructor(options, outputDirectory, packager) {
32
- this.options = options;
33
- this.outputDirectory = outputDirectory;
34
- this.packager = packager;
35
- }
36
- async buildInstaller(outFileNames, appOutDir, outDir, arch) {
37
- const packager = this.packager;
38
- const dirToArchive = await packager.info.tempDirManager.createTempDir({ prefix: "squirrel-windows" });
39
- const outputDirectory = this.outputDirectory;
40
- const options = this.options;
41
- const appUpdate = path.join(dirToArchive, "Update.exe");
42
- await Promise.all([
43
- (0, builder_util_1.copyFile)(path.join(options.vendorPath, "Update.exe"), appUpdate).then(() => packager.sign(appUpdate)),
44
- Promise.all([
45
- fs.rm(`${outputDirectory.replace(/\\/g, "/")}/*-full.nupkg`, { recursive: true, force: true }),
46
- fs.rm(path.join(outputDirectory, "RELEASES"), { recursive: true, force: true }),
47
- ]).then(() => fs.mkdir(outputDirectory, { recursive: true })),
48
- ]);
49
- if ((0, builder_util_1.isEmptyOrSpaces)(options.description)) {
50
- options.description = options.productName;
51
- }
52
- if (options.remoteReleases) {
53
- await syncReleases(outputDirectory, options);
54
- }
55
- const version = convertVersion(options.version);
56
- const nupkgPath = path.join(outputDirectory, outFileNames.packageFile);
57
- const setupPath = path.join(outputDirectory, outFileNames.setupFile);
58
- await Promise.all([
59
- pack(options, appOutDir, appUpdate, nupkgPath, version, packager),
60
- (0, builder_util_1.copyFile)(path.join(options.vendorPath, "Setup.exe"), setupPath),
61
- (0, builder_util_1.copyFile)(options.loadingGif ? path.resolve(packager.projectDir, options.loadingGif) : path.join(options.vendorPath, "install-spinner.gif"), path.join(dirToArchive, "background.gif")),
62
- ]);
63
- // releasify can be called only after pack nupkg and nupkg must be in the final output directory (where other old version nupkg can be located)
64
- await this.releasify(nupkgPath, outFileNames.packageFile).then(it => (0, fs_extra_1.writeFile)(path.join(dirToArchive, "RELEASES"), it));
65
- const embeddedArchiveFile = await this.createEmbeddedArchiveFile(nupkgPath, dirToArchive);
66
- await (0, wine_1.execWine)(path.join(options.vendorPath, "WriteZipToSetup.exe"), null, [setupPath, embeddedArchiveFile]);
67
- await packager.signAndEditResources(setupPath, arch, outDir);
68
- if (options.msi && process.platform === "win32") {
69
- const outFile = outFileNames.setupFile.replace(".exe", ".msi");
70
- await msi(options, nupkgPath, setupPath, outputDirectory, outFile);
71
- // rcedit can only edit .exe resources
72
- await packager.sign(path.join(outputDirectory, outFile));
73
- }
74
- }
75
- async releasify(nupkgPath, packageName) {
76
- const args = ["--releasify", nupkgPath, "--releaseDir", this.outputDirectory];
77
- const out = (await execSw(this.options, args)).trim();
78
- if (builder_util_1.debug.enabled) {
79
- (0, builder_util_1.debug)(`Squirrel output: ${out}`);
80
- }
81
- const lines = out.split("\n");
82
- for (let i = lines.length - 1; i > -1; i--) {
83
- const line = lines[i];
84
- if (line.includes(packageName)) {
85
- return line.trim();
86
- }
87
- }
88
- throw new Error(`Invalid output, cannot find last release entry, output: ${out}`);
89
- }
90
- async createEmbeddedArchiveFile(nupkgPath, dirToArchive) {
91
- const embeddedArchiveFile = await this.packager.getTempFile("setup.zip");
92
- const path7za = await (0, builder_util_1.getPath7za)();
93
- await (0, builder_util_1.exec)(path7za, (0, archive_1.compute7zCompressArgs)("zip", {
94
- isRegularFile: true,
95
- compression: this.packager.compression,
96
- }).concat(embeddedArchiveFile, "."), {
97
- cwd: dirToArchive,
98
- });
99
- await (0, builder_util_1.exec)(path7za, (0, archive_1.compute7zCompressArgs)("zip", {
100
- isRegularFile: true,
101
- compression: "store" /* nupkg is already compressed */,
102
- }).concat(embeddedArchiveFile, nupkgPath));
103
- return embeddedArchiveFile;
104
- }
105
- }
106
- exports.SquirrelBuilder = SquirrelBuilder;
107
- async function pack(options, directory, updateFile, outFile, version, packager) {
108
- // SW now doesn't support 0-level nupkg compressed files. It means that we are forced to use level 1 if store level requested.
109
- const archive = archiver("zip", { zlib: { level: Math.max(1, options.packageCompressionLevel == null ? 9 : options.packageCompressionLevel) } });
110
- const archiveOut = (0, fs_extra_1.createWriteStream)(outFile);
111
- const archivePromise = new Promise((resolve, reject) => {
112
- archive.on("error", reject);
113
- archiveOut.on("error", reject);
114
- archiveOut.on("close", resolve);
115
- });
116
- archive.pipe(archiveOut);
117
- const author = options.authors;
118
- const copyright = options.copyright || `Copyright © ${new Date().getFullYear()} ${author}`;
119
- const nuspecContent = `<?xml version="1.0"?>
120
- <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
121
- <metadata>
122
- <id>${options.appId}</id>
123
- <version>${version}</version>
124
- <title>${options.productName}</title>
125
- <authors>${author}</authors>
126
- <iconUrl>${options.iconUrl}</iconUrl>
127
- <requireLicenseAcceptance>false</requireLicenseAcceptance>
128
- <description>${options.description}</description>
129
- <copyright>${copyright}</copyright>${options.extraMetadataSpecs || ""}
130
- </metadata>
131
- </package>`;
132
- (0, builder_util_1.debug)(`Created NuSpec file:\n${nuspecContent}`);
133
- archive.append(nuspecContent.replace(/\n/, "\r\n"), { name: `${options.name}.nuspec` });
134
- //noinspection SpellCheckingInspection
135
- archive.append(`<?xml version="1.0" encoding="utf-8"?>
136
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
137
- <Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${options.name}.nuspec" Id="Re0" />
138
- <Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/package/services/metadata/core-properties/1.psmdcp" Id="Re1" />
139
- </Relationships>`.replace(/\n/, "\r\n"), { name: ".rels", prefix: "_rels" });
140
- //noinspection SpellCheckingInspection
141
- archive.append(`<?xml version="1.0" encoding="utf-8"?>
142
- <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
143
- <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
144
- <Default Extension="nuspec" ContentType="application/octet" />
145
- <Default Extension="pak" ContentType="application/octet" />
146
- <Default Extension="asar" ContentType="application/octet" />
147
- <Default Extension="bin" ContentType="application/octet" />
148
- <Default Extension="dll" ContentType="application/octet" />
149
- <Default Extension="exe" ContentType="application/octet" />
150
- <Default Extension="dat" ContentType="application/octet" />
151
- <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
152
- <Default Extension="diff" ContentType="application/octet" />
153
- <Default Extension="bsdiff" ContentType="application/octet" />
154
- <Default Extension="shasum" ContentType="text/plain" />
155
- <Default Extension="mp3" ContentType="audio/mpeg" />
156
- <Default Extension="node" ContentType="application/octet" />
157
- </Types>`.replace(/\n/, "\r\n"), { name: "[Content_Types].xml" });
158
- archive.append(`<?xml version="1.0" encoding="utf-8"?>
159
- <coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
160
- xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties">
161
- <dc:creator>${author}</dc:creator>
162
- <dc:description>${options.description}</dc:description>
163
- <dc:identifier>${options.appId}</dc:identifier>
164
- <version>${version}</version>
165
- <keywords/>
166
- <dc:title>${options.productName}</dc:title>
167
- <lastModifiedBy>NuGet, Version=2.8.50926.602, Culture=neutral, PublicKeyToken=null;Microsoft Windows NT 6.2.9200.0;.NET Framework 4</lastModifiedBy>
168
- </coreProperties>`.replace(/\n/, "\r\n"), { name: "1.psmdcp", prefix: "package/services/metadata/core-properties" });
169
- archive.file(updateFile, { name: "Update.exe", prefix: "lib/net45" });
170
- await encodedZip(archive, directory, "lib/net45", options.vendorPath, packager);
171
- await archivePromise;
172
- }
173
- async function execSw(options, args) {
174
- return (0, builder_util_1.exec)(process.platform === "win32" ? path.join(options.vendorPath, "Update.com") : "mono", (0, wine_1.prepareWindowsExecutableArgs)(args, path.join(options.vendorPath, "Update-Mono.exe")), {
175
- env: {
176
- ...process.env,
177
- SZA_PATH: await (0, builder_util_1.getPath7za)(),
178
- },
179
- });
180
- }
181
- async function msi(options, nupkgPath, setupPath, outputDirectory, outFile) {
182
- const args = ["--createMsi", nupkgPath, "--bootstrapperExe", setupPath];
183
- await execSw(options, args);
184
- //noinspection SpellCheckingInspection
185
- await (0, builder_util_1.exec)(path.join(options.vendorPath, "candle.exe"), ["-nologo", "-ext", "WixNetFxExtension", "-out", "Setup.wixobj", "Setup.wxs"], {
186
- cwd: outputDirectory,
187
- });
188
- //noinspection SpellCheckingInspection
189
- await (0, builder_util_1.exec)(path.join(options.vendorPath, "light.exe"), ["-ext", "WixNetFxExtension", "-sval", "-out", outFile, "Setup.wixobj"], {
190
- cwd: outputDirectory,
191
- });
192
- //noinspection SpellCheckingInspection
193
- await Promise.all([
194
- (0, fs_extra_1.unlink)(path.join(outputDirectory, "Setup.wxs")),
195
- (0, fs_extra_1.unlink)(path.join(outputDirectory, "Setup.wixobj")),
196
- (0, fs_extra_1.unlink)(path.join(outputDirectory, outFile.replace(".msi", ".wixpdb"))).catch((e) => (0, builder_util_1.debug)(e.toString())),
197
- ]);
198
- }
199
- async function encodedZip(archive, dir, prefix, vendorPath, packager) {
200
- await (0, builder_util_1.walk)(dir, null, {
201
- isIncludeDir: true,
202
- consume: async (file, stats) => {
203
- if (stats.isDirectory()) {
204
- return;
205
- }
206
- const relativeSafeFilePath = file.substring(dir.length + 1).replace(/\\/g, "/");
207
- archive._append(file, {
208
- name: relativeSafeFilePath,
209
- prefix,
210
- stats,
211
- });
212
- // createExecutableStubForExe
213
- // https://github.com/Squirrel/Squirrel.Windows/pull/1051 Only generate execution stubs for the top-level executables
214
- if (file.endsWith(".exe") && !file.includes("squirrel.exe") && !relativeSafeFilePath.includes("/")) {
215
- const tempFile = await packager.getTempFile("stub.exe");
216
- await (0, builder_util_1.copyFile)(path.join(vendorPath, "StubExecutable.exe"), tempFile);
217
- await (0, wine_1.execWine)(path.join(vendorPath, "WriteZipToSetup.exe"), null, ["--copy-stub-resources", file, tempFile]);
218
- await packager.sign(tempFile);
219
- archive._append(tempFile, {
220
- name: relativeSafeFilePath.substring(0, relativeSafeFilePath.length - 4) + "_ExecutionStub.exe",
221
- prefix,
222
- stats: await (0, fs_extra_1.stat)(tempFile),
223
- });
224
- }
225
- },
226
- });
227
- archive.finalize();
228
- }
229
- //# sourceMappingURL=squirrelPack.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"squirrelPack.js","sourceRoot":"","sources":["../src/squirrelPack.ts"],"names":[],"mappings":";;;AASA,wCAQC;AAjBD,iEAA2E;AAC3E,mDAAgG;AAEhG,qCAAoC;AACpC,+CAAyG;AACzG,uCAAqE;AACrE,kCAAiC;AACjC,6BAA4B;AAE5B,SAAgB,cAAc,CAAC,OAAe;IAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAChC,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;IACjC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CA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AAC,OAAO,CAAC,IAAI,EAAE;gBACpB,IAAI,EAAE,oBAAoB;gBAC1B,MAAM;gBACN,KAAK;aACN,CAAC,CAAA;YAEF,6BAA6B;YAC7B,qHAAqH;YACrH,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnG,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;gBACvD,MAAM,IAAA,uBAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,oBAAoB,CAAC,EAAE,QAAQ,CAAC,CAAA;gBACrE,MAAM,IAAA,eAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,qBAAqB,CAAC,EAAE,IAAI,EAAE,CAAC,uBAAuB,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;gBAC7G,MAAM,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;gBAE7B,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE;oBACxB,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC,EAAE,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,oBAAoB;oBAC/F,MAAM;oBACN,KAAK,EAAE,MAAM,IAAA,eAAI,EAAC,QAAQ,CAAC;iBAC5B,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAA;IACF,OAAO,CAAC,QAAQ,EAAE,CAAA;AACpB,CAAC","sourcesContent":["import { compute7zCompressArgs } from \"app-builder-lib/out/targets/archive\"\nimport { execWine, prepareWindowsExecutableArgs as prepareArgs } from \"app-builder-lib/out/wine\"\nimport { WinPackager } from \"app-builder-lib/out/winPackager\"\nimport * as archiver from \"archiver\"\nimport { Arch, copyFile, debug, exec, getPath7za, isEmptyOrSpaces, log, spawn, walk } from \"builder-util\"\nimport { createWriteStream, stat, unlink, writeFile } from \"fs-extra\"\nimport * as fs from \"fs/promises\"\nimport * as path from \"path\"\n\nexport function convertVersion(version: string): string {\n const parts = version.split(\"-\")\n const mainVersion = parts.shift()\n if (parts.length > 0) {\n return [mainVersion, parts.join(\"-\").replace(/\\./g, \"\")].join(\"-\")\n } else {\n return mainVersion!\n }\n}\n\nfunction syncReleases(outputDirectory: string, options: SquirrelOptions) {\n log.info(\"syncing releases to build delta package\")\n const args = prepareArgs([\"-u\", options.remoteReleases!, \"-r\", outputDirectory], path.join(options.vendorPath, \"SyncReleases.exe\"))\n if (options.remoteToken) {\n args.push(\"-t\", options.remoteToken)\n }\n return spawn(process.platform === \"win32\" ? path.join(options.vendorPath, \"SyncReleases.exe\") : \"mono\", args)\n}\n\nexport interface SquirrelOptions {\n vendorPath: string\n remoteReleases?: string\n remoteToken?: string\n loadingGif?: string\n productName: string\n appId?: string\n name: string\n packageCompressionLevel?: number\n version: string\n msi?: any\n\n description?: string\n iconUrl?: string\n authors?: string\n extraMetadataSpecs?: string\n copyright?: string\n}\n\nexport interface OutFileNames {\n setupFile: string\n packageFile: string\n}\n\nexport class SquirrelBuilder {\n constructor(\n private readonly options: SquirrelOptions,\n private readonly outputDirectory: string,\n private readonly packager: WinPackager\n ) {}\n\n async buildInstaller(outFileNames: OutFileNames, appOutDir: string, outDir: string, arch: Arch) {\n const packager = this.packager\n const dirToArchive = await packager.info.tempDirManager.createTempDir({ prefix: \"squirrel-windows\" })\n const outputDirectory = this.outputDirectory\n const options = this.options\n const appUpdate = path.join(dirToArchive, \"Update.exe\")\n await Promise.all([\n copyFile(path.join(options.vendorPath, \"Update.exe\"), appUpdate).then(() => packager.sign(appUpdate)),\n Promise.all([\n fs.rm(`${outputDirectory.replace(/\\\\/g, \"/\")}/*-full.nupkg`, { recursive: true, force: true }),\n fs.rm(path.join(outputDirectory, \"RELEASES\"), { recursive: true, force: true }),\n ]).then(() => fs.mkdir(outputDirectory, { recursive: true })),\n ])\n\n if (isEmptyOrSpaces(options.description)) {\n options.description = options.productName\n }\n\n if (options.remoteReleases) {\n await syncReleases(outputDirectory, options)\n }\n\n const version = convertVersion(options.version)\n const nupkgPath = path.join(outputDirectory, outFileNames.packageFile)\n const setupPath = path.join(outputDirectory, outFileNames.setupFile)\n\n await Promise.all<any>([\n pack(options, appOutDir, appUpdate, nupkgPath, version, packager),\n copyFile(path.join(options.vendorPath, \"Setup.exe\"), setupPath),\n copyFile(\n options.loadingGif ? path.resolve(packager.projectDir, options.loadingGif) : path.join(options.vendorPath, \"install-spinner.gif\"),\n path.join(dirToArchive, \"background.gif\")\n ),\n ])\n\n // releasify can be called only after pack nupkg and nupkg must be in the final output directory (where other old version nupkg can be located)\n await this.releasify(nupkgPath, outFileNames.packageFile).then(it => writeFile(path.join(dirToArchive, \"RELEASES\"), it))\n\n const embeddedArchiveFile = await this.createEmbeddedArchiveFile(nupkgPath, dirToArchive)\n\n await execWine(path.join(options.vendorPath, \"WriteZipToSetup.exe\"), null, [setupPath, embeddedArchiveFile])\n\n await packager.signAndEditResources(setupPath, arch, outDir)\n if (options.msi && process.platform === \"win32\") {\n const outFile = outFileNames.setupFile.replace(\".exe\", \".msi\")\n await msi(options, nupkgPath, setupPath, outputDirectory, outFile)\n // rcedit can only edit .exe resources\n await packager.sign(path.join(outputDirectory, outFile))\n }\n }\n\n private async releasify(nupkgPath: string, packageName: string) {\n const args = [\"--releasify\", nupkgPath, \"--releaseDir\", this.outputDirectory]\n const out = (await execSw(this.options, args)).trim()\n if (debug.enabled) {\n debug(`Squirrel output: ${out}`)\n }\n\n const lines = out.split(\"\\n\")\n for (let i = lines.length - 1; i > -1; i--) {\n const line = lines[i]\n if (line.includes(packageName)) {\n return line.trim()\n }\n }\n\n throw new Error(`Invalid output, cannot find last release entry, output: ${out}`)\n }\n\n private async createEmbeddedArchiveFile(nupkgPath: string, dirToArchive: string) {\n const embeddedArchiveFile = await this.packager.getTempFile(\"setup.zip\")\n const path7za = await getPath7za()\n await exec(\n path7za,\n compute7zCompressArgs(\"zip\", {\n isRegularFile: true,\n compression: this.packager.compression,\n }).concat(embeddedArchiveFile, \".\"),\n {\n cwd: dirToArchive,\n }\n )\n await exec(\n path7za,\n compute7zCompressArgs(\"zip\", {\n isRegularFile: true,\n compression: \"store\" /* nupkg is already compressed */,\n }).concat(embeddedArchiveFile, nupkgPath)\n )\n return embeddedArchiveFile\n }\n}\n\nasync function pack(options: SquirrelOptions, directory: string, updateFile: string, outFile: string, version: string, packager: WinPackager) {\n // SW now doesn't support 0-level nupkg compressed files. It means that we are forced to use level 1 if store level requested.\n const archive = archiver(\"zip\", { zlib: { level: Math.max(1, options.packageCompressionLevel == null ? 9 : options.packageCompressionLevel) } })\n const archiveOut = createWriteStream(outFile)\n const archivePromise = new Promise((resolve, reject) => {\n archive.on(\"error\", reject)\n archiveOut.on(\"error\", reject)\n archiveOut.on(\"close\", resolve)\n })\n archive.pipe(archiveOut)\n\n const author = options.authors\n const copyright = options.copyright || `Copyright © ${new Date().getFullYear()} ${author}`\n const nuspecContent = `<?xml version=\"1.0\"?>\n<package xmlns=\"http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd\">\n <metadata>\n <id>${options.appId}</id>\n <version>${version}</version>\n <title>${options.productName}</title>\n <authors>${author}</authors>\n <iconUrl>${options.iconUrl}</iconUrl>\n <requireLicenseAcceptance>false</requireLicenseAcceptance>\n <description>${options.description}</description>\n <copyright>${copyright}</copyright>${options.extraMetadataSpecs || \"\"}\n </metadata>\n</package>`\n debug(`Created NuSpec file:\\n${nuspecContent}`)\n archive.append(nuspecContent.replace(/\\n/, \"\\r\\n\"), { name: `${options.name}.nuspec` })\n\n //noinspection SpellCheckingInspection\n archive.append(\n `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n <Relationship Type=\"http://schemas.microsoft.com/packaging/2010/07/manifest\" Target=\"/${options.name}.nuspec\" Id=\"Re0\" />\n <Relationship Type=\"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\" Target=\"/package/services/metadata/core-properties/1.psmdcp\" Id=\"Re1\" />\n</Relationships>`.replace(/\\n/, \"\\r\\n\"),\n { name: \".rels\", prefix: \"_rels\" }\n )\n\n //noinspection SpellCheckingInspection\n archive.append(\n `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\n <Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\" />\n <Default Extension=\"nuspec\" ContentType=\"application/octet\" />\n <Default Extension=\"pak\" ContentType=\"application/octet\" />\n <Default Extension=\"asar\" ContentType=\"application/octet\" />\n <Default Extension=\"bin\" ContentType=\"application/octet\" />\n <Default Extension=\"dll\" ContentType=\"application/octet\" />\n <Default Extension=\"exe\" ContentType=\"application/octet\" />\n <Default Extension=\"dat\" ContentType=\"application/octet\" />\n <Default Extension=\"psmdcp\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\" />\n <Default Extension=\"diff\" ContentType=\"application/octet\" />\n <Default Extension=\"bsdiff\" ContentType=\"application/octet\" />\n <Default Extension=\"shasum\" ContentType=\"text/plain\" />\n <Default Extension=\"mp3\" ContentType=\"audio/mpeg\" />\n <Default Extension=\"node\" ContentType=\"application/octet\" />\n</Types>`.replace(/\\n/, \"\\r\\n\"),\n { name: \"[Content_Types].xml\" }\n )\n\n archive.append(\n `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<coreProperties xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xmlns=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\">\n <dc:creator>${author}</dc:creator>\n <dc:description>${options.description}</dc:description>\n <dc:identifier>${options.appId}</dc:identifier>\n <version>${version}</version>\n <keywords/>\n <dc:title>${options.productName}</dc:title>\n <lastModifiedBy>NuGet, Version=2.8.50926.602, Culture=neutral, PublicKeyToken=null;Microsoft Windows NT 6.2.9200.0;.NET Framework 4</lastModifiedBy>\n</coreProperties>`.replace(/\\n/, \"\\r\\n\"),\n { name: \"1.psmdcp\", prefix: \"package/services/metadata/core-properties\" }\n )\n\n archive.file(updateFile, { name: \"Update.exe\", prefix: \"lib/net45\" })\n await encodedZip(archive, directory, \"lib/net45\", options.vendorPath, packager)\n await archivePromise\n}\n\nasync function execSw(options: SquirrelOptions, args: Array<string>) {\n return exec(process.platform === \"win32\" ? path.join(options.vendorPath, \"Update.com\") : \"mono\", prepareArgs(args, path.join(options.vendorPath, \"Update-Mono.exe\")), {\n env: {\n ...process.env,\n SZA_PATH: await getPath7za(),\n },\n })\n}\n\nasync function msi(options: SquirrelOptions, nupkgPath: string, setupPath: string, outputDirectory: string, outFile: string) {\n const args = [\"--createMsi\", nupkgPath, \"--bootstrapperExe\", setupPath]\n await execSw(options, args)\n //noinspection SpellCheckingInspection\n await exec(path.join(options.vendorPath, \"candle.exe\"), [\"-nologo\", \"-ext\", \"WixNetFxExtension\", \"-out\", \"Setup.wixobj\", \"Setup.wxs\"], {\n cwd: outputDirectory,\n })\n //noinspection SpellCheckingInspection\n await exec(path.join(options.vendorPath, \"light.exe\"), [\"-ext\", \"WixNetFxExtension\", \"-sval\", \"-out\", outFile, \"Setup.wixobj\"], {\n cwd: outputDirectory,\n })\n\n //noinspection SpellCheckingInspection\n await Promise.all([\n unlink(path.join(outputDirectory, \"Setup.wxs\")),\n unlink(path.join(outputDirectory, \"Setup.wixobj\")),\n unlink(path.join(outputDirectory, outFile.replace(\".msi\", \".wixpdb\"))).catch((e: any) => debug(e.toString())),\n ])\n}\n\nasync function encodedZip(archive: any, dir: string, prefix: string, vendorPath: string, packager: WinPackager) {\n await walk(dir, null, {\n isIncludeDir: true,\n consume: async (file, stats) => {\n if (stats.isDirectory()) {\n return\n }\n\n const relativeSafeFilePath = file.substring(dir.length + 1).replace(/\\\\/g, \"/\")\n archive._append(file, {\n name: relativeSafeFilePath,\n prefix,\n stats,\n })\n\n // createExecutableStubForExe\n // https://github.com/Squirrel/Squirrel.Windows/pull/1051 Only generate execution stubs for the top-level executables\n if (file.endsWith(\".exe\") && !file.includes(\"squirrel.exe\") && !relativeSafeFilePath.includes(\"/\")) {\n const tempFile = await packager.getTempFile(\"stub.exe\")\n await copyFile(path.join(vendorPath, \"StubExecutable.exe\"), tempFile)\n await execWine(path.join(vendorPath, \"WriteZipToSetup.exe\"), null, [\"--copy-stub-resources\", file, tempFile])\n await packager.sign(tempFile)\n\n archive._append(tempFile, {\n name: relativeSafeFilePath.substring(0, relativeSafeFilePath.length - 4) + \"_ExecutionStub.exe\",\n prefix,\n stats: await stat(tempFile),\n })\n }\n },\n })\n archive.finalize()\n}\n"]}