app-builder-lib 26.0.15 → 26.0.17

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.
Files changed (57) hide show
  1. package/out/binDownload.d.ts +1 -1
  2. package/out/binDownload.js +10 -10
  3. package/out/binDownload.js.map +1 -1
  4. package/out/electron/ElectronFramework.js +71 -41
  5. package/out/electron/ElectronFramework.js.map +1 -1
  6. package/out/linuxPackager.js +1 -1
  7. package/out/linuxPackager.js.map +1 -1
  8. package/out/node-module-collector/index.js +1 -1
  9. package/out/node-module-collector/index.js.map +1 -1
  10. package/out/node-module-collector/nodeModulesCollector.d.ts +4 -6
  11. package/out/node-module-collector/nodeModulesCollector.js +2 -1
  12. package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
  13. package/out/node-module-collector/npmNodeModulesCollector.d.ts +4 -6
  14. package/out/node-module-collector/npmNodeModulesCollector.js +2 -3
  15. package/out/node-module-collector/npmNodeModulesCollector.js.map +1 -1
  16. package/out/node-module-collector/packageManager.d.ts +1 -0
  17. package/out/node-module-collector/packageManager.js +52 -65
  18. package/out/node-module-collector/packageManager.js.map +1 -1
  19. package/out/node-module-collector/pnpmNodeModulesCollector.d.ts +4 -7
  20. package/out/node-module-collector/pnpmNodeModulesCollector.js +4 -19
  21. package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  22. package/out/node-module-collector/yarnNodeModulesCollector.d.ts +4 -4
  23. package/out/node-module-collector/yarnNodeModulesCollector.js +3 -5
  24. package/out/node-module-collector/yarnNodeModulesCollector.js.map +1 -1
  25. package/out/options/winOptions.d.ts +4 -1
  26. package/out/options/winOptions.js.map +1 -1
  27. package/out/packager.js +2 -2
  28. package/out/packager.js.map +1 -1
  29. package/out/publish/PublishManager.js +1 -1
  30. package/out/publish/PublishManager.js.map +1 -1
  31. package/out/targets/FpmTarget.js +21 -2
  32. package/out/targets/FpmTarget.js.map +1 -1
  33. package/out/targets/MsiTarget.js +1 -1
  34. package/out/targets/MsiTarget.js.map +1 -1
  35. package/out/targets/nsis/Defines.d.ts +4 -0
  36. package/out/targets/nsis/Defines.js.map +1 -1
  37. package/out/targets/nsis/NsisTarget.js +5 -0
  38. package/out/targets/nsis/NsisTarget.js.map +1 -1
  39. package/out/targets/nsis/nsisOptions.d.ts +16 -0
  40. package/out/targets/nsis/nsisOptions.js.map +1 -1
  41. package/out/targets/nsis/nsisUtil.js +2 -3
  42. package/out/targets/nsis/nsisUtil.js.map +1 -1
  43. package/out/targets/tools.js +7 -4
  44. package/out/targets/tools.js.map +1 -1
  45. package/out/util/packageMetadata.js +8 -1
  46. package/out/util/packageMetadata.js.map +1 -1
  47. package/out/util/yarn.d.ts +1 -0
  48. package/out/util/yarn.js +3 -1
  49. package/out/util/yarn.js.map +1 -1
  50. package/out/version.d.ts +1 -1
  51. package/out/version.js +1 -1
  52. package/out/version.js.map +1 -1
  53. package/out/winPackager.js +2 -2
  54. package/out/winPackager.js.map +1 -1
  55. package/package.json +11 -10
  56. package/scheme.json +33 -1
  57. package/templates/nsis/include/installer.nsh +20 -0
@@ -2,9 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PM = void 0;
4
4
  exports.getPackageManagerCommand = getPackageManagerCommand;
5
+ exports.detectPackageManagerByEnv = detectPackageManagerByEnv;
5
6
  exports.detectPackageManager = detectPackageManager;
6
7
  const path = require("path");
7
8
  const fs = require("fs");
9
+ const which = require("which");
8
10
  var PM;
9
11
  (function (PM) {
10
12
  PM["NPM"] = "npm";
@@ -12,82 +14,67 @@ var PM;
12
14
  PM["PNPM"] = "pnpm";
13
15
  PM["YARN_BERRY"] = "yarn-berry";
14
16
  })(PM || (exports.PM = PM = {}));
15
- function detectPackageManagerByEnv() {
16
- var _a, _b, _c, _d;
17
- if (process.env.npm_config_user_agent) {
18
- const userAgent = process.env.npm_config_user_agent;
19
- if (userAgent.includes("pnpm")) {
20
- return PM.PNPM;
21
- }
22
- if (userAgent.includes("yarn")) {
23
- if (userAgent.includes("yarn/")) {
24
- const version = userAgent.match(/yarn\/(\d+)\./);
25
- if (version && parseInt(version[1]) >= 2) {
26
- return PM.YARN_BERRY;
27
- }
28
- }
29
- return PM.YARN;
30
- }
31
- if (userAgent.includes("npm")) {
32
- return PM.NPM;
33
- }
34
- }
35
- if (process.env.npm_execpath) {
36
- const execPath = process.env.npm_execpath.toLowerCase();
37
- if (execPath.includes("pnpm")) {
38
- return PM.PNPM;
39
- }
40
- if (execPath.includes("yarn")) {
41
- if (execPath.includes("berry") || ((_a = process.env.YARN_VERSION) === null || _a === void 0 ? void 0 : _a.startsWith("2.")) || ((_b = process.env.YARN_VERSION) === null || _b === void 0 ? void 0 : _b.startsWith("3."))) {
42
- return PM.YARN_BERRY;
43
- }
44
- return PM.YARN;
45
- }
46
- if (execPath.includes("npm")) {
47
- return PM.NPM;
48
- }
17
+ // Cache for resolved paths
18
+ const pmPathCache = {
19
+ [PM.NPM]: undefined,
20
+ [PM.YARN]: undefined,
21
+ [PM.PNPM]: undefined,
22
+ [PM.YARN_BERRY]: undefined,
23
+ };
24
+ function resolveCommand(pm) {
25
+ const fallback = pm === PM.YARN_BERRY ? "yarn" : pm;
26
+ if (process.platform !== "win32") {
27
+ return fallback;
49
28
  }
50
- if (process.env.PNPM_HOME) {
51
- return PM.PNPM;
29
+ try {
30
+ return path.basename(which.sync(fallback));
52
31
  }
53
- if (process.env.YARN_REGISTRY) {
54
- if (((_c = process.env.YARN_VERSION) === null || _c === void 0 ? void 0 : _c.startsWith("2.")) || ((_d = process.env.YARN_VERSION) === null || _d === void 0 ? void 0 : _d.startsWith("3."))) {
55
- return PM.YARN_BERRY;
56
- }
57
- return PM.YARN;
32
+ catch {
33
+ // If `which` fails (not found), still return the fallback string
34
+ return fallback;
58
35
  }
59
- if (process.env.npm_package_json) {
60
- return PM.NPM;
61
- }
62
- // return default
63
- return PM.NPM;
64
36
  }
65
37
  function getPackageManagerCommand(pm) {
66
- let cmd = pm;
67
- if (pm === PM.YARN_BERRY || process.env.FORCE_YARN === "true") {
68
- cmd = PM.YARN;
38
+ if (pmPathCache[pm] !== undefined) {
39
+ return pmPathCache[pm];
69
40
  }
70
- return `${cmd}${process.platform === "win32" ? ".cmd" : ""}`;
41
+ const resolved = resolveCommand(pm);
42
+ pmPathCache[pm] = resolved;
43
+ return resolved;
71
44
  }
72
- function detectPackageManager(cwd) {
73
- const isYarnLockFileExists = fs.existsSync(path.join(cwd, "yarn.lock"));
74
- const isPnpmLockFileExists = fs.existsSync(path.join(cwd, "pnpm-lock.yaml"));
75
- const isNpmLockFileExists = fs.existsSync(path.join(cwd, "package-lock.json"));
76
- if (isYarnLockFileExists && !isPnpmLockFileExists && !isNpmLockFileExists) {
77
- // check if yarn is berry
78
- const pm = detectPackageManagerByEnv();
79
- if (pm === PM.YARN_BERRY) {
80
- return PM.YARN_BERRY;
81
- }
82
- return PM.YARN;
83
- }
84
- if (isPnpmLockFileExists && !isYarnLockFileExists && !isNpmLockFileExists) {
45
+ function detectPackageManagerByEnv() {
46
+ var _a, _b, _c;
47
+ const ua = (_a = process.env.npm_config_user_agent) !== null && _a !== void 0 ? _a : "";
48
+ const execPath = (_c = (_b = process.env.npm_execpath) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : "";
49
+ const yarnVersion = process.env.YARN_VERSION;
50
+ const isBerry = (yarnVersion === null || yarnVersion === void 0 ? void 0 : yarnVersion.startsWith("2.")) || (yarnVersion === null || yarnVersion === void 0 ? void 0 : yarnVersion.startsWith("3."));
51
+ if (ua.includes("pnpm") || execPath.includes("pnpm") || process.env.PNPM_HOME) {
85
52
  return PM.PNPM;
86
53
  }
87
- if (isNpmLockFileExists && !isYarnLockFileExists && !isPnpmLockFileExists) {
54
+ if (ua.includes("yarn") || execPath.includes("yarn") || process.env.YARN_REGISTRY) {
55
+ return isBerry || ua.includes("yarn/2") || ua.includes("yarn/3") ? PM.YARN_BERRY : PM.YARN;
56
+ }
57
+ if (ua.includes("npm") || execPath.includes("npm") || process.env.npm_package_json) {
88
58
  return PM.NPM;
89
59
  }
90
- // if there are no lock files or multiple lock files, return the package manager from env
60
+ return PM.NPM;
61
+ }
62
+ function detectPackageManager(cwd) {
63
+ const has = (file) => fs.existsSync(path.join(cwd, file));
64
+ const yarn = has("yarn.lock");
65
+ const pnpm = has("pnpm-lock.yaml");
66
+ const npm = has("package-lock.json");
67
+ const detected = [];
68
+ if (yarn)
69
+ detected.push(PM.YARN);
70
+ if (pnpm)
71
+ detected.push(PM.PNPM);
72
+ if (npm)
73
+ detected.push(PM.NPM);
74
+ if (detected.length === 1) {
75
+ return detected[0] === PM.YARN ? detectPackageManagerByEnv() : detected[0];
76
+ }
77
+ // fallback: multiple lockfiles or none
91
78
  return detectPackageManagerByEnv();
92
79
  }
93
80
  //# sourceMappingURL=packageManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../src/node-module-collector/packageManager.ts"],"names":[],"mappings":";;;AAuEA,4DAMC;AAED,oDAuBC;AAtGD,6BAA4B;AAC5B,yBAAwB;AAExB,IAAY,EAKX;AALD,WAAY,EAAE;IACZ,iBAAW,CAAA;IACX,mBAAa,CAAA;IACb,mBAAa,CAAA;IACb,+BAAyB,CAAA;AAC3B,CAAC,EALW,EAAE,kBAAF,EAAE,QAKb;AAED,SAAS,yBAAyB;;IAChC,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAA;QAEnD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC,IAAI,CAAA;QAChB,CAAC;QAED,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/B,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBAChC,MAAM,OAAO,GAAG,SAAS,C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AoB,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1E,yBAAyB;QACzB,MAAM,EAAE,GAAG,yBAAyB,EAAE,CAAA;QACtC,IAAI,EAAE,KAAK,EAAE,CAAC,UAAU,EAAE,CAAC;YACzB,OAAO,EAAE,CAAC,UAAU,CAAA;QACtB,CAAC;QACD,OAAO,EAAE,CAAC,IAAI,CAAA;IAChB,CAAC;IAED,IAAI,oBAAoB,IAAI,CAAC,oBAAoB,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1E,OAAO,EAAE,CAAC,IAAI,CAAA;IAChB,CAAC;IAED,IAAI,mBAAmB,IAAI,CAAC,oBAAoB,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1E,OAAO,EAAE,CAAC,GAAG,CAAA;IACf,CAAC;IACD,yFAAyF;IACzF,OAAO,yBAAyB,EAAE,CAAA;AACpC,CAAC","sourcesContent":["import * as path from \"path\"\nimport * as fs from \"fs\"\n\nexport enum PM {\n NPM = \"npm\",\n YARN = \"yarn\",\n PNPM = \"pnpm\",\n YARN_BERRY = \"yarn-berry\",\n}\n\nfunction detectPackageManagerByEnv(): PM {\n if (process.env.npm_config_user_agent) {\n const userAgent = process.env.npm_config_user_agent\n\n if (userAgent.includes(\"pnpm\")) {\n return PM.PNPM\n }\n\n if (userAgent.includes(\"yarn\")) {\n if (userAgent.includes(\"yarn/\")) {\n const version = userAgent.match(/yarn\\/(\\d+)\\./)\n if (version && parseInt(version[1]) >= 2) {\n return PM.YARN_BERRY\n }\n }\n return PM.YARN\n }\n\n if (userAgent.includes(\"npm\")) {\n return PM.NPM\n }\n }\n\n if (process.env.npm_execpath) {\n const execPath = process.env.npm_execpath.toLowerCase()\n\n if (execPath.includes(\"pnpm\")) {\n return PM.PNPM\n }\n\n if (execPath.includes(\"yarn\")) {\n if (execPath.includes(\"berry\") || process.env.YARN_VERSION?.startsWith(\"2.\") || process.env.YARN_VERSION?.startsWith(\"3.\")) {\n return PM.YARN_BERRY\n }\n return PM.YARN\n }\n\n if (execPath.includes(\"npm\")) {\n return PM.NPM\n }\n }\n\n if (process.env.PNPM_HOME) {\n return PM.PNPM\n }\n\n if (process.env.YARN_REGISTRY) {\n if (process.env.YARN_VERSION?.startsWith(\"2.\") || process.env.YARN_VERSION?.startsWith(\"3.\")) {\n return PM.YARN_BERRY\n }\n return PM.YARN\n }\n\n if (process.env.npm_package_json) {\n return PM.NPM\n }\n\n // return default\n return PM.NPM\n}\n\nexport function getPackageManagerCommand(pm: PM) {\n let cmd = pm\n if (pm === PM.YARN_BERRY || process.env.FORCE_YARN === \"true\") {\n cmd = PM.YARN\n }\n return `${cmd}${process.platform === \"win32\" ? \".cmd\" : \"\"}`\n}\n\nexport function detectPackageManager(cwd: string) {\n const isYarnLockFileExists = fs.existsSync(path.join(cwd, \"yarn.lock\"))\n const isPnpmLockFileExists = fs.existsSync(path.join(cwd, \"pnpm-lock.yaml\"))\n const isNpmLockFileExists = fs.existsSync(path.join(cwd, \"package-lock.json\"))\n\n if (isYarnLockFileExists && !isPnpmLockFileExists && !isNpmLockFileExists) {\n // check if yarn is berry\n const pm = detectPackageManagerByEnv()\n if (pm === PM.YARN_BERRY) {\n return PM.YARN_BERRY\n }\n return PM.YARN\n }\n\n if (isPnpmLockFileExists && !isYarnLockFileExists && !isNpmLockFileExists) {\n return PM.PNPM\n }\n\n if (isNpmLockFileExists && !isYarnLockFileExists && !isPnpmLockFileExists) {\n return PM.NPM\n }\n // if there are no lock files or multiple lock files, return the package manager from env\n return detectPackageManagerByEnv()\n}\n"]}
1
+ {"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../src/node-module-collector/packageManager.ts"],"names":[],"mappings":";;;AAkCA,4DAQC;AAED,8DAoBC;AAED,oDAkBC;AApFD,6BAA4B;AAC5B,yBAAwB;AACxB,+BAA8B;AAE9B,IAAY,EAKX;AALD,WAAY,EAAE;IACZ,iBAAW,CAAA;IACX,mBAAa,CAAA;IACb,mBAAa,CAAA;IACb,+BAAyB,CAAA;AA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AG,GAAG,CAAC,gBAAgB,CAAC,CAAA;IAClC,MAAM,GAAG,GAAG,GAAG,CAAC,mBAAmB,CAAC,CAAA;IAEpC,MAAM,QAAQ,GAAS,EAAE,CAAA;IACzB,IAAI,IAAI;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;IAChC,IAAI,IAAI;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;IAChC,IAAI,GAAG;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;IAE9B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC5E,CAAC;IAED,uCAAuC;IACvC,OAAO,yBAAyB,EAAE,CAAA;AACpC,CAAC","sourcesContent":["import * as path from \"path\"\nimport * as fs from \"fs\"\nimport * as which from \"which\"\n\nexport enum PM {\n NPM = \"npm\",\n YARN = \"yarn\",\n PNPM = \"pnpm\",\n YARN_BERRY = \"yarn-berry\",\n}\n\n// Cache for resolved paths\nconst pmPathCache: Record<PM, string | null | undefined> = {\n [PM.NPM]: undefined,\n [PM.YARN]: undefined,\n [PM.PNPM]: undefined,\n [PM.YARN_BERRY]: undefined,\n}\n\nfunction resolveCommand(pm: PM): string {\n const fallback = pm === PM.YARN_BERRY ? \"yarn\" : pm\n\n if (process.platform !== \"win32\") {\n return fallback\n }\n\n try {\n return path.basename(which.sync(fallback))\n } catch {\n // If `which` fails (not found), still return the fallback string\n return fallback\n }\n}\n\nexport function getPackageManagerCommand(pm: PM) {\n if (pmPathCache[pm] !== undefined) {\n return pmPathCache[pm]!\n }\n\n const resolved = resolveCommand(pm)\n pmPathCache[pm] = resolved\n return resolved\n}\n\nexport function detectPackageManagerByEnv(): PM {\n const ua = process.env.npm_config_user_agent ?? \"\"\n const execPath = process.env.npm_execpath?.toLowerCase() ?? \"\"\n\n const yarnVersion = process.env.YARN_VERSION\n const isBerry = yarnVersion?.startsWith(\"2.\") || yarnVersion?.startsWith(\"3.\")\n\n if (ua.includes(\"pnpm\") || execPath.includes(\"pnpm\") || process.env.PNPM_HOME) {\n return PM.PNPM\n }\n\n if (ua.includes(\"yarn\") || execPath.includes(\"yarn\") || process.env.YARN_REGISTRY) {\n return isBerry || ua.includes(\"yarn/2\") || ua.includes(\"yarn/3\") ? PM.YARN_BERRY : PM.YARN\n }\n\n if (ua.includes(\"npm\") || execPath.includes(\"npm\") || process.env.npm_package_json) {\n return PM.NPM\n }\n\n return PM.NPM\n}\n\nexport function detectPackageManager(cwd: string): PM {\n const has = (file: string) => fs.existsSync(path.join(cwd, file))\n\n const yarn = has(\"yarn.lock\")\n const pnpm = has(\"pnpm-lock.yaml\")\n const npm = has(\"package-lock.json\")\n\n const detected: PM[] = []\n if (yarn) detected.push(PM.YARN)\n if (pnpm) detected.push(PM.PNPM)\n if (npm) detected.push(PM.NPM)\n\n if (detected.length === 1) {\n return detected[0] === PM.YARN ? detectPackageManagerByEnv() : detected[0]\n }\n\n // fallback: multiple lockfiles or none\n return detectPackageManagerByEnv()\n}\n"]}
@@ -1,15 +1,12 @@
1
- import { Lazy } from "lazy-val";
2
1
  import { NodeModulesCollector } from "./nodeModulesCollector";
2
+ import { PM } from "./packageManager";
3
3
  import { PnpmDependency } from "./types";
4
4
  export declare class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmDependency, PnpmDependency> {
5
5
  constructor(rootDir: string);
6
- static readonly pmCommand: Lazy<string>;
7
- protected readonly pmCommand: Lazy<string>;
8
- readonly installOptions: Promise<{
9
- cmd: string;
10
- args: string[];
6
+ readonly installOptions: {
7
+ manager: PM;
11
8
  lockfile: string;
12
- }>;
9
+ };
13
10
  protected getArgs(): string[];
14
11
  extractProductionDependencyGraph(tree: PnpmDependency, dependencyId: string): void;
15
12
  protected collectAllDependencies(tree: PnpmDependency): void;
@@ -1,17 +1,15 @@
1
1
  "use strict";
2
- var _a;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.PnpmNodeModulesCollector = void 0;
5
- const lazy_val_1 = require("lazy-val");
6
- const nodeModulesCollector_1 = require("./nodeModulesCollector");
7
4
  const builder_util_1 = require("builder-util");
8
- const path = require("path");
9
5
  const fs = require("fs");
6
+ const path = require("path");
7
+ const nodeModulesCollector_1 = require("./nodeModulesCollector");
8
+ const packageManager_1 = require("./packageManager");
10
9
  class PnpmNodeModulesCollector extends nodeModulesCollector_1.NodeModulesCollector {
11
10
  constructor(rootDir) {
12
11
  super(rootDir);
13
- this.pmCommand = _a.pmCommand;
14
- this.installOptions = this.pmCommand.value.then(cmd => ({ cmd, args: ["install", "--frozen-lockfile"], lockfile: "pnpm-lock.yaml" }));
12
+ this.installOptions = { manager: packageManager_1.PM.PNPM, lockfile: "pnpm-lock.yaml" };
15
13
  }
16
14
  getArgs() {
17
15
  return ["list", "--prod", "--json", "--depth", "Infinity"];
@@ -64,17 +62,4 @@ class PnpmNodeModulesCollector extends nodeModulesCollector_1.NodeModulesCollect
64
62
  }
65
63
  }
66
64
  exports.PnpmNodeModulesCollector = PnpmNodeModulesCollector;
67
- _a = PnpmNodeModulesCollector;
68
- PnpmNodeModulesCollector.pmCommand = new lazy_val_1.Lazy(async () => {
69
- if (process.platform === "win32") {
70
- try {
71
- await (0, builder_util_1.exec)("pnpm", ["--version"]);
72
- }
73
- catch (_error) {
74
- builder_util_1.log.debug(null, "pnpm not detected, falling back to pnpm.cmd");
75
- return "pnpm.cmd";
76
- }
77
- }
78
- return "pnpm";
79
- });
80
65
  //# sourceMappingURL=pnpmNodeModulesCollector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pnpmNodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/pnpmNodeModulesCollector.ts"],"names":[],"mappings":";;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KAAK,CAAC,CAAA;QACpC,CAAC;QAED,8CAA8C;QAC9C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,EAAE,CAAC;YAC3E,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAA;YAC1D,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;IAES,qBAAqB,CAAC,QAAgB;QAC9C,MAAM,cAAc,GAAqB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC7D,4CAA4C;QAC5C,OAAO,cAAc,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;;AA7EH,4DA8EC;;AAzEiB,kCAAS,GAAG,IAAI,eAAI,CAAS,KAAK,IAAI,EAAE;IACtD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,MAAM,IAAA,mBAAI,EAAC,MAAM,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;QACnC,CAAC;QAAC,OAAO,MAAW,EAAE,CAAC;YACrB,kBAAG,CAAC,KAAK,CAAC,IAAI,EAAE,6CAA6C,CAAC,CAAA;YAC9D,OAAO,UAAU,CAAA;QACnB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAC,AAVuB,CAUvB","sourcesContent":["import { Lazy } from \"lazy-val\"\nimport { NodeModulesCollector } from \"./nodeModulesCollector\"\nimport { PnpmDependency, Dependency } from \"./types\"\nimport { exec, log } from \"builder-util\"\nimport * as path from \"path\"\nimport * as fs from \"fs\"\n\nexport class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmDependency, PnpmDependency> {\n constructor(rootDir: string) {\n super(rootDir)\n }\n\n static readonly pmCommand = new Lazy<string>(async () => {\n if (process.platform === \"win32\") {\n try {\n await exec(\"pnpm\", [\"--version\"])\n } catch (_error: any) {\n log.debug(null, \"pnpm not detected, falling back to pnpm.cmd\")\n return \"pnpm.cmd\"\n }\n }\n return \"pnpm\"\n })\n\n protected readonly pmCommand: Lazy<string> = PnpmNodeModulesCollector.pmCommand\n public readonly installOptions = this.pmCommand.value.then(cmd => ({ cmd, args: [\"install\", \"--frozen-lockfile\"], lockfile: \"pnpm-lock.yaml\" }))\n\n protected getArgs(): string[] {\n return [\"list\", \"--prod\", \"--json\", \"--depth\", \"Infinity\"]\n }\n\n extractProductionDependencyGraph(tree: PnpmDependency, dependencyId: string): void {\n if (this.productionGraph[dependencyId]) {\n return\n }\n\n const p = path.normalize(this.resolvePath(tree.path))\n const packageJson: Dependency<string, string> = require(path.join(p, \"package.json\"))\n const prodDependencies = { ...packageJson.dependencies, ...packageJson.optionalDependencies }\n\n const deps = { ...(tree.dependencies || {}), ...(tree.optionalDependencies || {}) }\n this.productionGraph[dependencyId] = { dependencies: [] }\n const dependencies = Object.entries(deps)\n .filter(([packageName, dependency]) => {\n // First check if it's in production dependencies\n if (!prodDependencies[packageName]) {\n return false\n }\n\n // Then check if optional dependency path exists\n if (packageJson.optionalDependencies && packageJson.optionalDependencies[packageName] && !fs.existsSync(dependency.path)) {\n log.debug(null, `Optional dependency ${packageName}@${dependency.version} path doesn't exist: ${dependency.path}`)\n return false\n }\n\n return true\n })\n .map(([packageName, dependency]) => {\n const childDependencyId = `${packageName}@${dependency.version}`\n this.extractProductionDependencyGraph(dependency, childDependencyId)\n return childDependencyId\n })\n\n this.productionGraph[dependencyId] = { dependencies }\n }\n\n protected collectAllDependencies(tree: PnpmDependency) {\n // Collect regular dependencies\n for (const [key, value] of Object.entries(tree.dependencies || {})) {\n this.allDependencies.set(`${key}@${value.version}`, value)\n this.collectAllDependencies(value)\n }\n\n // Collect optional dependencies if they exist\n for (const [key, value] of Object.entries(tree.optionalDependencies || {})) {\n this.allDependencies.set(`${key}@${value.version}`, value)\n this.collectAllDependencies(value)\n }\n }\n\n protected parseDependenciesTree(jsonBlob: string): PnpmDependency {\n const dependencyTree: PnpmDependency[] = JSON.parse(jsonBlob)\n // pnpm returns an array of dependency trees\n return dependencyTree[0]\n }\n}\n"]}
1
+ {"version":3,"file":"pnpmNodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/pnpmNodeModulesCollector.ts"],"names":[],"mappings":";;;AAAA,+CAAkC;AAClC,yBAAwB;AACxB,6BAA4B;AAC5B,iEAA6D;AAC7D,qDAAqC;AAGrC,MAAa,wBAAyB,SAAQ,2CAAoD;IAChG,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QAGA,mBAAc,GAAG,EAAE,OAAO,EAAE,mBAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA;IAFjF,CAAC;IAIS,OAAO;QACf,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAA;IAC5D,CAAC;IAED,gCAAgC,CAAC,IAAoB,EAAE,YAAoB;QACzE,IAAI,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;YACvC,OAAM;QACR,CAAC;QAED,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QACrD,MAAM,WAAW,GAA+B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAA;QACrF,MAAM,gBAAgB,GAAG,EAAE,GAAG,WAAW,CAAC,YAAY,EAAE,GAAG,WAAW,CAAC,oBAAoB,EAAE,CAAA;QAE7F,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,EAAE,CAAA;QAC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,GAAG,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAA;YAC1D,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAA;QACpC,CAAC;QAED,8CAA8C;QAC9C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,EAAE,CAAC;YAC3E,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAA;YAC1D,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;IAES,qBAAqB,CAAC,QAAgB;QAC9C,MAAM,cAAc,GAAqB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC7D,4CAA4C;QAC5C,OAAO,cAAc,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CACF;AAjED,4DAiEC","sourcesContent":["import { log } from \"builder-util\"\nimport * as fs from \"fs\"\nimport * as path from \"path\"\nimport { NodeModulesCollector } from \"./nodeModulesCollector\"\nimport { PM } from \"./packageManager\"\nimport { Dependency, PnpmDependency } from \"./types\"\n\nexport class PnpmNodeModulesCollector extends NodeModulesCollector<PnpmDependency, PnpmDependency> {\n constructor(rootDir: string) {\n super(rootDir)\n }\n\n public readonly installOptions = { manager: PM.PNPM, lockfile: \"pnpm-lock.yaml\" }\n\n protected getArgs(): string[] {\n return [\"list\", \"--prod\", \"--json\", \"--depth\", \"Infinity\"]\n }\n\n extractProductionDependencyGraph(tree: PnpmDependency, dependencyId: string): void {\n if (this.productionGraph[dependencyId]) {\n return\n }\n\n const p = path.normalize(this.resolvePath(tree.path))\n const packageJson: Dependency<string, string> = require(path.join(p, \"package.json\"))\n const prodDependencies = { ...packageJson.dependencies, ...packageJson.optionalDependencies }\n\n const deps = { ...(tree.dependencies || {}), ...(tree.optionalDependencies || {}) }\n this.productionGraph[dependencyId] = { dependencies: [] }\n const dependencies = Object.entries(deps)\n .filter(([packageName, dependency]) => {\n // First check if it's in production dependencies\n if (!prodDependencies[packageName]) {\n return false\n }\n\n // Then check if optional dependency path exists\n if (packageJson.optionalDependencies && packageJson.optionalDependencies[packageName] && !fs.existsSync(dependency.path)) {\n log.debug(null, `Optional dependency ${packageName}@${dependency.version} path doesn't exist: ${dependency.path}`)\n return false\n }\n\n return true\n })\n .map(([packageName, dependency]) => {\n const childDependencyId = `${packageName}@${dependency.version}`\n this.extractProductionDependencyGraph(dependency, childDependencyId)\n return childDependencyId\n })\n\n this.productionGraph[dependencyId] = { dependencies }\n }\n\n protected collectAllDependencies(tree: PnpmDependency) {\n // Collect regular dependencies\n for (const [key, value] of Object.entries(tree.dependencies || {})) {\n this.allDependencies.set(`${key}@${value.version}`, value)\n this.collectAllDependencies(value)\n }\n\n // Collect optional dependencies if they exist\n for (const [key, value] of Object.entries(tree.optionalDependencies || {})) {\n this.allDependencies.set(`${key}@${value.version}`, value)\n this.collectAllDependencies(value)\n }\n }\n\n protected parseDependenciesTree(jsonBlob: string): PnpmDependency {\n const dependencyTree: PnpmDependency[] = JSON.parse(jsonBlob)\n // pnpm returns an array of dependency trees\n return dependencyTree[0]\n }\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import { NpmNodeModulesCollector } from "./npmNodeModulesCollector";
2
+ import { PM } from "./packageManager";
2
3
  export declare class YarnNodeModulesCollector extends NpmNodeModulesCollector {
3
4
  constructor(rootDir: string);
4
- readonly installOptions: Promise<{
5
- cmd: string;
6
- args: string[];
5
+ readonly installOptions: {
6
+ manager: PM;
7
7
  lockfile: string;
8
- }>;
8
+ };
9
9
  }
@@ -2,14 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.YarnNodeModulesCollector = void 0;
4
4
  const npmNodeModulesCollector_1 = require("./npmNodeModulesCollector");
5
+ const packageManager_1 = require("./packageManager");
5
6
  class YarnNodeModulesCollector extends npmNodeModulesCollector_1.NpmNodeModulesCollector {
6
7
  constructor(rootDir) {
7
8
  super(rootDir);
8
- this.installOptions = Promise.resolve({
9
- cmd: process.platform === "win32" ? "yarn.cmd" : "yarn",
10
- args: ["install", "--frozen-lockfile"],
11
- lockfile: "yarn.lock",
12
- });
9
+ // note: do not override instance-var `pmCommand`. We explicitly use npm for the json payload
10
+ this.installOptions = { manager: packageManager_1.PM.YARN, lockfile: "yarn.lock" };
13
11
  }
14
12
  }
15
13
  exports.YarnNodeModulesCollector = YarnNodeModulesCollector;
@@ -1 +1 @@
1
- {"version":3,"file":"yarnNodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/yarnNodeModulesCollector.ts"],"names":[],"mappings":";;;AAAA,uEAAmE;AAEnE,MAAa,wBAAyB,SAAQ,iDAAuB;IACnE,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QAGA,mBAAc,GAAG,OAAO,CAAC,OAAO,CAAC;YAC/C,GAAG,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM;YACvD,IAAI,EAAE,CAAC,SAAS,EAAE,mBAAmB,CAAC;YACtC,QAAQ,EAAE,WAAW;SACtB,CAAC,CAAA;IANF,CAAC;CAOF;AAVD,4DAUC","sourcesContent":["import { NpmNodeModulesCollector } from \"./npmNodeModulesCollector\"\n\nexport class YarnNodeModulesCollector extends NpmNodeModulesCollector {\n constructor(rootDir: string) {\n super(rootDir)\n }\n\n public readonly installOptions = Promise.resolve({\n cmd: process.platform === \"win32\" ? \"yarn.cmd\" : \"yarn\",\n args: [\"install\", \"--frozen-lockfile\"],\n lockfile: \"yarn.lock\",\n })\n}\n"]}
1
+ {"version":3,"file":"yarnNodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/yarnNodeModulesCollector.ts"],"names":[],"mappings":";;;AAAA,uEAAmE;AACnE,qDAAqC;AAErC,MAAa,wBAAyB,SAAQ,iDAAuB;IACnE,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QAGhB,6FAA6F;QAC7E,mBAAc,GAAG,EAAE,OAAO,EAAE,mBAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;IAH5E,CAAC;CAIF;AAPD,4DAOC","sourcesContent":["import { NpmNodeModulesCollector } from \"./npmNodeModulesCollector\"\nimport { PM } from \"./packageManager\"\n\nexport class YarnNodeModulesCollector extends NpmNodeModulesCollector {\n constructor(rootDir: string) {\n super(rootDir)\n }\n\n // note: do not override instance-var `pmCommand`. We explicitly use npm for the json payload\n public readonly installOptions = { manager: PM.YARN, lockfile: \"yarn.lock\" }\n}\n"]}
@@ -44,7 +44,10 @@ export interface WindowsConfiguration extends PlatformSpecificBuildOptions {
44
44
  */
45
45
  readonly requestedExecutionLevel?: RequestedExecutionLevel | null;
46
46
  /**
47
- * Whether to sign and add metadata to executable. Advanced option.
47
+ * Whether to sign and add metadata to executable.
48
+ * Metadata includes information about the app name/description/version, publisher, copyright, etc.
49
+ * This property also is responsible for adding the app icon and setting execution level.
50
+ * (Advanced option leveraging `rcedit`)
48
51
  * @default true
49
52
  */
50
53
  readonly signAndEditExecutable?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"winOptions.js","sourceRoot":"","sources":["../../src/options/winOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { Nullish } from \"builder-util-runtime\"\nimport { CustomWindowsSign } from \"../codeSign/windowsSignToolManager\"\nimport { PlatformSpecificBuildOptions, TargetConfigType } from \"../index\"\n\nexport interface WindowsConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable]./nsis.md#portable) app without installation), `appx`, `msi`, `msi-wrapped`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * AppX package can be built only on Windows 10.\n *\n * To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.\n *\n * @default nsis\n */\n readonly target?: TargetConfigType\n\n /**\n * The path to application icon.\n * @default build/icon.ico\n */\n readonly icon?: string | null\n\n /**\n * The trademarks and registered trademarks.\n */\n readonly legalTrademarks?: string | null\n\n /**\n * Options for usage with signtool.exe\n * Cannot be used in conjunction with `azureSignOptions`, signing will default to Azure Trusted Signing\n */\n readonly signtoolOptions?: WindowsSigntoolConfiguration | null\n\n /**\n * Options for usage of Azure Trusted Signing (beta)\n * Cannot be used in conjunction with `signtoolOptions`, signing will default to Azure Trusted Signing\n */\n readonly azureSignOptions?: WindowsAzureSigningConfiguration | null\n\n /**\n * Whether to verify the signature of an available update before installation.\n * The [publisher name](#publisherName) will be used for the signature verification.\n *\n * @default true\n */\n readonly verifyUpdateCodeSignature?: boolean\n\n /**\n * The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed.\n * Cannot be specified per target, allowed only in the `win`.\n * @default asInvoker\n */\n readonly requestedExecutionLevel?: RequestedExecutionLevel | null\n\n /**\n * Whether to sign and add metadata to executable. Advanced option.\n * @default true\n */\n readonly signAndEditExecutable?: boolean\n\n /**\n * Explicit file extensions to also sign. Advanced option.\n * @see https://github.com/electron-userland/electron-builder/issues/7329\n * @default null\n */\n readonly signExts?: string[] | null\n}\n\nexport type RequestedExecutionLevel = \"asInvoker\" | \"highestAvailable\" | \"requireAdministrator\"\n\nexport interface WindowsSigntoolConfiguration {\n /**\n * The custom function (or path to file or module id) to sign Windows executables\n */\n readonly sign?: CustomWindowsSign | string | null\n\n /**\n * Array of signing algorithms used. For AppX `sha256` is always used.\n * @default ['sha1', 'sha256']\n */\n readonly signingHashAlgorithms?: Array<\"sha1\" | \"sha256\"> | null\n\n /**\n * The path to the *.pfx certificate you want to sign with. Please use it only if you cannot use env variable `CSC_LINK` (`WIN_CSC_LINK`) for some reason.\n * Please see [Code Signing](./code-signing.md).\n */\n readonly certificateFile?: string | null\n\n /**\n * The password to the certificate provided in `certificateFile`. Please use it only if you cannot use env variable `CSC_KEY_PASSWORD` (`WIN_CSC_KEY_PASSWORD`) for some reason.\n * Please see [Code Signing](./code-signing.md).\n */\n readonly certificatePassword?: string | null\n\n /**\n * The name of the subject of the signing certificate, which is often labeled with the field name `issued to`. Required only for EV Code Signing and works only on Windows (or on macOS if [Parallels Desktop](https://www.parallels.com/products/desktop/) Windows 10 virtual machines exits).\n */\n readonly certificateSubjectName?: string | null\n\n /**\n * The SHA1 hash of the signing certificate. The SHA1 hash is commonly specified when multiple certificates satisfy the criteria specified by the remaining switches. Works only on Windows (or on macOS if [Parallels Desktop](https://www.parallels.com/products/desktop/) Windows 10 virtual machines exits).\n */\n readonly certificateSha1?: string | null\n\n /**\n * The path to an additional certificate file you want to add to the signature block.\n */\n readonly additionalCertificateFile?: string | null\n\n /**\n * The URL of the RFC 3161 time stamp server.\n * @default http://timestamp.digicert.com\n */\n readonly rfc3161TimeStampServer?: string | null\n\n /**\n * The URL of the time stamp server.\n * @default http://timestamp.digicert.com\n */\n readonly timeStampServer?: string | null\n\n /**\n * [The publisher name](https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073), exactly as in your code signed certificate. Several names can be provided.\n * Defaults to common name from your code signing certificate.\n */\n readonly publisherName?: string | Array<string> | null\n}\n\n// https://learn.microsoft.com/en-us/azure/trusted-signing/how-to-signing-integrations\nexport interface WindowsAzureSigningConfiguration {\n /**\n * [The publisher name](https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073), exactly as in your code signed certificate. Several names can be provided.\n */\n readonly publisherName: string\n /**\n * The Trusted Signing Account endpoint. The URI value must have a URI that aligns to the\n * region your Trusted Signing Account and Certificate Profile you are specifying were created\n * in during the setup of these resources.\n *\n * Translates to field: Endpoint\n *\n * Requires one of environment variable configurations for authenticating to Microsoft Entra ID per [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition)\n */\n readonly endpoint: string\n /**\n * The Certificate Profile name. Translates to field: CertificateProfileName\n */\n readonly certificateProfileName: string\n /**\n * The Code Signing Signing Account name. Translates to field: CodeSigningAccountName\n */\n readonly codeSigningAccountName: string\n /**\n * The File Digest for signing each file. Translates to field: FileDigest\n * @default SHA256\n */\n readonly fileDigest?: string\n /**\n * The Timestamp rfc3161 server. Translates to field: TimestampRfc3161\n * @default http://timestamp.acs.microsoft.com\n */\n readonly timestampRfc3161?: string\n /**\n * The Timestamp Digest. Translates to field: TimestampDigest\n * @default SHA256\n */\n readonly timestampDigest?: string\n /**\n * Allow other CLI parameters (verbatim case-sensitive) to `Invoke-TrustedSigning`\n * Note: Key-Value pairs with `undefined`/`null` value are filtered out of the command.\n */\n [k: string]: string | Nullish\n}\n"]}
1
+ {"version":3,"file":"winOptions.js","sourceRoot":"","sources":["../../src/options/winOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { Nullish } from \"builder-util-runtime\"\nimport { CustomWindowsSign } from \"../codeSign/windowsSignToolManager\"\nimport { PlatformSpecificBuildOptions, TargetConfigType } from \"../index\"\n\nexport interface WindowsConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable]./nsis.md#portable) app without installation), `appx`, `msi`, `msi-wrapped`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * AppX package can be built only on Windows 10.\n *\n * To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.\n *\n * @default nsis\n */\n readonly target?: TargetConfigType\n\n /**\n * The path to application icon.\n * @default build/icon.ico\n */\n readonly icon?: string | null\n\n /**\n * The trademarks and registered trademarks.\n */\n readonly legalTrademarks?: string | null\n\n /**\n * Options for usage with signtool.exe\n * Cannot be used in conjunction with `azureSignOptions`, signing will default to Azure Trusted Signing\n */\n readonly signtoolOptions?: WindowsSigntoolConfiguration | null\n\n /**\n * Options for usage of Azure Trusted Signing (beta)\n * Cannot be used in conjunction with `signtoolOptions`, signing will default to Azure Trusted Signing\n */\n readonly azureSignOptions?: WindowsAzureSigningConfiguration | null\n\n /**\n * Whether to verify the signature of an available update before installation.\n * The [publisher name](#publisherName) will be used for the signature verification.\n *\n * @default true\n */\n readonly verifyUpdateCodeSignature?: boolean\n\n /**\n * The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed.\n * Cannot be specified per target, allowed only in the `win`.\n * @default asInvoker\n */\n readonly requestedExecutionLevel?: RequestedExecutionLevel | null\n\n /**\n * Whether to sign and add metadata to executable.\n * Metadata includes information about the app name/description/version, publisher, copyright, etc.\n * This property also is responsible for adding the app icon and setting execution level.\n * (Advanced option leveraging `rcedit`)\n * @default true\n */\n readonly signAndEditExecutable?: boolean\n\n /**\n * Explicit file extensions to also sign. Advanced option.\n * @see https://github.com/electron-userland/electron-builder/issues/7329\n * @default null\n */\n readonly signExts?: string[] | null\n}\n\nexport type RequestedExecutionLevel = \"asInvoker\" | \"highestAvailable\" | \"requireAdministrator\"\n\nexport interface WindowsSigntoolConfiguration {\n /**\n * The custom function (or path to file or module id) to sign Windows executables\n */\n readonly sign?: CustomWindowsSign | string | null\n\n /**\n * Array of signing algorithms used. For AppX `sha256` is always used.\n * @default ['sha1', 'sha256']\n */\n readonly signingHashAlgorithms?: Array<\"sha1\" | \"sha256\"> | null\n\n /**\n * The path to the *.pfx certificate you want to sign with. Please use it only if you cannot use env variable `CSC_LINK` (`WIN_CSC_LINK`) for some reason.\n * Please see [Code Signing](./code-signing.md).\n */\n readonly certificateFile?: string | null\n\n /**\n * The password to the certificate provided in `certificateFile`. Please use it only if you cannot use env variable `CSC_KEY_PASSWORD` (`WIN_CSC_KEY_PASSWORD`) for some reason.\n * Please see [Code Signing](./code-signing.md).\n */\n readonly certificatePassword?: string | null\n\n /**\n * The name of the subject of the signing certificate, which is often labeled with the field name `issued to`. Required only for EV Code Signing and works only on Windows (or on macOS if [Parallels Desktop](https://www.parallels.com/products/desktop/) Windows 10 virtual machines exits).\n */\n readonly certificateSubjectName?: string | null\n\n /**\n * The SHA1 hash of the signing certificate. The SHA1 hash is commonly specified when multiple certificates satisfy the criteria specified by the remaining switches. Works only on Windows (or on macOS if [Parallels Desktop](https://www.parallels.com/products/desktop/) Windows 10 virtual machines exits).\n */\n readonly certificateSha1?: string | null\n\n /**\n * The path to an additional certificate file you want to add to the signature block.\n */\n readonly additionalCertificateFile?: string | null\n\n /**\n * The URL of the RFC 3161 time stamp server.\n * @default http://timestamp.digicert.com\n */\n readonly rfc3161TimeStampServer?: string | null\n\n /**\n * The URL of the time stamp server.\n * @default http://timestamp.digicert.com\n */\n readonly timeStampServer?: string | null\n\n /**\n * [The publisher name](https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073), exactly as in your code signed certificate. Several names can be provided.\n * Defaults to common name from your code signing certificate.\n */\n readonly publisherName?: string | Array<string> | null\n}\n\n// https://learn.microsoft.com/en-us/azure/trusted-signing/how-to-signing-integrations\nexport interface WindowsAzureSigningConfiguration {\n /**\n * [The publisher name](https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073), exactly as in your code signed certificate. Several names can be provided.\n */\n readonly publisherName: string\n /**\n * The Trusted Signing Account endpoint. The URI value must have a URI that aligns to the\n * region your Trusted Signing Account and Certificate Profile you are specifying were created\n * in during the setup of these resources.\n *\n * Translates to field: Endpoint\n *\n * Requires one of environment variable configurations for authenticating to Microsoft Entra ID per [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition)\n */\n readonly endpoint: string\n /**\n * The Certificate Profile name. Translates to field: CertificateProfileName\n */\n readonly certificateProfileName: string\n /**\n * The Code Signing Signing Account name. Translates to field: CodeSigningAccountName\n */\n readonly codeSigningAccountName: string\n /**\n * The File Digest for signing each file. Translates to field: FileDigest\n * @default SHA256\n */\n readonly fileDigest?: string\n /**\n * The Timestamp rfc3161 server. Translates to field: TimestampRfc3161\n * @default http://timestamp.acs.microsoft.com\n */\n readonly timestampRfc3161?: string\n /**\n * The Timestamp Digest. Translates to field: TimestampDigest\n * @default SHA256\n */\n readonly timestampDigest?: string\n /**\n * Allow other CLI parameters (verbatim case-sensitive) to `Invoke-TrustedSigning`\n * Note: Key-Value pairs with `undefined`/`null` value are filtered out of the command.\n */\n [k: string]: string | Nullish\n}\n"]}
package/out/packager.js CHANGED
@@ -4,7 +4,7 @@ exports.Packager = void 0;
4
4
  const builder_util_1 = require("builder-util");
5
5
  const builder_util_runtime_1 = require("builder-util-runtime");
6
6
  const fs_extra_1 = require("fs-extra");
7
- const isCI = require("is-ci");
7
+ const ci_info_1 = require("ci-info");
8
8
  const lazy_val_1 = require("lazy-val");
9
9
  const os_1 = require("os");
10
10
  const path = require("path");
@@ -295,7 +295,7 @@ class Packager {
295
295
  const commonOutDirWithoutPossibleOsMacro = path.resolve(this.projectDir, (0, macroExpander_1.expandMacro)(this.config.directories.output, null, this._appInfo, {
296
296
  os: "",
297
297
  }));
298
- if (!isCI && process.stdout.isTTY) {
298
+ if (!ci_info_1.isCI && process.stdout.isTTY) {
299
299
  const effectiveConfigFile = path.join(commonOutDirWithoutPossibleOsMacro, "builder-effective-config.yaml");
300
300
  builder_util_1.log.info({ file: builder_util_1.log.filePath(effectiveConfigFile) }, "writing effective config");
301
301
  await (0, fs_extra_1.outputFile)(effectiveConfigFile, getSafeEffectiveConfig(this.config));