app-builder-lib 26.0.0-alpha.5 → 26.0.0-alpha.6
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.
- package/out/asar/asarUtil.js +56 -41
- package/out/asar/asarUtil.js.map +1 -1
- package/out/options/linuxOptions.d.ts +10 -0
- package/out/options/linuxOptions.js.map +1 -1
- package/out/platformPackager.js +2 -2
- package/out/platformPackager.js.map +1 -1
- package/out/targets/FpmTarget.js +12 -8
- package/out/targets/FpmTarget.js.map +1 -1
- package/out/version.d.ts +1 -1
- package/out/version.js +1 -1
- package/out/version.js.map +1 -1
- package/package.json +8 -8
- package/scheme.json +18 -0
- package/templates/linux/after-install.tpl +27 -0
- package/templates/linux/after-remove.tpl +7 -0
- package/templates/linux/apparmor-profile.tpl +9 -0
package/out/asar/asarUtil.js
CHANGED
|
@@ -3,33 +3,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AsarPackager = void 0;
|
|
4
4
|
const asar_1 = require("@electron/asar");
|
|
5
5
|
const builder_util_1 = require("builder-util");
|
|
6
|
-
const builder_util_runtime_1 = require("builder-util-runtime");
|
|
7
6
|
const fs_1 = require("builder-util/out/fs");
|
|
8
|
-
const fsNode = require("fs");
|
|
9
7
|
const fs = require("fs-extra");
|
|
8
|
+
const fs_extra_1 = require("fs-extra");
|
|
9
|
+
const os_1 = require("os");
|
|
10
10
|
const path = require("path");
|
|
11
|
-
const tempFile = require("temp-file");
|
|
12
11
|
const appFileCopier_1 = require("../util/appFileCopier");
|
|
13
12
|
const unpackDetector_1 = require("./unpackDetector");
|
|
14
13
|
/** @internal */
|
|
15
14
|
class AsarPackager {
|
|
16
|
-
constructor(config) {
|
|
15
|
+
constructor(packager, config) {
|
|
16
|
+
this.packager = packager;
|
|
17
17
|
this.config = config;
|
|
18
|
-
this.
|
|
18
|
+
this.fileCopier = new fs_1.FileCopier();
|
|
19
19
|
this.outFile = path.join(config.resourcePath, `app.asar`);
|
|
20
|
+
this.tmpDir = packager.info.tempDirManager;
|
|
21
|
+
this.cancellationToken = packager.info.cancellationToken;
|
|
20
22
|
}
|
|
21
|
-
async pack(fileSets
|
|
23
|
+
async pack(fileSets) {
|
|
22
24
|
this.rootForAppFilesWithoutAsar = await this.tmpDir.getTempDir({ prefix: "asar-app" });
|
|
23
|
-
const cancellationToken = new builder_util_runtime_1.CancellationToken();
|
|
24
|
-
cancellationToken.on("cancel", () => this.tmpDir.cleanupSync());
|
|
25
25
|
const orderedFileSets = [
|
|
26
26
|
// Write dependencies first to minimize offset changes to asar header
|
|
27
27
|
...fileSets.slice(1),
|
|
28
28
|
// Finish with the app files that change most often
|
|
29
29
|
fileSets[0],
|
|
30
30
|
].map(orderFileSet);
|
|
31
|
-
const { unpackedPaths, copiedFiles } = await this.detectAndCopy(orderedFileSets
|
|
31
|
+
const { unpackedPaths, copiedFiles } = await this.detectAndCopy(orderedFileSets);
|
|
32
32
|
const unpackGlob = unpackedPaths.length > 1 ? `{${unpackedPaths.join(",")}}` : unpackedPaths.pop();
|
|
33
|
+
await this.executeElectronAsar(copiedFiles, unpackGlob);
|
|
34
|
+
}
|
|
35
|
+
async executeElectronAsar(copiedFiles, unpackGlob) {
|
|
33
36
|
let ordering = this.config.options.ordering || undefined;
|
|
34
37
|
if (!ordering) {
|
|
35
38
|
// `copiedFiles` are already ordered due to `orderedFileSets` input, so we just map to their relative paths (via substring) within the asar.
|
|
@@ -53,13 +56,15 @@ class AsarPackager {
|
|
|
53
56
|
};
|
|
54
57
|
await (0, asar_1.createPackageWithOptions)(this.rootForAppFilesWithoutAsar, this.outFile, options);
|
|
55
58
|
console.log = consoleLogger;
|
|
56
|
-
await this.tmpDir.cleanup();
|
|
57
59
|
}
|
|
58
|
-
async detectAndCopy(fileSets
|
|
60
|
+
async detectAndCopy(fileSets) {
|
|
59
61
|
var _a;
|
|
60
|
-
const taskManager = new builder_util_1.AsyncTaskManager(cancellationToken);
|
|
62
|
+
const taskManager = new builder_util_1.AsyncTaskManager(this.cancellationToken);
|
|
61
63
|
const unpackedPaths = new Set();
|
|
62
64
|
const copiedFiles = new Set();
|
|
65
|
+
const createdSourceDirs = new Set();
|
|
66
|
+
const links = [];
|
|
67
|
+
const symlinkType = (0, os_1.platform)() === "win32" ? "junction" : "file";
|
|
63
68
|
const matchUnpacker = (file, dest, stat) => {
|
|
64
69
|
var _a, _b;
|
|
65
70
|
if ((_b = (_a = this.config).unpackPattern) === null || _b === void 0 ? void 0 : _b.call(_a, file, stat)) {
|
|
@@ -68,61 +73,71 @@ class AsarPackager {
|
|
|
68
73
|
return;
|
|
69
74
|
}
|
|
70
75
|
};
|
|
71
|
-
const
|
|
72
|
-
const { transformedData, file
|
|
76
|
+
const writeFileOrProcessSymlink = async (options) => {
|
|
77
|
+
const { transformedData, file, destination, stat, fileSet } = options;
|
|
78
|
+
if (!stat.isFile() && !stat.isSymbolicLink()) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
73
81
|
copiedFiles.add(destination);
|
|
74
|
-
|
|
75
|
-
if (
|
|
76
|
-
|
|
82
|
+
const dir = path.dirname(destination);
|
|
83
|
+
if (!createdSourceDirs.has(dir)) {
|
|
84
|
+
await (0, fs_extra_1.mkdir)(dir, { recursive: true });
|
|
85
|
+
createdSourceDirs.add(dir);
|
|
77
86
|
}
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
return
|
|
87
|
+
// write any data if provided, skip symlink check
|
|
88
|
+
if (transformedData != null) {
|
|
89
|
+
return fs.writeFile(destination, transformedData, { mode: stat.mode });
|
|
81
90
|
}
|
|
82
|
-
const
|
|
91
|
+
const realPathFile = await fs.realpath(file);
|
|
92
|
+
const realPathRelative = path.relative(fileSet.src, realPathFile);
|
|
83
93
|
const isOutsidePackage = realPathRelative.startsWith("..");
|
|
84
94
|
if (isOutsidePackage) {
|
|
85
|
-
builder_util_1.log.error({ source: builder_util_1.log.filePath(
|
|
86
|
-
throw new Error(`Cannot copy file (${path.basename(
|
|
95
|
+
builder_util_1.log.error({ source: builder_util_1.log.filePath(file), realPathFile: builder_util_1.log.filePath(realPathFile) }, `unable to copy, file is symlinked outside the package`);
|
|
96
|
+
throw new Error(`Cannot copy file (${path.basename(file)}) symlinked to file (${path.basename(realPathFile)}) outside the package as that violates asar security integrity`);
|
|
87
97
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
// not a symlink, copy directly
|
|
99
|
+
if (file === realPathFile) {
|
|
100
|
+
return this.fileCopier.copy(file, destination, stat);
|
|
101
|
+
}
|
|
102
|
+
// okay, it must be a symlink. evaluate link to be relative to source file in asar
|
|
103
|
+
let link = await (0, fs_extra_1.readlink)(file);
|
|
104
|
+
if (path.isAbsolute(link)) {
|
|
105
|
+
link = path.relative(path.dirname(file), link);
|
|
106
|
+
}
|
|
107
|
+
links.push({ file: destination, link });
|
|
93
108
|
};
|
|
94
109
|
for await (const fileSet of fileSets) {
|
|
95
110
|
if (this.config.options.smartUnpack !== false) {
|
|
96
111
|
(0, unpackDetector_1.detectUnpackedDirs)(fileSet, unpackedPaths, this.config.defaultDestination);
|
|
97
112
|
}
|
|
113
|
+
// Don't use BluebirdPromise, we need to retain order of execution/iteration through the ordered fileset
|
|
98
114
|
for (let i = 0; i < fileSet.files.length; i++) {
|
|
99
115
|
const file = fileSet.files[i];
|
|
100
116
|
const transformedData = (_a = fileSet.transformedFiles) === null || _a === void 0 ? void 0 : _a.get(i);
|
|
101
|
-
const
|
|
117
|
+
const stat = fileSet.metadata.get(file);
|
|
102
118
|
const relative = path.relative(this.config.defaultDestination, (0, appFileCopier_1.getDestinationPath)(file, fileSet));
|
|
103
|
-
const
|
|
104
|
-
matchUnpacker(file,
|
|
105
|
-
taskManager.addTask(
|
|
119
|
+
const destination = path.resolve(this.rootForAppFilesWithoutAsar, relative);
|
|
120
|
+
matchUnpacker(file, destination, stat);
|
|
121
|
+
taskManager.addTask(writeFileOrProcessSymlink({ transformedData, file, destination, stat, fileSet }));
|
|
106
122
|
if (taskManager.tasks.length > fs_1.MAX_FILE_REQUESTS) {
|
|
107
123
|
await taskManager.awaitTasks();
|
|
108
124
|
}
|
|
109
125
|
}
|
|
110
126
|
}
|
|
127
|
+
// finish copy then set up all symlinks
|
|
128
|
+
await taskManager.awaitTasks();
|
|
129
|
+
for (const it of links) {
|
|
130
|
+
taskManager.addTask((0, fs_extra_1.symlink)(it.link, it.file, symlinkType));
|
|
131
|
+
if (taskManager.tasks.length > fs_1.MAX_FILE_REQUESTS) {
|
|
132
|
+
await taskManager.awaitTasks();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
111
135
|
await taskManager.awaitTasks();
|
|
112
136
|
return {
|
|
113
137
|
unpackedPaths: Array.from(unpackedPaths),
|
|
114
138
|
copiedFiles: Array.from(copiedFiles),
|
|
115
139
|
};
|
|
116
140
|
}
|
|
117
|
-
async copyFileOrData(data, source, destination, stat) {
|
|
118
|
-
await fs.mkdir(path.dirname(destination), { recursive: true });
|
|
119
|
-
if (data) {
|
|
120
|
-
await fs.writeFile(destination, data, { mode: stat.mode });
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
await fs.copyFile(source, destination);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
141
|
}
|
|
127
142
|
exports.AsarPackager = AsarPackager;
|
|
128
143
|
function orderFileSet(fileSet) {
|
package/out/asar/asarUtil.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asarUtil.js","sourceRoot":"","sources":["../../src/asar/asarUtil.ts"],"names":[],"mappings":";;;AAAA,yCAAwE;AACxE,+CAAoD;AACpD,+DAAwD;AACxD,4CAA+D;AAC/D,6BAA4B;AAC5B,+BAA8B;AAC9B,6BAA4B;AAC5B,sCAAqC;AAGrC,yDAA2E;AAC3E,qDAAqD;AAErD,gBAAgB;AAChB,MAAa,YAAY;IAKvB,YACmB,MAKhB;QALgB,WAAM,GAAN,MAAM,CAKtB;QARc,WAAM,G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GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YACvC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;gBACpC,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,+BAA+B,CAAC,CAAA;YACzE,CAAC;YAED,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;IAED,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAE9C,OAAO;QACL,GAAG;QACH,WAAW;QACX,QAAQ;QACR,KAAK,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;QAChD,gBAAgB;KACjB,CAAA;AACH,CAAC","sourcesContent":["import { CreateOptions, createPackageWithOptions } from \"@electron/asar\"\nimport { AsyncTaskManager, log } from \"builder-util\"\nimport { CancellationToken } from \"builder-util-runtime\"\nimport { Filter, MAX_FILE_REQUESTS } from \"builder-util/out/fs\"\nimport * as fsNode from \"fs\"\nimport * as fs from \"fs-extra\"\nimport * as path from \"path\"\nimport * as tempFile from \"temp-file\"\nimport { AsarOptions } from \"../options/PlatformSpecificBuildOptions\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { ResolvedFileSet, getDestinationPath } from \"../util/appFileCopier\"\nimport { detectUnpackedDirs } from \"./unpackDetector\"\n\n/** @internal */\nexport class AsarPackager {\n private readonly outFile: string\n private rootForAppFilesWithoutAsar!: string\n private readonly tmpDir = new tempFile.TmpDir()\n\n constructor(\n private readonly config: {\n defaultDestination: string\n resourcePath: string\n options: AsarOptions\n unpackPattern: Filter | undefined\n }\n ) {\n this.outFile = path.join(config.resourcePath, `app.asar`)\n }\n\n async pack(fileSets: Array<ResolvedFileSet>, _packager: PlatformPackager<any>) {\n this.rootForAppFilesWithoutAsar = await this.tmpDir.getTempDir({ prefix: \"asar-app\" })\n\n const cancellationToken = new CancellationToken()\n cancellationToken.on(\"cancel\", () => this.tmpDir.cleanupSync())\n\n const orderedFileSets = [\n // Write dependencies first to minimize offset changes to asar header\n ...fileSets.slice(1),\n\n // Finish with the app files that change most often\n fileSets[0],\n ].map(orderFileSet)\n\n const { unpackedPaths, copiedFiles } = await this.detectAndCopy(orderedFileSets, cancellationToken)\n const unpackGlob = unpackedPaths.length > 1 ? `{${unpackedPaths.join(\",\")}}` : unpackedPaths.pop()\n\n let ordering = this.config.options.ordering || undefined\n if (!ordering) {\n // `copiedFiles` are already ordered due to `orderedFileSets` input, so we just map to their relative paths (via substring) within the asar.\n const filesSorted = copiedFiles.map(file => file.substring(this.rootForAppFilesWithoutAsar.length))\n ordering = await this.tmpDir.getTempFile({ prefix: \"asar-ordering\", suffix: \".txt\" })\n await fs.writeFile(ordering, filesSorted.join(\"\\n\"))\n }\n\n const options: CreateOptions = {\n unpack: unpackGlob,\n unpackDir: unpackGlob,\n ordering,\n dot: true,\n }\n // override logger temporarily to clean up console (electron/asar does some internal logging that blogs up the default electron-builder logs)\n const consoleLogger = console.log\n console.log = (...args) => {\n if (args[0] === \"Ordering file has 100% coverage.\") {\n return // no need to log, this means our ordering logic is working correctly\n }\n log.info({ args }, \"logging @electron/asar\")\n }\n await createPackageWithOptions(this.rootForAppFilesWithoutAsar, this.outFile, options)\n console.log = consoleLogger\n\n await this.tmpDir.cleanup()\n }\n\n private async detectAndCopy(fileSets: ResolvedFileSet[], cancellationToken: CancellationToken) {\n const taskManager = new AsyncTaskManager(cancellationToken)\n const unpackedPaths = new Set<string>()\n const copiedFiles = new Set<string>()\n\n const matchUnpacker = (file: string, dest: string, stat: fs.Stats) => {\n if (this.config.unpackPattern?.(file, stat)) {\n log.debug({ file }, \"unpacking\")\n unpackedPaths.add(dest)\n return\n }\n }\n const writeFileOrSymlink = async (options: { transformedData: string | Buffer | undefined; file: string; destination: string; stat: fs.Stats; fileSet: ResolvedFileSet }) => {\n const {\n transformedData,\n file: source,\n destination,\n stat,\n fileSet: { src: sourceDir },\n } = options\n copiedFiles.add(destination)\n\n // If transformed data, skip symlink logic\n if (transformedData) {\n return this.copyFileOrData(transformedData, source, destination, stat)\n }\n\n const realPathFile = await fs.realpath(source)\n\n if (source === realPathFile) {\n return this.copyFileOrData(undefined, source, destination, stat)\n }\n\n const realPathRelative = path.relative(sourceDir, realPathFile)\n const isOutsidePackage = realPathRelative.startsWith(\"..\")\n if (isOutsidePackage) {\n log.error({ source: log.filePath(source), realPathFile: log.filePath(realPathFile) }, `unable to copy, file is symlinked outside the package`)\n throw new Error(\n `Cannot copy file (${path.basename(source)}) symlinked to file (${path.basename(realPathFile)}) outside the package as that violates asar security integrity`\n )\n }\n\n const symlinkTarget = path.resolve(this.rootForAppFilesWithoutAsar, realPathRelative)\n await this.copyFileOrData(undefined, source, symlinkTarget, stat)\n const target = path.relative(path.dirname(destination), symlinkTarget)\n fsNode.symlinkSync(target, destination)\n\n copiedFiles.add(symlinkTarget)\n }\n\n for await (const fileSet of fileSets) {\n if (this.config.options.smartUnpack !== false) {\n detectUnpackedDirs(fileSet, unpackedPaths, this.config.defaultDestination)\n }\n for (let i = 0; i < fileSet.files.length; i++) {\n const file = fileSet.files[i]\n const transformedData = fileSet.transformedFiles?.get(i)\n const metadata = fileSet.metadata.get(file) || (await fs.lstat(file))\n\n const relative = path.relative(this.config.defaultDestination, getDestinationPath(file, fileSet))\n const dest = path.resolve(this.rootForAppFilesWithoutAsar, relative)\n\n matchUnpacker(file, dest, metadata)\n taskManager.addTask(writeFileOrSymlink({ transformedData, file, destination: dest, stat: metadata, fileSet }))\n\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n }\n await taskManager.awaitTasks()\n return {\n unpackedPaths: Array.from(unpackedPaths),\n copiedFiles: Array.from(copiedFiles),\n }\n }\n\n private async copyFileOrData(data: string | Buffer | undefined, source: string, destination: string, stat: fs.Stats) {\n await fs.mkdir(path.dirname(destination), { recursive: true })\n if (data) {\n await fs.writeFile(destination, data, { mode: stat.mode })\n } else {\n await fs.copyFile(source, destination)\n }\n }\n}\n\nfunction orderFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n const sortedFileEntries = Array.from(fileSet.files.entries())\n\n sortedFileEntries.sort(([, a], [, b]) => {\n if (a === b) {\n return 0\n }\n\n // Place addons last because their signature changes per build\n const isAAddon = a.endsWith(\".node\")\n const isBAddon = b.endsWith(\".node\")\n if (isAAddon && !isBAddon) {\n return 1\n }\n if (isBAddon && !isAAddon) {\n return -1\n }\n\n // Otherwise order by name\n return a < b ? -1 : 1\n })\n\n let transformedFiles: Map<number, string | Buffer> | undefined\n if (fileSet.transformedFiles) {\n transformedFiles = new Map()\n\n const indexMap = new Map<number, number>()\n for (const [newIndex, [oldIndex]] of sortedFileEntries.entries()) {\n indexMap.set(oldIndex, newIndex)\n }\n\n for (const [oldIndex, value] of fileSet.transformedFiles) {\n const newIndex = indexMap.get(oldIndex)\n if (newIndex === undefined) {\n const file = fileSet.files[oldIndex]\n throw new Error(`Internal error: ${file} was lost while ordering asar`)\n }\n\n transformedFiles.set(newIndex, value)\n }\n }\n\n const { src, destination, metadata } = fileSet\n\n return {\n src,\n destination,\n metadata,\n files: sortedFileEntries.map(([, file]) => file),\n transformedFiles,\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"asarUtil.js","sourceRoot":"","sources":["../../src/asar/asarUtil.ts"],"names":[],"mappings":";;;AAAA,yCAAwE;AACxE,+CAAoD;AAEpD,4CAAiF;AACjF,+BAA8B;AAC9B,uCAAmD;AACnD,2BAA6B;AAC7B,6BAA4B;AAI5B,yDAA2E;AAC3E,qDAAqD;AAErD,gBAAgB;AAChB,MAAa,YAAY;IAOvB,YACW,QAA+B,EACvB,MAKhB;QANQ,aAAQ,GAAR,QAAQ,CAAuB;QACvB,WAAM,GAAN,MAAM,CAKtB;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AC,gBAAgB,EAAE,CAAC;QAC7B,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAA;QAE5B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAA;QAC1C,KAAK,MAAM,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,EAAE,CAAC;YACjE,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAClC,CAAC;QAED,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YACzD,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YACvC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;gBACpC,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,+BAA+B,CAAC,CAAA;YACzE,CAAC;YAED,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;IAED,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAE9C,OAAO;QACL,GAAG;QACH,WAAW;QACX,QAAQ;QACR,KAAK,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;QAChD,gBAAgB;KACjB,CAAA;AACH,CAAC","sourcesContent":["import { CreateOptions, createPackageWithOptions } from \"@electron/asar\"\nimport { AsyncTaskManager, log } from \"builder-util\"\nimport { CancellationToken } from \"builder-util-runtime\"\nimport { FileCopier, Filter, Link, MAX_FILE_REQUESTS } from \"builder-util/out/fs\"\nimport * as fs from \"fs-extra\"\nimport { mkdir, readlink, symlink } from \"fs-extra\"\nimport { platform } from \"os\"\nimport * as path from \"path\"\nimport * as tempFile from \"temp-file\"\nimport { AsarOptions } from \"../options/PlatformSpecificBuildOptions\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { ResolvedFileSet, getDestinationPath } from \"../util/appFileCopier\"\nimport { detectUnpackedDirs } from \"./unpackDetector\"\n\n/** @internal */\nexport class AsarPackager {\n private readonly outFile: string\n private rootForAppFilesWithoutAsar!: string\n private readonly fileCopier = new FileCopier()\n private readonly tmpDir: tempFile.TmpDir\n private readonly cancellationToken: CancellationToken\n\n constructor(\n readonly packager: PlatformPackager<any>,\n private readonly config: {\n defaultDestination: string\n resourcePath: string\n options: AsarOptions\n unpackPattern: Filter | undefined\n }\n ) {\n this.outFile = path.join(config.resourcePath, `app.asar`)\n this.tmpDir = packager.info.tempDirManager\n this.cancellationToken = packager.info.cancellationToken\n }\n\n async pack(fileSets: Array<ResolvedFileSet>) {\n this.rootForAppFilesWithoutAsar = await this.tmpDir.getTempDir({ prefix: \"asar-app\" })\n\n const orderedFileSets = [\n // Write dependencies first to minimize offset changes to asar header\n ...fileSets.slice(1),\n\n // Finish with the app files that change most often\n fileSets[0],\n ].map(orderFileSet)\n\n const { unpackedPaths, copiedFiles } = await this.detectAndCopy(orderedFileSets)\n const unpackGlob = unpackedPaths.length > 1 ? `{${unpackedPaths.join(\",\")}}` : unpackedPaths.pop()\n\n await this.executeElectronAsar(copiedFiles, unpackGlob)\n }\n\n private async executeElectronAsar(copiedFiles: string[], unpackGlob: string | undefined) {\n let ordering = this.config.options.ordering || undefined\n if (!ordering) {\n // `copiedFiles` are already ordered due to `orderedFileSets` input, so we just map to their relative paths (via substring) within the asar.\n const filesSorted = copiedFiles.map(file => file.substring(this.rootForAppFilesWithoutAsar.length))\n ordering = await this.tmpDir.getTempFile({ prefix: \"asar-ordering\", suffix: \".txt\" })\n await fs.writeFile(ordering, filesSorted.join(\"\\n\"))\n }\n\n const options: CreateOptions = {\n unpack: unpackGlob,\n unpackDir: unpackGlob,\n ordering,\n dot: true,\n }\n // override logger temporarily to clean up console (electron/asar does some internal logging that blogs up the default electron-builder logs)\n const consoleLogger = console.log\n console.log = (...args) => {\n if (args[0] === \"Ordering file has 100% coverage.\") {\n return // no need to log, this means our ordering logic is working correctly\n }\n log.info({ args }, \"logging @electron/asar\")\n }\n await createPackageWithOptions(this.rootForAppFilesWithoutAsar, this.outFile, options)\n console.log = consoleLogger\n }\n\n private async detectAndCopy(fileSets: ResolvedFileSet[]) {\n const taskManager = new AsyncTaskManager(this.cancellationToken)\n const unpackedPaths = new Set<string>()\n const copiedFiles = new Set<string>()\n\n const createdSourceDirs = new Set<string>()\n const links: Array<Link> = []\n const symlinkType = platform() === \"win32\" ? \"junction\" : \"file\"\n\n const matchUnpacker = (file: string, dest: string, stat: fs.Stats) => {\n if (this.config.unpackPattern?.(file, stat)) {\n log.debug({ file }, \"unpacking\")\n unpackedPaths.add(dest)\n return\n }\n }\n const writeFileOrProcessSymlink = async (options: {\n file: string\n destination: string\n stat: fs.Stats\n fileSet: ResolvedFileSet\n transformedData: string | Buffer | undefined\n }) => {\n const { transformedData, file, destination, stat, fileSet } = options\n if (!stat.isFile() && !stat.isSymbolicLink()) {\n return\n }\n copiedFiles.add(destination)\n\n const dir = path.dirname(destination)\n if (!createdSourceDirs.has(dir)) {\n await mkdir(dir, { recursive: true })\n createdSourceDirs.add(dir)\n }\n\n // write any data if provided, skip symlink check\n if (transformedData != null) {\n return fs.writeFile(destination, transformedData, { mode: stat.mode })\n }\n\n const realPathFile = await fs.realpath(file)\n const realPathRelative = path.relative(fileSet.src, realPathFile)\n const isOutsidePackage = realPathRelative.startsWith(\"..\")\n if (isOutsidePackage) {\n log.error({ source: log.filePath(file), realPathFile: log.filePath(realPathFile) }, `unable to copy, file is symlinked outside the package`)\n throw new Error(`Cannot copy file (${path.basename(file)}) symlinked to file (${path.basename(realPathFile)}) outside the package as that violates asar security integrity`)\n }\n\n // not a symlink, copy directly\n if (file === realPathFile) {\n return this.fileCopier.copy(file, destination, stat)\n }\n\n // okay, it must be a symlink. evaluate link to be relative to source file in asar\n let link = await readlink(file)\n if (path.isAbsolute(link)) {\n link = path.relative(path.dirname(file), link)\n }\n links.push({ file: destination, link })\n }\n\n for await (const fileSet of fileSets) {\n if (this.config.options.smartUnpack !== false) {\n detectUnpackedDirs(fileSet, unpackedPaths, this.config.defaultDestination)\n }\n\n // Don't use BluebirdPromise, we need to retain order of execution/iteration through the ordered fileset\n for (let i = 0; i < fileSet.files.length; i++) {\n const file = fileSet.files[i]\n const transformedData = fileSet.transformedFiles?.get(i)\n const stat = fileSet.metadata.get(file)!\n\n const relative = path.relative(this.config.defaultDestination, getDestinationPath(file, fileSet))\n const destination = path.resolve(this.rootForAppFilesWithoutAsar, relative)\n\n matchUnpacker(file, destination, stat)\n taskManager.addTask(writeFileOrProcessSymlink({ transformedData, file, destination, stat, fileSet }))\n\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n }\n // finish copy then set up all symlinks\n await taskManager.awaitTasks()\n for (const it of links) {\n taskManager.addTask(symlink(it.link, it.file, symlinkType))\n\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n await taskManager.awaitTasks()\n return {\n unpackedPaths: Array.from(unpackedPaths),\n copiedFiles: Array.from(copiedFiles),\n }\n }\n}\n\nfunction orderFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n const sortedFileEntries = Array.from(fileSet.files.entries())\n\n sortedFileEntries.sort(([, a], [, b]) => {\n if (a === b) {\n return 0\n }\n\n // Place addons last because their signature changes per build\n const isAAddon = a.endsWith(\".node\")\n const isBAddon = b.endsWith(\".node\")\n if (isAAddon && !isBAddon) {\n return 1\n }\n if (isBAddon && !isAAddon) {\n return -1\n }\n\n // Otherwise order by name\n return a < b ? -1 : 1\n })\n\n let transformedFiles: Map<number, string | Buffer> | undefined\n if (fileSet.transformedFiles) {\n transformedFiles = new Map()\n\n const indexMap = new Map<number, number>()\n for (const [newIndex, [oldIndex]] of sortedFileEntries.entries()) {\n indexMap.set(oldIndex, newIndex)\n }\n\n for (const [oldIndex, value] of fileSet.transformedFiles) {\n const newIndex = indexMap.get(oldIndex)\n if (newIndex === undefined) {\n const file = fileSet.files[oldIndex]\n throw new Error(`Internal error: ${file} was lost while ordering asar`)\n }\n\n transformedFiles.set(newIndex, value)\n }\n }\n\n const { src, destination, metadata } = fileSet\n\n return {\n src,\n destination,\n metadata,\n files: sortedFileEntries.map(([, file]) => file),\n transformedFiles,\n }\n}\n"]}
|
|
@@ -102,8 +102,18 @@ export interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSp
|
|
|
102
102
|
readonly packageName?: string | null;
|
|
103
103
|
readonly vendor?: string | null;
|
|
104
104
|
readonly maintainer?: string | null;
|
|
105
|
+
/**
|
|
106
|
+
* File path to script to be passed to FPM for `--after-install` arg.
|
|
107
|
+
*/
|
|
105
108
|
readonly afterInstall?: string | null;
|
|
109
|
+
/**
|
|
110
|
+
* File path to script to be passed to FPM for `--after-remove` arg.
|
|
111
|
+
*/
|
|
106
112
|
readonly afterRemove?: string | null;
|
|
113
|
+
/**
|
|
114
|
+
* File path to custom AppArmor profile (Ubuntu 24+)
|
|
115
|
+
*/
|
|
116
|
+
readonly appArmorProfile?: string | null;
|
|
107
117
|
/**
|
|
108
118
|
* *Advanced only* The [fpm](https://fpm.readthedocs.io/en/latest/cli-reference.html) options.
|
|
109
119
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linuxOptions.js","sourceRoot":"","sources":["../../src/options/linuxOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { PlatformSpecificBuildOptions, TargetConfigType, TargetSpecificOptions } from \"../index\"\n\n/**\n * Example Spec: https://specifications.freedesktop.org/desktop-entry-spec/latest/example.html\n */\nexport interface LinuxDesktopFile {\n /**\n * `[Desktop Entry]` metadata entries (name to value). Overwrites default values calculated by electron-builder\n */\n entry?: {\n [k: string]: string\n } | null\n /**\n * `[Desktop Actions <ActionName>]` metadata entries (name to value).\n *\n * Config Example:\n * ```js\n * desktopActions: {\n * NewWindow: {\n * Name: 'New Window',\n * Exec: 'app --new-window',\n * }\n * }\n * ```\n */\n desktopActions?: {\n [ActionName: string]: any\n } | null\n}\n\nexport interface LinuxConfiguration extends CommonLinuxOptions, PlatformSpecificBuildOptions {\n /**\n * Target package type: list of `AppImage`, `flatpak`, `snap`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n *\n * electron-builder [docker image](./multi-platform-build.md#docker) can be used to build Linux targets on any platform.\n *\n * Please [do not put an AppImage into another archive](https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages#common-mistake) like a .zip or .tar.gz.\n * @default AppImage\n */\n readonly target?: TargetConfigType\n\n /**\n * The maintainer. Defaults to [author](./configuration.md#author).\n */\n readonly maintainer?: string | null\n\n /**\n * The vendor. Defaults to [author](./configuration.md#author).\n */\n readonly vendor?: string | null\n\n /**\n * The path to icon set directory or one png file, relative to the [build resources](./contents.md#extraresources) or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon.\n * By default will be generated automatically based on the macOS icns file.\n */\n readonly icon?: string\n\n /**\n * backward compatibility + to allow specify fpm-only category for all possible fpm targets in one place\n * @private\n */\n readonly packageCategory?: string | null\n}\n\nexport interface CommonLinuxOptions {\n /**\n * The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).\n */\n readonly synopsis?: string | null\n\n /**\n * As [description](./configuration.md#description) from application package.json, but allows you to specify different for Linux.\n */\n readonly description?: string | null\n\n /**\n * The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).\n */\n readonly category?: string | null\n\n /**\n * The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.\n */\n readonly mimeTypes?: Array<string> | null\n\n /**\n * The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)\n */\n readonly desktop?: LinuxDesktopFile | null\n\n /**\n * The executable parameters. Pass to executableName\n */\n readonly executableArgs?: Array<string> | null\n}\n\n// fpm-only specific options\nexport interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * Package dependencies.\n */\n readonly depends?: Array<string> | null\n\n /**\n * The compression type.\n * @default xz\n */\n readonly compression?: \"gz\" | \"bzip2\" | \"xz\" | \"lzo\" | null\n\n readonly icon?: string\n\n /**\n * The package category.\n */\n readonly packageCategory?: string | null\n\n /**\n * The name of the package.\n */\n readonly packageName?: string | null\n\n readonly vendor?: string | null\n readonly maintainer?: string | null\n\n readonly afterInstall?: string | null\n readonly afterRemove?: string | null\n\n /**\n * *Advanced only* The [fpm](https://fpm.readthedocs.io/en/latest/cli-reference.html) options.\n *\n * Example: `[\"--before-install=build/deb-preinstall.sh\", \"--after-upgrade=build/deb-postinstall.sh\"]`\n */\n readonly fpm?: Array<string> | null\n}\nexport interface DebOptions extends LinuxTargetSpecificOptions {\n /**\n * Package dependencies. Defaults to `[\"gconf2\", \"gconf-service\", \"libnotify4\", \"libappindicator1\", \"libxtst6\", \"libnss3\"]`.\n * If need to support Debian, `libappindicator1` should be removed, it is [deprecated in Debian](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037).\n * If need to support KDE, `gconf2` and `gconf-service` should be removed as it's no longer used [by GNOME](https://packages.debian.org/bullseye/gconf2).\n */\n readonly depends?: Array<string> | null\n\n /**\n * The [recommended package dependencies](https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps)..\n */\n readonly recommends?: Array<string> | null\n\n /**\n * The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section).\n */\n readonly packageCategory?: string | null\n\n /**\n * The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.\n */\n readonly priority?: string | null\n}\n\nexport interface AppImageOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.\n */\n readonly license?: string | null\n}\n\nexport interface FlatpakOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.\n */\n readonly license?: string | null\n\n /**\n * The name of the runtime that the application uses. Defaults to `org.freedesktop.Platform`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly runtime?: string\n\n /**\n * The version of the runtime that the application uses. Defaults to `20.08`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly runtimeVersion?: string\n\n /**\n * The name of the development runtime that the application builds with. Defaults to `org.freedesktop.Sdk`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly sdk?: string\n\n /**\n * Start with the files from the specified application. This can be used to create applications that extend another application.\n * Defaults to [org.electronjs.Electron2.BaseApp](https://github.com/flathub/org.electronjs.Electron2.BaseApp).\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly base?: string\n\n /**\n * Use this specific version of the application specified in base. Defaults to `20.08`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly baseVersion?: string\n\n /**\n * The branch to use when exporting the application. Defaults to `master`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly branch?: string\n\n /**\n * An array of arguments passed to the flatpak build-finish command. Defaults to:\n * ```json\n * [\n * // Wayland/X11 Rendering\n * \"--socket=wayland\",\n * \"--socket=x11\",\n * \"--share=ipc\",\n * // Open GL\n * \"--device=dri\",\n * // Audio output\n * \"--socket=pulseaudio\",\n * // Read/write home directory access\n * \"--filesystem=home\",\n * // Allow communication with network\n * \"--share=network\",\n * // System notifications with libnotify\n * \"--talk-name=org.freedesktop.Notifications\",\n * ]\n * ```\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly finishArgs?: string[]\n\n /**\n * An array of objects specifying the modules to be built in order.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly modules?: (string | any)[]\n\n /**\n * Files to copy directly into the app. Should be a list of [source, dest] tuples. Source should be a relative/absolute path to a file/directory to copy into the flatpak, and dest should be the path inside the app install prefix (e.g. /share/applications/).\n *\n * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).\n */\n readonly files?: [string, string][]\n\n /**\n * Symlinks to create in the app files. Should be a list of [target, location] symlink tuples. Target can be either a relative or absolute path inside the app install prefix, and location should be a absolute path inside the prefix to create the symlink at.\n *\n * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).\n */\n readonly symlinks?: [string, string][]\n\n /**\n * Whether to enable the Wayland specific flags (`--enable-features=UseOzonePlatform --ozone-platform=wayland`) in the wrapper script. These flags are only available starting with Electron version 12. Defaults to `false`.\n */\n readonly useWaylandFlags?: boolean\n}\n"]}
|
|
1
|
+
{"version":3,"file":"linuxOptions.js","sourceRoot":"","sources":["../../src/options/linuxOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { PlatformSpecificBuildOptions, TargetConfigType, TargetSpecificOptions } from \"../index\"\n\n/**\n * Example Spec: https://specifications.freedesktop.org/desktop-entry-spec/latest/example.html\n */\nexport interface LinuxDesktopFile {\n /**\n * `[Desktop Entry]` metadata entries (name to value). Overwrites default values calculated by electron-builder\n */\n entry?: {\n [k: string]: string\n } | null\n /**\n * `[Desktop Actions <ActionName>]` metadata entries (name to value).\n *\n * Config Example:\n * ```js\n * desktopActions: {\n * NewWindow: {\n * Name: 'New Window',\n * Exec: 'app --new-window',\n * }\n * }\n * ```\n */\n desktopActions?: {\n [ActionName: string]: any\n } | null\n}\n\nexport interface LinuxConfiguration extends CommonLinuxOptions, PlatformSpecificBuildOptions {\n /**\n * Target package type: list of `AppImage`, `flatpak`, `snap`, `deb`, `rpm`, `freebsd`, `pacman`, `p5p`, `apk`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n *\n * electron-builder [docker image](./multi-platform-build.md#docker) can be used to build Linux targets on any platform.\n *\n * Please [do not put an AppImage into another archive](https://github.com/probonopd/AppImageKit/wiki/Creating-AppImages#common-mistake) like a .zip or .tar.gz.\n * @default AppImage\n */\n readonly target?: TargetConfigType\n\n /**\n * The maintainer. Defaults to [author](./configuration.md#author).\n */\n readonly maintainer?: string | null\n\n /**\n * The vendor. Defaults to [author](./configuration.md#author).\n */\n readonly vendor?: string | null\n\n /**\n * The path to icon set directory or one png file, relative to the [build resources](./contents.md#extraresources) or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon.\n * By default will be generated automatically based on the macOS icns file.\n */\n readonly icon?: string\n\n /**\n * backward compatibility + to allow specify fpm-only category for all possible fpm targets in one place\n * @private\n */\n readonly packageCategory?: string | null\n}\n\nexport interface CommonLinuxOptions {\n /**\n * The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).\n */\n readonly synopsis?: string | null\n\n /**\n * As [description](./configuration.md#description) from application package.json, but allows you to specify different for Linux.\n */\n readonly description?: string | null\n\n /**\n * The [application category](https://specifications.freedesktop.org/menu-spec/latest/apa.html#main-category-registry).\n */\n readonly category?: string | null\n\n /**\n * The mime types in addition to specified in the file associations. Use it if you don't want to register a new mime type, but reuse existing.\n */\n readonly mimeTypes?: Array<string> | null\n\n /**\n * The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)\n */\n readonly desktop?: LinuxDesktopFile | null\n\n /**\n * The executable parameters. Pass to executableName\n */\n readonly executableArgs?: Array<string> | null\n}\n\n// fpm-only specific options\nexport interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * Package dependencies.\n */\n readonly depends?: Array<string> | null\n\n /**\n * The compression type.\n * @default xz\n */\n readonly compression?: \"gz\" | \"bzip2\" | \"xz\" | \"lzo\" | null\n\n readonly icon?: string\n\n /**\n * The package category.\n */\n readonly packageCategory?: string | null\n\n /**\n * The name of the package.\n */\n readonly packageName?: string | null\n\n readonly vendor?: string | null\n readonly maintainer?: string | null\n\n /**\n * File path to script to be passed to FPM for `--after-install` arg.\n */\n readonly afterInstall?: string | null\n /**\n * File path to script to be passed to FPM for `--after-remove` arg.\n */\n readonly afterRemove?: string | null\n /**\n * File path to custom AppArmor profile (Ubuntu 24+)\n */\n readonly appArmorProfile?: string | null\n\n /**\n * *Advanced only* The [fpm](https://fpm.readthedocs.io/en/latest/cli-reference.html) options.\n *\n * Example: `[\"--before-install=build/deb-preinstall.sh\", \"--after-upgrade=build/deb-postinstall.sh\"]`\n */\n readonly fpm?: Array<string> | null\n}\nexport interface DebOptions extends LinuxTargetSpecificOptions {\n /**\n * Package dependencies. Defaults to `[\"gconf2\", \"gconf-service\", \"libnotify4\", \"libappindicator1\", \"libxtst6\", \"libnss3\"]`.\n * If need to support Debian, `libappindicator1` should be removed, it is [deprecated in Debian](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037).\n * If need to support KDE, `gconf2` and `gconf-service` should be removed as it's no longer used [by GNOME](https://packages.debian.org/bullseye/gconf2).\n */\n readonly depends?: Array<string> | null\n\n /**\n * The [recommended package dependencies](https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps)..\n */\n readonly recommends?: Array<string> | null\n\n /**\n * The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section).\n */\n readonly packageCategory?: string | null\n\n /**\n * The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.\n */\n readonly priority?: string | null\n}\n\nexport interface AppImageOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.\n */\n readonly license?: string | null\n}\n\nexport interface FlatpakOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). Only plain text is supported.\n */\n readonly license?: string | null\n\n /**\n * The name of the runtime that the application uses. Defaults to `org.freedesktop.Platform`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly runtime?: string\n\n /**\n * The version of the runtime that the application uses. Defaults to `20.08`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly runtimeVersion?: string\n\n /**\n * The name of the development runtime that the application builds with. Defaults to `org.freedesktop.Sdk`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly sdk?: string\n\n /**\n * Start with the files from the specified application. This can be used to create applications that extend another application.\n * Defaults to [org.electronjs.Electron2.BaseApp](https://github.com/flathub/org.electronjs.Electron2.BaseApp).\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly base?: string\n\n /**\n * Use this specific version of the application specified in base. Defaults to `20.08`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly baseVersion?: string\n\n /**\n * The branch to use when exporting the application. Defaults to `master`.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly branch?: string\n\n /**\n * An array of arguments passed to the flatpak build-finish command. Defaults to:\n * ```json\n * [\n * // Wayland/X11 Rendering\n * \"--socket=wayland\",\n * \"--socket=x11\",\n * \"--share=ipc\",\n * // Open GL\n * \"--device=dri\",\n * // Audio output\n * \"--socket=pulseaudio\",\n * // Read/write home directory access\n * \"--filesystem=home\",\n * // Allow communication with network\n * \"--share=network\",\n * // System notifications with libnotify\n * \"--talk-name=org.freedesktop.Notifications\",\n * ]\n * ```\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly finishArgs?: string[]\n\n /**\n * An array of objects specifying the modules to be built in order.\n *\n * See [flatpak manifest documentation](https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest).\n */\n readonly modules?: (string | any)[]\n\n /**\n * Files to copy directly into the app. Should be a list of [source, dest] tuples. Source should be a relative/absolute path to a file/directory to copy into the flatpak, and dest should be the path inside the app install prefix (e.g. /share/applications/).\n *\n * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).\n */\n readonly files?: [string, string][]\n\n /**\n * Symlinks to create in the app files. Should be a list of [target, location] symlink tuples. Target can be either a relative or absolute path inside the app install prefix, and location should be a absolute path inside the prefix to create the symlink at.\n *\n * See [@malept/flatpak-bundler documentation](https://github.com/malept/flatpak-bundler#build-options).\n */\n readonly symlinks?: [string, string][]\n\n /**\n * Whether to enable the Wayland specific flags (`--enable-features=UseOzonePlatform --ozone-platform=wayland`) in the wrapper script. These flags are only available starting with Electron version 12. Defaults to `false`.\n */\n readonly useWaylandFlags?: boolean\n}\n"]}
|
package/out/platformPackager.js
CHANGED
|
@@ -396,12 +396,12 @@ class PlatformPackager {
|
|
|
396
396
|
for (const fileSet of fileSets) {
|
|
397
397
|
await (0, appFileCopier_1.transformFiles)(transformer, fileSet);
|
|
398
398
|
}
|
|
399
|
-
await new asarUtil_1.AsarPackager({
|
|
399
|
+
await new asarUtil_1.AsarPackager(this, {
|
|
400
400
|
defaultDestination,
|
|
401
401
|
resourcePath,
|
|
402
402
|
options: asarOptions,
|
|
403
403
|
unpackPattern: fileMatcher === null || fileMatcher === void 0 ? void 0 : fileMatcher.createFilter(),
|
|
404
|
-
}).pack(fileSets
|
|
404
|
+
}).pack(fileSets);
|
|
405
405
|
}));
|
|
406
406
|
}
|
|
407
407
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platformPackager.js","sourceRoot":"","sources":["../src/platformPackager.ts"],"names":[],"mappings":";;;AAmzBA,4CAEC;AAED,0EAeC;AAGD,oCAEC;AAED,sCAEC;AA/0BD,+CAA0C;AAC1C,+CAAuJ;AACvJ,+CAAwH;AACxH,0CAAqC;AACrC,uCAA+B;AAE/B,6BAA4B;AAC5B,uCAAmC;AACnC,4DAA2D;AAC3D,8CAA8C;AAC9C,gDAA8C;AAC9C,+CAA8I;AAC9I,uDAA4E;AAC5E,2CAAwD;AACxD,mCAcgB;AAChB,kDAA2D;AAC3D,wDAA+I;AAC/I,wDAAmE;AACnE,4CAAgD;AAChD,2CAAiG;AAGjG,MAAsB,gBAAgB;IACpC,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;IAC1B,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAA;IACpC,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAA;IAC7B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAA;IACzB,CAAC;IAID,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAA;IACjC,CAAC;IAMD,YACW,IAAc,EACd,QAAkB;QADlB,SAAI,GAAJ,IAAI,CAAU;QACd,aAAQ,GAAR,QAAQ,CAAU;QANZ,kBAAa,GAAG,IAAI,eAAI,CAAgB,GAAG,EAAE,CAAC,IAAA,+BAAgB,EAAC,IAAA,kBAAO,EAAC,IAAI,CAAC,I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AAED,SAAS,qBAAqB,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACrD,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, asArray, AsyncTaskManager, DebugLogger, deepAssign, getArchSuffix, InvalidConfigurationError, isEmptyOrSpaces, log } from \"builder-util\"\nimport { defaultArchFromString, getArtifactArchName, FileTransformer, statOrNull, orIfFileNotExist } from \"builder-util\"\nimport { readdir } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport { Minimatch } from \"minimatch\"\nimport * as path from \"path\"\nimport { AppInfo } from \"./appInfo\"\nimport { checkFileInArchive } from \"./asar/asarFileChecker\"\nimport { AsarPackager } from \"./asar/asarUtil\"\nimport { computeData } from \"./asar/integrity\"\nimport { copyFiles, FileMatcher, getFileMatchers, GetFileMatchersOptions, getMainFileMatchers, getNodeModuleFileMatcher } from \"./fileMatcher\"\nimport { createTransformer, isElectronCompileUsed } from \"./fileTransformer\"\nimport { Framework, isElectronBased } from \"./Framework\"\nimport {\n AfterPackContext,\n AsarOptions,\n CompressionLevel,\n Configuration,\n ElectronPlatformName,\n FileAssociation,\n LinuxPackager,\n Packager,\n PackagerOptions,\n Platform,\n PlatformSpecificBuildOptions,\n Target,\n TargetSpecificOptions,\n} from \"./index\"\nimport { executeAppBuilderAsJson } from \"./util/appBuilder\"\nimport { computeFileSets, computeNodeModuleFileSets, copyAppFiles, ELECTRON_COMPILE_SHIM_FILENAME, transformFiles } from \"./util/appFileCopier\"\nimport { expandMacro as doExpandMacro } from \"./util/macroExpander\"\nimport { resolveFunction } from \"./util/resolve\"\nimport { flipFuses, FuseConfig, FuseV1Config, FuseV1Options, FuseVersion } from \"@electron/fuses\"\nimport { FuseOptionsV1 } from \"./configuration\"\n\nexport abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions> {\n get packagerOptions(): PackagerOptions {\n return this.info.options\n }\n\n get buildResourcesDir(): string {\n return this.info.buildResourcesDir\n }\n\n get projectDir(): string {\n return this.info.projectDir\n }\n\n get config(): Configuration {\n return this.info.config\n }\n\n readonly platformSpecificBuildOptions: DC\n\n get resourceList(): Promise<Array<string>> {\n return this._resourceList.value\n }\n\n private readonly _resourceList = new Lazy<Array<string>>(() => orIfFileNotExist(readdir(this.info.buildResourcesDir), []))\n\n readonly appInfo: AppInfo\n\n protected constructor(\n readonly info: Packager,\n readonly platform: Platform\n ) {\n this.platformSpecificBuildOptions = PlatformPackager.normalizePlatformSpecificBuildOptions((this.config as any)[platform.buildConfigurationKey])\n this.appInfo = this.prepareAppInfo(info.appInfo)\n }\n\n get compression(): CompressionLevel {\n const compression = this.platformSpecificBuildOptions.compression\n // explicitly set to null - request to use default value instead of parent (in the config)\n if (compression === null) {\n return \"normal\"\n }\n return compression || this.config.compression || \"normal\"\n }\n\n get debugLogger(): DebugLogger {\n return this.info.debugLogger\n }\n\n abstract get defaultTarget(): Array<string>\n\n // eslint-disable-next-line\n protected prepareAppInfo(appInfo: AppInfo) {\n return new AppInfo(this.info, null, this.platformSpecificBuildOptions)\n }\n\n private static normalizePlatformSpecificBuildOptions(options: any | null | undefined): any {\n return options == null ? Object.create(null) : options\n }\n\n abstract createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void\n\n getCscPassword(): string {\n const password = this.doGetCscPassword()\n if (isEmptyOrSpaces(password)) {\n log.info({ reason: \"CSC_KEY_PASSWORD is not defined\" }, \"empty password will be used for code signing\")\n return \"\"\n } else {\n return password.trim()\n }\n }\n\n getCscLink(extraEnvName?: string | null): string | null | undefined {\n // allow to specify as empty string\n const envValue = chooseNotNull(extraEnvName == null ? null : process.env[extraEnvName], process.env.CSC_LINK)\n return chooseNotNull(chooseNotNull(this.info.config.cscLink, this.platformSpecificBuildOptions.cscLink), envValue)\n }\n\n doGetCscPassword(): string | null | undefined {\n // allow to specify as empty string\n return chooseNotNull(chooseNotNull(this.info.config.cscKeyPassword, this.platformSpecificBuildOptions.cscKeyPassword), process.env.CSC_KEY_PASSWORD)\n }\n\n protected computeAppOutDir(outDir: string, arch: Arch): string {\n return (\n this.packagerOptions.prepackaged ||\n path.join(\n outDir,\n `${this.platform.buildConfigurationKey}${getArchSuffix(arch, this.platformSpecificBuildOptions.defaultArch)}${this.platform === Platform.MAC ? \"\" : \"-unpacked\"}`\n )\n )\n }\n\n dispatchArtifactCreated(file: string, target: Target | null, arch: Arch | null, safeArtifactName?: string | null): Promise<void> {\n return this.info.callArtifactBuildCompleted({\n file,\n safeArtifactName,\n target,\n arch,\n packager: this,\n })\n }\n\n async pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<any> {\n const appOutDir = this.computeAppOutDir(outDir, arch)\n await this.doPack(outDir, appOutDir, this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets)\n this.packageInDistributableFormat(appOutDir, arch, targets, taskManager)\n }\n\n protected packageInDistributableFormat(appOutDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): void {\n if (targets.find(it => !it.isAsyncSupported) == null) {\n PlatformPackager.buildAsyncTargets(targets, taskManager, appOutDir, arch)\n return\n }\n\n taskManager.add(async () => {\n // BluebirdPromise.map doesn't invoke target.build immediately, but for RemoteTarget it is very critical to call build() before finishBuild()\n const subTaskManager = new AsyncTaskManager(this.info.cancellationToken)\n PlatformPackager.buildAsyncTargets(targets, subTaskManager, appOutDir, arch)\n await subTaskManager.awaitTasks()\n\n for (const target of targets) {\n if (!target.isAsyncSupported && !this.info.cancellationToken.cancelled) {\n await target.build(appOutDir, arch)\n }\n }\n })\n }\n\n private static buildAsyncTargets(targets: Array<Target>, taskManager: AsyncTaskManager, appOutDir: string, arch: Arch) {\n for (const target of targets) {\n if (target.isAsyncSupported) {\n taskManager.addTask(target.build(appOutDir, arch))\n }\n }\n }\n\n private getExtraFileMatchers(isResources: boolean, appOutDir: string, options: GetFileMatchersOptions): Array<FileMatcher> | null {\n const base = isResources\n ? this.getResourcesDir(appOutDir)\n : this.platform === Platform.MAC\n ? path.join(appOutDir, `${this.appInfo.productFilename}.app`, \"Contents\")\n : appOutDir\n return getFileMatchers(this.config, isResources ? \"extraResources\" : \"extraFiles\", base, options)\n }\n\n createGetFileMatchersOptions(outDir: string, arch: Arch, customBuildOptions: PlatformSpecificBuildOptions): GetFileMatchersOptions {\n return {\n macroExpander: it => this.expandMacro(it, arch == null ? null : Arch[arch], { \"/*\": \"{,/**/*}\" }),\n customBuildOptions,\n globalOutDir: outDir,\n defaultSrc: this.projectDir,\n }\n }\n\n protected async doPack(\n outDir: string,\n appOutDir: string,\n platformName: ElectronPlatformName,\n arch: Arch,\n platformSpecificBuildOptions: DC,\n targets: Array<Target>,\n sign = true,\n disableAsarIntegrity = false\n ) {\n if (this.packagerOptions.prepackaged != null) {\n return\n }\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n // Due to node-gyp rewriting GYP_MSVS_VERSION when reused across the same session, we must reset the env var: https://github.com/electron-userland/electron-builder/issues/7256\n delete process.env.GYP_MSVS_VERSION\n\n const beforePack = await resolveFunction(this.appInfo.type, this.config.beforePack, \"beforePack\")\n if (beforePack != null) {\n await beforePack({\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n })\n }\n\n await this.info.installAppDependencies(this.platform, arch)\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n const framework = this.info.framework\n log.info(\n {\n platform: platformName,\n arch: Arch[arch],\n [`${framework.name}`]: framework.version,\n appOutDir: log.filePath(appOutDir),\n },\n `packaging`\n )\n\n await framework.prepareApplicationStageDirectory({\n packager: this,\n appOutDir,\n platformName,\n arch: Arch[arch],\n version: framework.version,\n })\n\n const afterExtract = await resolveFunction(this.appInfo.type, this.config.afterExtract, \"afterExtract\")\n if (afterExtract != null) {\n await afterExtract({\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n })\n }\n\n const excludePatterns: Array<Minimatch> = []\n\n const computeParsedPatterns = (patterns: Array<FileMatcher> | null) => {\n if (patterns != null) {\n for (const pattern of patterns) {\n pattern.computeParsedPatterns(excludePatterns, this.info.projectDir)\n }\n }\n }\n\n const getFileMatchersOptions = this.createGetFileMatchersOptions(outDir, arch, platformSpecificBuildOptions)\n const macroExpander = getFileMatchersOptions.macroExpander\n const extraResourceMatchers = this.getExtraFileMatchers(true, appOutDir, getFileMatchersOptions)\n computeParsedPatterns(extraResourceMatchers)\n const extraFileMatchers = this.getExtraFileMatchers(false, appOutDir, getFileMatchersOptions)\n computeParsedPatterns(extraFileMatchers)\n\n const packContext: AfterPackContext = {\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n }\n\n const asarOptions = await this.computeAsarOptions(platformSpecificBuildOptions)\n const resourcesPath =\n this.platform === Platform.MAC\n ? path.join(appOutDir, framework.distMacOsAppName, \"Contents\", \"Resources\")\n : isElectronBased(framework)\n ? path.join(appOutDir, \"resources\")\n : appOutDir\n const taskManager = new AsyncTaskManager(this.info.cancellationToken)\n this.copyAppFiles(taskManager, asarOptions, resourcesPath, path.join(resourcesPath, \"app\"), packContext, platformSpecificBuildOptions, excludePatterns, macroExpander)\n await taskManager.awaitTasks()\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n if (framework.beforeCopyExtraFiles != null) {\n const resourcesRelativePath = this.platform === Platform.MAC ? \"Resources\" : isElectronBased(framework) ? \"resources\" : \"\"\n\n await framework.beforeCopyExtraFiles({\n packager: this,\n appOutDir,\n asarIntegrity: asarOptions == null || disableAsarIntegrity ? null : await computeData({ resourcesPath, resourcesRelativePath }),\n platformName,\n })\n }\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n const transformerForExtraFiles = this.createTransformerForExtraFiles(packContext)\n await copyFiles(extraResourceMatchers, transformerForExtraFiles)\n await copyFiles(extraFileMatchers, transformerForExtraFiles)\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n await this.info.afterPack(packContext)\n\n if (framework.afterPack != null) {\n await framework.afterPack(packContext)\n }\n\n const isAsar = asarOptions != null\n await this.sanityCheckPackage(appOutDir, isAsar, framework, !!this.config.disableSanityCheckAsar)\n\n // the fuses MUST be flipped right before signing\n if (this.config.electronFuses != null) {\n const fuseConfig = this.generateFuseConfig(this.config.electronFuses)\n await this.addElectronFuses(packContext, fuseConfig)\n }\n if (sign) {\n await this.doSignAfterPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets)\n }\n }\n\n private generateFuseConfig(fuses: FuseOptionsV1): FuseV1Config {\n const config: FuseV1Config = {\n version: FuseVersion.V1,\n resetAdHocDarwinSignature: fuses.resetAdHocDarwinSignature,\n }\n // this is annoying, but we must filter out undefined entries because some older electron versions will receive `the fuse wire in this version of Electron is not long enough` even if entry is set undefined\n if (fuses.runAsNode != null) {\n config[FuseV1Options.RunAsNode] = fuses.runAsNode\n }\n if (fuses.enableCookieEncryption != null) {\n config[FuseV1Options.EnableCookieEncryption] = fuses.enableCookieEncryption\n }\n if (fuses.enableNodeOptionsEnvironmentVariable != null) {\n config[FuseV1Options.EnableNodeOptionsEnvironmentVariable] = fuses.enableNodeOptionsEnvironmentVariable\n }\n if (fuses.enableNodeCliInspectArguments != null) {\n config[FuseV1Options.EnableNodeCliInspectArguments] = fuses.enableNodeCliInspectArguments\n }\n if (fuses.enableEmbeddedAsarIntegrityValidation != null) {\n config[FuseV1Options.EnableEmbeddedAsarIntegrityValidation] = fuses.enableEmbeddedAsarIntegrityValidation\n }\n if (fuses.onlyLoadAppFromAsar != null) {\n config[FuseV1Options.OnlyLoadAppFromAsar] = fuses.onlyLoadAppFromAsar\n }\n if (fuses.loadBrowserProcessSpecificV8Snapshot != null) {\n config[FuseV1Options.LoadBrowserProcessSpecificV8Snapshot] = fuses.loadBrowserProcessSpecificV8Snapshot\n }\n if (fuses.grantFileProtocolExtraPrivileges != null) {\n config[FuseV1Options.GrantFileProtocolExtraPrivileges] = fuses.grantFileProtocolExtraPrivileges\n }\n return config\n }\n\n /**\n * Use `AfterPackContext` here to keep available for public API\n * @param {AfterPackContext} context\n * @param {FuseConfig} fuses\n *\n * Can be used in `afterPack` hook for custom fuse logic like below. It's an alternative approach if one wants to override electron-builder's @electron/fuses version\n * ```\n * await context.packager.addElectronFuses(context, { ... })\n * ```\n */\n public async addElectronFuses(context: AfterPackContext, fuses: FuseConfig) {\n const { appOutDir, electronPlatformName } = context\n\n const ext = {\n darwin: \".app\",\n win32: \".exe\",\n linux: \"\",\n }[electronPlatformName]\n\n const executableName = this instanceof LinuxPackager ? this.executableName : this.appInfo.productFilename\n const electronBinaryPath = path.join(appOutDir, `${executableName}${ext}`)\n\n log.info({ electronPath: log.filePath(electronBinaryPath) }, \"executing @electron/fuses\")\n return flipFuses(electronBinaryPath, fuses)\n }\n\n protected async doSignAfterPack(outDir: string, appOutDir: string, platformName: ElectronPlatformName, arch: Arch, platformSpecificBuildOptions: DC, targets: Array<Target>) {\n const asarOptions = await this.computeAsarOptions(platformSpecificBuildOptions)\n const isAsar = asarOptions != null\n const packContext = {\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n }\n const didSign = await this.signApp(packContext, isAsar)\n const afterSign = await resolveFunction(this.appInfo.type, this.config.afterSign, \"afterSign\")\n if (afterSign != null) {\n if (didSign) {\n await Promise.resolve(afterSign(packContext))\n } else {\n log.warn(null, `skipping \"afterSign\" hook as no signing occurred, perhaps you intended \"afterPack\"?`)\n }\n }\n }\n\n // eslint-disable-next-line\n protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null {\n return null\n }\n\n private copyAppFiles(\n taskManager: AsyncTaskManager,\n asarOptions: AsarOptions | null,\n resourcePath: string,\n defaultDestination: string,\n packContext: AfterPackContext,\n platformSpecificBuildOptions: DC,\n excludePatterns: Array<Minimatch>,\n macroExpander: (it: string) => string\n ) {\n const appDir = this.info.appDir\n const config = this.config\n const isElectronCompile = asarOptions != null && isElectronCompileUsed(this.info)\n\n const mainMatchers = getMainFileMatchers(appDir, defaultDestination, macroExpander, platformSpecificBuildOptions, this, packContext.outDir, isElectronCompile)\n if (excludePatterns.length > 0) {\n for (const matcher of mainMatchers) {\n matcher.excludePatterns = excludePatterns\n }\n }\n\n const framework = this.info.framework\n const transformer = createTransformer(\n appDir,\n config,\n isElectronCompile\n ? {\n originalMain: this.info.metadata.main,\n main: ELECTRON_COMPILE_SHIM_FILENAME,\n ...config.extraMetadata,\n }\n : config.extraMetadata,\n framework.createTransformer == null ? null : framework.createTransformer()\n )\n\n const _computeFileSets = (matchers: Array<FileMatcher>) => {\n return computeFileSets(matchers, this.info.isPrepackedAppAsar ? null : transformer, this, isElectronCompile).then(async result => {\n if (!this.info.isPrepackedAppAsar && !this.info.areNodeModulesHandledExternally) {\n const moduleFileMatcher = getNodeModuleFileMatcher(appDir, defaultDestination, macroExpander, platformSpecificBuildOptions, this.info)\n result = result.concat(await computeNodeModuleFileSets(this, moduleFileMatcher))\n }\n return result.filter(it => it.files.length > 0)\n })\n }\n\n if (this.info.isPrepackedAppAsar) {\n taskManager.addTask(BluebirdPromise.each(_computeFileSets([new FileMatcher(appDir, resourcePath, macroExpander)]), it => copyAppFiles(it, this.info, transformer)))\n } else if (asarOptions == null) {\n // for ASAR all asar unpacked files will be extra transformed (e.g. sign of EXE and DLL) later,\n // for prepackaged asar extra transformation not supported yet,\n // so, extra transform if asar is disabled\n const transformerForExtraFiles = this.createTransformerForExtraFiles(packContext)\n const combinedTransformer: FileTransformer = file => {\n if (transformerForExtraFiles != null) {\n const result = transformerForExtraFiles(file)\n if (result != null) {\n return result\n }\n }\n return transformer(file)\n }\n\n taskManager.addTask(BluebirdPromise.each(_computeFileSets(mainMatchers), it => copyAppFiles(it, this.info, combinedTransformer)))\n } else {\n const unpackPattern = getFileMatchers(config, \"asarUnpack\", defaultDestination, {\n macroExpander,\n customBuildOptions: platformSpecificBuildOptions,\n globalOutDir: packContext.outDir,\n defaultSrc: appDir,\n })\n const fileMatcher = unpackPattern == null ? null : unpackPattern[0]\n taskManager.addTask(\n _computeFileSets(mainMatchers).then(async fileSets => {\n for (const fileSet of fileSets) {\n await transformFiles(transformer, fileSet)\n }\n\n await new AsarPackager({\n defaultDestination,\n resourcePath,\n options: asarOptions,\n unpackPattern: fileMatcher?.createFilter(),\n }).pack(fileSets, this)\n })\n )\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected signApp(packContext: AfterPackContext, isAsar: boolean): Promise<boolean> {\n return Promise.resolve(false)\n }\n\n getIconPath(): Promise<string | null> {\n return Promise.resolve(null)\n }\n\n private async computeAsarOptions(customBuildOptions: DC): Promise<AsarOptions | null> {\n if (!isElectronBased(this.info.framework)) {\n return null\n }\n\n function errorMessage(name: string) {\n return `${name} is deprecated is deprecated and not supported — please use asarUnpack`\n }\n\n const buildMetadata = this.config as any\n if (buildMetadata[\"asar-unpack\"] != null) {\n throw new Error(errorMessage(\"asar-unpack\"))\n }\n if (buildMetadata[\"asar-unpack-dir\"] != null) {\n throw new Error(errorMessage(\"asar-unpack-dir\"))\n }\n\n const platformSpecific = customBuildOptions.asar\n const result = platformSpecific == null ? this.config.asar : platformSpecific\n if (result === false) {\n const appAsarStat = await statOrNull(path.join(this.info.appDir, \"app.asar\"))\n //noinspection ES6MissingAwait\n if (appAsarStat == null || !appAsarStat.isFile()) {\n log.warn(\n {\n solution: \"enable asar and use asarUnpack to unpack files that must be externally available\",\n },\n \"asar usage is disabled — this is strongly not recommended\"\n )\n }\n return null\n }\n\n if (result == null || result === true) {\n return {}\n }\n\n for (const name of [\"unpackDir\", \"unpack\"]) {\n if ((result as any)[name] != null) {\n throw new Error(errorMessage(`asar.${name}`))\n }\n }\n return deepAssign({}, result)\n }\n\n public getElectronSrcDir(dist: string): string {\n return path.resolve(this.projectDir, dist)\n }\n\n public getElectronDestinationDir(appOutDir: string): string {\n return appOutDir\n }\n\n getResourcesDir(appOutDir: string): string {\n if (this.platform === Platform.MAC) {\n return this.getMacOsResourcesDir(appOutDir)\n } else if (isElectronBased(this.info.framework)) {\n return path.join(appOutDir, \"resources\")\n } else {\n return appOutDir\n }\n }\n\n public getMacOsResourcesDir(appOutDir: string): string {\n return path.join(appOutDir, `${this.appInfo.productFilename}.app`, \"Contents\", \"Resources\")\n }\n\n private async checkFileInPackage(resourcesDir: string, file: string, messagePrefix: string, isAsar: boolean, disableSanityCheckAsar: boolean) {\n if (isAsar && disableSanityCheckAsar) {\n return\n }\n const relativeFile = path.relative(this.info.appDir, path.resolve(this.info.appDir, file))\n if (isAsar) {\n checkFileInArchive(path.join(resourcesDir, \"app.asar\"), relativeFile, messagePrefix)\n return\n }\n\n const pathParsed = path.parse(file)\n // Even when packaging to asar is disabled, it does not imply that the main file can not be inside an .asar archive.\n // This may occur when the packaging is done manually before processing with electron-builder.\n if (pathParsed.dir.includes(\".asar\")) {\n // The path needs to be split to the part with an asar archive which acts like a directory and the part with\n // the path to main file itself. (e.g. path/arch.asar/dir/index.js -> path/arch.asar, dir/index.js)\n // noinspection TypeScriptValidateJSTypes\n const pathSplit: Array<string> = pathParsed.dir.split(path.sep)\n let partWithAsarIndex = 0\n pathSplit.some((pathPart: string, index: number) => {\n partWithAsarIndex = index\n return pathPart.endsWith(\".asar\")\n })\n const asarPath = path.join(...pathSplit.slice(0, partWithAsarIndex + 1))\n let mainPath = pathSplit.length > partWithAsarIndex + 1 ? path.join.apply(pathSplit.slice(partWithAsarIndex + 1)) : \"\"\n mainPath += path.join(mainPath, pathParsed.base)\n checkFileInArchive(path.join(resourcesDir, \"app\", asarPath), mainPath, messagePrefix)\n } else {\n const fullPath = path.join(resourcesDir, \"app\", relativeFile)\n const outStat = await statOrNull(fullPath)\n if (outStat == null) {\n throw new Error(`${messagePrefix} \"${fullPath}\" does not exist. Seems like a wrong configuration.`)\n } else {\n //noinspection ES6MissingAwait\n if (!outStat.isFile()) {\n throw new Error(`${messagePrefix} \"${fullPath}\" is not a file. Seems like a wrong configuration.`)\n }\n }\n }\n }\n\n private async sanityCheckPackage(appOutDir: string, isAsar: boolean, framework: Framework, disableSanityCheckAsar: boolean): Promise<any> {\n const outStat = await statOrNull(appOutDir)\n if (outStat == null) {\n throw new Error(`Output directory \"${appOutDir}\" does not exist. Seems like a wrong configuration.`)\n } else {\n //noinspection ES6MissingAwait\n if (!outStat.isDirectory()) {\n throw new Error(`Output directory \"${appOutDir}\" is not a directory. Seems like a wrong configuration.`)\n }\n }\n\n const resourcesDir = this.getResourcesDir(appOutDir)\n const mainFile = (framework.getMainFile == null ? null : framework.getMainFile(this.platform)) || this.info.metadata.main || \"index.js\"\n await this.checkFileInPackage(resourcesDir, mainFile, \"Application entry file\", isAsar, disableSanityCheckAsar)\n await this.checkFileInPackage(resourcesDir, \"package.json\", \"Application\", isAsar, disableSanityCheckAsar)\n }\n\n // tslint:disable-next-line:no-invalid-template-strings\n computeSafeArtifactName(\n suggestedName: string | null,\n ext: string,\n arch?: Arch | null,\n skipDefaultArch = true,\n defaultArch?: string,\n safePattern = \"${name}-${version}-${arch}.${ext}\"\n ): string | null {\n return computeSafeArtifactNameIfNeeded(suggestedName, () =>\n this.computeArtifactName(safePattern, ext, skipDefaultArch && arch === defaultArchFromString(defaultArch) ? null : arch)\n )\n }\n\n expandArtifactNamePattern(\n targetSpecificOptions: TargetSpecificOptions | null | undefined,\n ext: string,\n arch?: Arch | null,\n defaultPattern?: string,\n skipDefaultArch = true,\n defaultArch?: string\n ): string {\n const { pattern, isUserForced } = this.artifactPatternConfig(targetSpecificOptions, defaultPattern)\n return this.computeArtifactName(pattern, ext, !isUserForced && skipDefaultArch && arch === defaultArchFromString(defaultArch) ? null : arch)\n }\n\n artifactPatternConfig(targetSpecificOptions: TargetSpecificOptions | null | undefined, defaultPattern: string | undefined) {\n const userSpecifiedPattern = targetSpecificOptions?.artifactName || this.platformSpecificBuildOptions.artifactName || this.config.artifactName\n return {\n isUserForced: !!userSpecifiedPattern,\n pattern: userSpecifiedPattern || defaultPattern || \"${productName}-${version}-${arch}.${ext}\",\n }\n }\n\n expandArtifactBeautyNamePattern(targetSpecificOptions: TargetSpecificOptions | null | undefined, ext: string, arch?: Arch | null): string {\n // tslint:disable-next-line:no-invalid-template-strings\n return this.expandArtifactNamePattern(targetSpecificOptions, ext, arch, \"${productName} ${version} ${arch}.${ext}\", true)\n }\n\n private computeArtifactName(pattern: any, ext: string, arch: Arch | null | undefined): string {\n const archName = arch == null ? null : getArtifactArchName(arch, ext)\n return this.expandMacro(pattern, archName, {\n ext,\n })\n }\n\n expandMacro(pattern: string, arch?: string | null, extra: any = {}, isProductNameSanitized = true): string {\n return doExpandMacro(pattern, arch, this.appInfo, { os: this.platform.buildConfigurationKey, ...extra }, isProductNameSanitized)\n }\n\n generateName2(ext: string | null, classifier: string | null | undefined, deployment: boolean): string {\n const dotExt = ext == null ? \"\" : `.${ext}`\n const separator = ext === \"deb\" ? \"_\" : \"-\"\n return `${deployment ? this.appInfo.name : this.appInfo.productFilename}${separator}${this.appInfo.version}${classifier == null ? \"\" : `${separator}${classifier}`}${dotExt}`\n }\n\n getTempFile(suffix: string): Promise<string> {\n return this.info.tempDirManager.getTempFile({ suffix })\n }\n\n get fileAssociations(): Array<FileAssociation> {\n return asArray(this.config.fileAssociations).concat(asArray(this.platformSpecificBuildOptions.fileAssociations))\n }\n\n async getResource(custom: string | null | undefined, ...names: Array<string>): Promise<string | null> {\n const resourcesDir = this.info.buildResourcesDir\n if (custom === undefined) {\n const resourceList = await this.resourceList\n for (const name of names) {\n if (resourceList.includes(name)) {\n return path.join(resourcesDir, name)\n }\n }\n } else if (custom != null && !isEmptyOrSpaces(custom)) {\n const resourceList = await this.resourceList\n if (resourceList.includes(custom)) {\n return path.join(resourcesDir, custom)\n }\n\n let p = path.resolve(resourcesDir, custom)\n if ((await statOrNull(p)) == null) {\n p = path.resolve(this.projectDir, custom)\n if ((await statOrNull(p)) == null) {\n throw new InvalidConfigurationError(\n `cannot find specified resource \"${custom}\", nor relative to \"${resourcesDir}\", neither relative to project dir (\"${this.projectDir}\")`\n )\n }\n }\n return p\n }\n return null\n }\n\n get forceCodeSigning(): boolean {\n const forceCodeSigningPlatform = this.platformSpecificBuildOptions.forceCodeSigning\n return (forceCodeSigningPlatform == null ? this.config.forceCodeSigning : forceCodeSigningPlatform) || false\n }\n\n protected async getOrConvertIcon(format: IconFormat): Promise<string | null> {\n const result = await this.resolveIcon(asArray(this.platformSpecificBuildOptions.icon || this.config.icon), [], format)\n if (result.length === 0) {\n const framework = this.info.framework\n if (framework.getDefaultIcon != null) {\n return framework.getDefaultIcon(this.platform)\n }\n\n log.warn({ reason: \"application icon is not set\" }, `default ${capitalizeFirstLetter(framework.name)} icon is used`)\n return this.getDefaultFrameworkIcon()\n } else {\n return result[0].file\n }\n }\n\n getDefaultFrameworkIcon(): string | null {\n const framework = this.info.framework\n return framework.getDefaultIcon == null ? null : framework.getDefaultIcon(this.platform)\n }\n\n // convert if need, validate size (it is a reason why tool is called even if file has target extension (already specified as foo.icns for example))\n async resolveIcon(sources: Array<string>, fallbackSources: Array<string>, outputFormat: IconFormat): Promise<Array<IconInfo>> {\n const output = this.expandMacro(this.config.directories!.output!)\n const args = [\n \"icon\",\n \"--format\",\n outputFormat,\n \"--root\",\n this.buildResourcesDir,\n \"--root\",\n this.projectDir,\n \"--out\",\n path.resolve(this.projectDir, output, `.icon-${outputFormat}`),\n ]\n for (const source of sources) {\n args.push(\"--input\", source)\n }\n for (const source of fallbackSources) {\n args.push(\"--fallback-input\", source)\n }\n\n const result: IconConvertResult = await executeAppBuilderAsJson(args)\n const errorMessage = result.error\n if (errorMessage != null) {\n throw new InvalidConfigurationError(errorMessage, result.errorCode)\n }\n\n if (result.isFallback) {\n log.warn({ reason: \"application icon is not set\" }, `default ${capitalizeFirstLetter(this.info.framework.name)} icon is used`)\n }\n\n return result.icons || []\n }\n}\n\nexport interface IconInfo {\n file: string\n size: number\n}\n\ninterface IconConvertResult {\n icons?: Array<IconInfo>\n\n error?: string\n errorCode?: string\n isFallback?: boolean\n}\n\nexport type IconFormat = \"icns\" | \"ico\" | \"set\"\n\nexport function isSafeGithubName(name: string) {\n return /^[0-9A-Za-z._-]+$/.test(name)\n}\n\nexport function computeSafeArtifactNameIfNeeded(suggestedName: string | null, safeNameProducer: () => string): string | null {\n // GitHub only allows the listed characters in file names.\n if (suggestedName != null) {\n if (isSafeGithubName(suggestedName)) {\n return null\n }\n\n // prefer to use suggested name - so, if space is the only problem, just replace only space to dash\n suggestedName = suggestedName.replace(/ /g, \"-\")\n if (isSafeGithubName(suggestedName)) {\n return suggestedName\n }\n }\n\n return safeNameProducer()\n}\n\n// remove leading dot\nexport function normalizeExt(ext: string) {\n return ext.startsWith(\".\") ? ext.substring(1) : ext\n}\n\nexport function chooseNotNull<T>(v1: T | null | undefined, v2: T | null | undefined): T | null | undefined {\n return v1 == null ? v2 : v1\n}\n\nfunction capitalizeFirstLetter(text: string) {\n return text.charAt(0).toUpperCase() + text.slice(1)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"platformPackager.js","sourceRoot":"","sources":["../src/platformPackager.ts"],"names":[],"mappings":";;;AAmzBA,4CAEC;AAED,0EAeC;AAGD,oCAEC;AAED,sCAEC;AA/0BD,+CAA0C;AAC1C,+CAAuJ;AACvJ,+CAAwH;AACxH,0CAAqC;AACrC,uCAA+B;AAE/B,6BAA4B;AAC5B,uCAAmC;AACnC,4DAA2D;AAC3D,8CAA8C;AAC9C,gDAA8C;AAC9C,+CAA8I;AAC9I,uDAA4E;AAC5E,2CAAwD;AACxD,mCAcgB;AAChB,kDAA2D;AAC3D,wDAA+I;AAC/I,wDAAmE;AACnE,4CAAgD;AAChD,2CAAiG;AAGjG,MAAsB,gBAAgB;IACpC,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;IAC1B,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAA;IACpC,C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C,EAAE,CAAC;YACpC,OAAO,aAAa,CAAA;QACtB,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,EAAE,CAAA;AAC3B,CAAC;AAED,qBAAqB;AACrB,SAAgB,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;AACrD,CAAC;AAED,SAAgB,aAAa,CAAI,EAAwB,EAAE,EAAwB;IACjF,OAAO,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AAC7B,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACrD,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, asArray, AsyncTaskManager, DebugLogger, deepAssign, getArchSuffix, InvalidConfigurationError, isEmptyOrSpaces, log } from \"builder-util\"\nimport { defaultArchFromString, getArtifactArchName, FileTransformer, statOrNull, orIfFileNotExist } from \"builder-util\"\nimport { readdir } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport { Minimatch } from \"minimatch\"\nimport * as path from \"path\"\nimport { AppInfo } from \"./appInfo\"\nimport { checkFileInArchive } from \"./asar/asarFileChecker\"\nimport { AsarPackager } from \"./asar/asarUtil\"\nimport { computeData } from \"./asar/integrity\"\nimport { copyFiles, FileMatcher, getFileMatchers, GetFileMatchersOptions, getMainFileMatchers, getNodeModuleFileMatcher } from \"./fileMatcher\"\nimport { createTransformer, isElectronCompileUsed } from \"./fileTransformer\"\nimport { Framework, isElectronBased } from \"./Framework\"\nimport {\n AfterPackContext,\n AsarOptions,\n CompressionLevel,\n Configuration,\n ElectronPlatformName,\n FileAssociation,\n LinuxPackager,\n Packager,\n PackagerOptions,\n Platform,\n PlatformSpecificBuildOptions,\n Target,\n TargetSpecificOptions,\n} from \"./index\"\nimport { executeAppBuilderAsJson } from \"./util/appBuilder\"\nimport { computeFileSets, computeNodeModuleFileSets, copyAppFiles, ELECTRON_COMPILE_SHIM_FILENAME, transformFiles } from \"./util/appFileCopier\"\nimport { expandMacro as doExpandMacro } from \"./util/macroExpander\"\nimport { resolveFunction } from \"./util/resolve\"\nimport { flipFuses, FuseConfig, FuseV1Config, FuseV1Options, FuseVersion } from \"@electron/fuses\"\nimport { FuseOptionsV1 } from \"./configuration\"\n\nexport abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions> {\n get packagerOptions(): PackagerOptions {\n return this.info.options\n }\n\n get buildResourcesDir(): string {\n return this.info.buildResourcesDir\n }\n\n get projectDir(): string {\n return this.info.projectDir\n }\n\n get config(): Configuration {\n return this.info.config\n }\n\n readonly platformSpecificBuildOptions: DC\n\n get resourceList(): Promise<Array<string>> {\n return this._resourceList.value\n }\n\n private readonly _resourceList = new Lazy<Array<string>>(() => orIfFileNotExist(readdir(this.info.buildResourcesDir), []))\n\n readonly appInfo: AppInfo\n\n protected constructor(\n readonly info: Packager,\n readonly platform: Platform\n ) {\n this.platformSpecificBuildOptions = PlatformPackager.normalizePlatformSpecificBuildOptions((this.config as any)[platform.buildConfigurationKey])\n this.appInfo = this.prepareAppInfo(info.appInfo)\n }\n\n get compression(): CompressionLevel {\n const compression = this.platformSpecificBuildOptions.compression\n // explicitly set to null - request to use default value instead of parent (in the config)\n if (compression === null) {\n return \"normal\"\n }\n return compression || this.config.compression || \"normal\"\n }\n\n get debugLogger(): DebugLogger {\n return this.info.debugLogger\n }\n\n abstract get defaultTarget(): Array<string>\n\n // eslint-disable-next-line\n protected prepareAppInfo(appInfo: AppInfo) {\n return new AppInfo(this.info, null, this.platformSpecificBuildOptions)\n }\n\n private static normalizePlatformSpecificBuildOptions(options: any | null | undefined): any {\n return options == null ? Object.create(null) : options\n }\n\n abstract createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void\n\n getCscPassword(): string {\n const password = this.doGetCscPassword()\n if (isEmptyOrSpaces(password)) {\n log.info({ reason: \"CSC_KEY_PASSWORD is not defined\" }, \"empty password will be used for code signing\")\n return \"\"\n } else {\n return password.trim()\n }\n }\n\n getCscLink(extraEnvName?: string | null): string | null | undefined {\n // allow to specify as empty string\n const envValue = chooseNotNull(extraEnvName == null ? null : process.env[extraEnvName], process.env.CSC_LINK)\n return chooseNotNull(chooseNotNull(this.info.config.cscLink, this.platformSpecificBuildOptions.cscLink), envValue)\n }\n\n doGetCscPassword(): string | null | undefined {\n // allow to specify as empty string\n return chooseNotNull(chooseNotNull(this.info.config.cscKeyPassword, this.platformSpecificBuildOptions.cscKeyPassword), process.env.CSC_KEY_PASSWORD)\n }\n\n protected computeAppOutDir(outDir: string, arch: Arch): string {\n return (\n this.packagerOptions.prepackaged ||\n path.join(\n outDir,\n `${this.platform.buildConfigurationKey}${getArchSuffix(arch, this.platformSpecificBuildOptions.defaultArch)}${this.platform === Platform.MAC ? \"\" : \"-unpacked\"}`\n )\n )\n }\n\n dispatchArtifactCreated(file: string, target: Target | null, arch: Arch | null, safeArtifactName?: string | null): Promise<void> {\n return this.info.callArtifactBuildCompleted({\n file,\n safeArtifactName,\n target,\n arch,\n packager: this,\n })\n }\n\n async pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<any> {\n const appOutDir = this.computeAppOutDir(outDir, arch)\n await this.doPack(outDir, appOutDir, this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets)\n this.packageInDistributableFormat(appOutDir, arch, targets, taskManager)\n }\n\n protected packageInDistributableFormat(appOutDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): void {\n if (targets.find(it => !it.isAsyncSupported) == null) {\n PlatformPackager.buildAsyncTargets(targets, taskManager, appOutDir, arch)\n return\n }\n\n taskManager.add(async () => {\n // BluebirdPromise.map doesn't invoke target.build immediately, but for RemoteTarget it is very critical to call build() before finishBuild()\n const subTaskManager = new AsyncTaskManager(this.info.cancellationToken)\n PlatformPackager.buildAsyncTargets(targets, subTaskManager, appOutDir, arch)\n await subTaskManager.awaitTasks()\n\n for (const target of targets) {\n if (!target.isAsyncSupported && !this.info.cancellationToken.cancelled) {\n await target.build(appOutDir, arch)\n }\n }\n })\n }\n\n private static buildAsyncTargets(targets: Array<Target>, taskManager: AsyncTaskManager, appOutDir: string, arch: Arch) {\n for (const target of targets) {\n if (target.isAsyncSupported) {\n taskManager.addTask(target.build(appOutDir, arch))\n }\n }\n }\n\n private getExtraFileMatchers(isResources: boolean, appOutDir: string, options: GetFileMatchersOptions): Array<FileMatcher> | null {\n const base = isResources\n ? this.getResourcesDir(appOutDir)\n : this.platform === Platform.MAC\n ? path.join(appOutDir, `${this.appInfo.productFilename}.app`, \"Contents\")\n : appOutDir\n return getFileMatchers(this.config, isResources ? \"extraResources\" : \"extraFiles\", base, options)\n }\n\n createGetFileMatchersOptions(outDir: string, arch: Arch, customBuildOptions: PlatformSpecificBuildOptions): GetFileMatchersOptions {\n return {\n macroExpander: it => this.expandMacro(it, arch == null ? null : Arch[arch], { \"/*\": \"{,/**/*}\" }),\n customBuildOptions,\n globalOutDir: outDir,\n defaultSrc: this.projectDir,\n }\n }\n\n protected async doPack(\n outDir: string,\n appOutDir: string,\n platformName: ElectronPlatformName,\n arch: Arch,\n platformSpecificBuildOptions: DC,\n targets: Array<Target>,\n sign = true,\n disableAsarIntegrity = false\n ) {\n if (this.packagerOptions.prepackaged != null) {\n return\n }\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n // Due to node-gyp rewriting GYP_MSVS_VERSION when reused across the same session, we must reset the env var: https://github.com/electron-userland/electron-builder/issues/7256\n delete process.env.GYP_MSVS_VERSION\n\n const beforePack = await resolveFunction(this.appInfo.type, this.config.beforePack, \"beforePack\")\n if (beforePack != null) {\n await beforePack({\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n })\n }\n\n await this.info.installAppDependencies(this.platform, arch)\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n const framework = this.info.framework\n log.info(\n {\n platform: platformName,\n arch: Arch[arch],\n [`${framework.name}`]: framework.version,\n appOutDir: log.filePath(appOutDir),\n },\n `packaging`\n )\n\n await framework.prepareApplicationStageDirectory({\n packager: this,\n appOutDir,\n platformName,\n arch: Arch[arch],\n version: framework.version,\n })\n\n const afterExtract = await resolveFunction(this.appInfo.type, this.config.afterExtract, \"afterExtract\")\n if (afterExtract != null) {\n await afterExtract({\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n })\n }\n\n const excludePatterns: Array<Minimatch> = []\n\n const computeParsedPatterns = (patterns: Array<FileMatcher> | null) => {\n if (patterns != null) {\n for (const pattern of patterns) {\n pattern.computeParsedPatterns(excludePatterns, this.info.projectDir)\n }\n }\n }\n\n const getFileMatchersOptions = this.createGetFileMatchersOptions(outDir, arch, platformSpecificBuildOptions)\n const macroExpander = getFileMatchersOptions.macroExpander\n const extraResourceMatchers = this.getExtraFileMatchers(true, appOutDir, getFileMatchersOptions)\n computeParsedPatterns(extraResourceMatchers)\n const extraFileMatchers = this.getExtraFileMatchers(false, appOutDir, getFileMatchersOptions)\n computeParsedPatterns(extraFileMatchers)\n\n const packContext: AfterPackContext = {\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n }\n\n const asarOptions = await this.computeAsarOptions(platformSpecificBuildOptions)\n const resourcesPath =\n this.platform === Platform.MAC\n ? path.join(appOutDir, framework.distMacOsAppName, \"Contents\", \"Resources\")\n : isElectronBased(framework)\n ? path.join(appOutDir, \"resources\")\n : appOutDir\n const taskManager = new AsyncTaskManager(this.info.cancellationToken)\n this.copyAppFiles(taskManager, asarOptions, resourcesPath, path.join(resourcesPath, \"app\"), packContext, platformSpecificBuildOptions, excludePatterns, macroExpander)\n await taskManager.awaitTasks()\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n if (framework.beforeCopyExtraFiles != null) {\n const resourcesRelativePath = this.platform === Platform.MAC ? \"Resources\" : isElectronBased(framework) ? \"resources\" : \"\"\n\n await framework.beforeCopyExtraFiles({\n packager: this,\n appOutDir,\n asarIntegrity: asarOptions == null || disableAsarIntegrity ? null : await computeData({ resourcesPath, resourcesRelativePath }),\n platformName,\n })\n }\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n const transformerForExtraFiles = this.createTransformerForExtraFiles(packContext)\n await copyFiles(extraResourceMatchers, transformerForExtraFiles)\n await copyFiles(extraFileMatchers, transformerForExtraFiles)\n\n if (this.info.cancellationToken.cancelled) {\n return\n }\n\n await this.info.afterPack(packContext)\n\n if (framework.afterPack != null) {\n await framework.afterPack(packContext)\n }\n\n const isAsar = asarOptions != null\n await this.sanityCheckPackage(appOutDir, isAsar, framework, !!this.config.disableSanityCheckAsar)\n\n // the fuses MUST be flipped right before signing\n if (this.config.electronFuses != null) {\n const fuseConfig = this.generateFuseConfig(this.config.electronFuses)\n await this.addElectronFuses(packContext, fuseConfig)\n }\n if (sign) {\n await this.doSignAfterPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets)\n }\n }\n\n private generateFuseConfig(fuses: FuseOptionsV1): FuseV1Config {\n const config: FuseV1Config = {\n version: FuseVersion.V1,\n resetAdHocDarwinSignature: fuses.resetAdHocDarwinSignature,\n }\n // this is annoying, but we must filter out undefined entries because some older electron versions will receive `the fuse wire in this version of Electron is not long enough` even if entry is set undefined\n if (fuses.runAsNode != null) {\n config[FuseV1Options.RunAsNode] = fuses.runAsNode\n }\n if (fuses.enableCookieEncryption != null) {\n config[FuseV1Options.EnableCookieEncryption] = fuses.enableCookieEncryption\n }\n if (fuses.enableNodeOptionsEnvironmentVariable != null) {\n config[FuseV1Options.EnableNodeOptionsEnvironmentVariable] = fuses.enableNodeOptionsEnvironmentVariable\n }\n if (fuses.enableNodeCliInspectArguments != null) {\n config[FuseV1Options.EnableNodeCliInspectArguments] = fuses.enableNodeCliInspectArguments\n }\n if (fuses.enableEmbeddedAsarIntegrityValidation != null) {\n config[FuseV1Options.EnableEmbeddedAsarIntegrityValidation] = fuses.enableEmbeddedAsarIntegrityValidation\n }\n if (fuses.onlyLoadAppFromAsar != null) {\n config[FuseV1Options.OnlyLoadAppFromAsar] = fuses.onlyLoadAppFromAsar\n }\n if (fuses.loadBrowserProcessSpecificV8Snapshot != null) {\n config[FuseV1Options.LoadBrowserProcessSpecificV8Snapshot] = fuses.loadBrowserProcessSpecificV8Snapshot\n }\n if (fuses.grantFileProtocolExtraPrivileges != null) {\n config[FuseV1Options.GrantFileProtocolExtraPrivileges] = fuses.grantFileProtocolExtraPrivileges\n }\n return config\n }\n\n /**\n * Use `AfterPackContext` here to keep available for public API\n * @param {AfterPackContext} context\n * @param {FuseConfig} fuses\n *\n * Can be used in `afterPack` hook for custom fuse logic like below. It's an alternative approach if one wants to override electron-builder's @electron/fuses version\n * ```\n * await context.packager.addElectronFuses(context, { ... })\n * ```\n */\n public async addElectronFuses(context: AfterPackContext, fuses: FuseConfig) {\n const { appOutDir, electronPlatformName } = context\n\n const ext = {\n darwin: \".app\",\n win32: \".exe\",\n linux: \"\",\n }[electronPlatformName]\n\n const executableName = this instanceof LinuxPackager ? this.executableName : this.appInfo.productFilename\n const electronBinaryPath = path.join(appOutDir, `${executableName}${ext}`)\n\n log.info({ electronPath: log.filePath(electronBinaryPath) }, \"executing @electron/fuses\")\n return flipFuses(electronBinaryPath, fuses)\n }\n\n protected async doSignAfterPack(outDir: string, appOutDir: string, platformName: ElectronPlatformName, arch: Arch, platformSpecificBuildOptions: DC, targets: Array<Target>) {\n const asarOptions = await this.computeAsarOptions(platformSpecificBuildOptions)\n const isAsar = asarOptions != null\n const packContext = {\n appOutDir,\n outDir,\n arch,\n targets,\n packager: this,\n electronPlatformName: platformName,\n }\n const didSign = await this.signApp(packContext, isAsar)\n const afterSign = await resolveFunction(this.appInfo.type, this.config.afterSign, \"afterSign\")\n if (afterSign != null) {\n if (didSign) {\n await Promise.resolve(afterSign(packContext))\n } else {\n log.warn(null, `skipping \"afterSign\" hook as no signing occurred, perhaps you intended \"afterPack\"?`)\n }\n }\n }\n\n // eslint-disable-next-line\n protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null {\n return null\n }\n\n private copyAppFiles(\n taskManager: AsyncTaskManager,\n asarOptions: AsarOptions | null,\n resourcePath: string,\n defaultDestination: string,\n packContext: AfterPackContext,\n platformSpecificBuildOptions: DC,\n excludePatterns: Array<Minimatch>,\n macroExpander: (it: string) => string\n ) {\n const appDir = this.info.appDir\n const config = this.config\n const isElectronCompile = asarOptions != null && isElectronCompileUsed(this.info)\n\n const mainMatchers = getMainFileMatchers(appDir, defaultDestination, macroExpander, platformSpecificBuildOptions, this, packContext.outDir, isElectronCompile)\n if (excludePatterns.length > 0) {\n for (const matcher of mainMatchers) {\n matcher.excludePatterns = excludePatterns\n }\n }\n\n const framework = this.info.framework\n const transformer = createTransformer(\n appDir,\n config,\n isElectronCompile\n ? {\n originalMain: this.info.metadata.main,\n main: ELECTRON_COMPILE_SHIM_FILENAME,\n ...config.extraMetadata,\n }\n : config.extraMetadata,\n framework.createTransformer == null ? null : framework.createTransformer()\n )\n\n const _computeFileSets = (matchers: Array<FileMatcher>) => {\n return computeFileSets(matchers, this.info.isPrepackedAppAsar ? null : transformer, this, isElectronCompile).then(async result => {\n if (!this.info.isPrepackedAppAsar && !this.info.areNodeModulesHandledExternally) {\n const moduleFileMatcher = getNodeModuleFileMatcher(appDir, defaultDestination, macroExpander, platformSpecificBuildOptions, this.info)\n result = result.concat(await computeNodeModuleFileSets(this, moduleFileMatcher))\n }\n return result.filter(it => it.files.length > 0)\n })\n }\n\n if (this.info.isPrepackedAppAsar) {\n taskManager.addTask(BluebirdPromise.each(_computeFileSets([new FileMatcher(appDir, resourcePath, macroExpander)]), it => copyAppFiles(it, this.info, transformer)))\n } else if (asarOptions == null) {\n // for ASAR all asar unpacked files will be extra transformed (e.g. sign of EXE and DLL) later,\n // for prepackaged asar extra transformation not supported yet,\n // so, extra transform if asar is disabled\n const transformerForExtraFiles = this.createTransformerForExtraFiles(packContext)\n const combinedTransformer: FileTransformer = file => {\n if (transformerForExtraFiles != null) {\n const result = transformerForExtraFiles(file)\n if (result != null) {\n return result\n }\n }\n return transformer(file)\n }\n\n taskManager.addTask(BluebirdPromise.each(_computeFileSets(mainMatchers), it => copyAppFiles(it, this.info, combinedTransformer)))\n } else {\n const unpackPattern = getFileMatchers(config, \"asarUnpack\", defaultDestination, {\n macroExpander,\n customBuildOptions: platformSpecificBuildOptions,\n globalOutDir: packContext.outDir,\n defaultSrc: appDir,\n })\n const fileMatcher = unpackPattern == null ? null : unpackPattern[0]\n taskManager.addTask(\n _computeFileSets(mainMatchers).then(async fileSets => {\n for (const fileSet of fileSets) {\n await transformFiles(transformer, fileSet)\n }\n\n await new AsarPackager(this, {\n defaultDestination,\n resourcePath,\n options: asarOptions,\n unpackPattern: fileMatcher?.createFilter(),\n }).pack(fileSets)\n })\n )\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected signApp(packContext: AfterPackContext, isAsar: boolean): Promise<boolean> {\n return Promise.resolve(false)\n }\n\n getIconPath(): Promise<string | null> {\n return Promise.resolve(null)\n }\n\n private async computeAsarOptions(customBuildOptions: DC): Promise<AsarOptions | null> {\n if (!isElectronBased(this.info.framework)) {\n return null\n }\n\n function errorMessage(name: string) {\n return `${name} is deprecated is deprecated and not supported — please use asarUnpack`\n }\n\n const buildMetadata = this.config as any\n if (buildMetadata[\"asar-unpack\"] != null) {\n throw new Error(errorMessage(\"asar-unpack\"))\n }\n if (buildMetadata[\"asar-unpack-dir\"] != null) {\n throw new Error(errorMessage(\"asar-unpack-dir\"))\n }\n\n const platformSpecific = customBuildOptions.asar\n const result = platformSpecific == null ? this.config.asar : platformSpecific\n if (result === false) {\n const appAsarStat = await statOrNull(path.join(this.info.appDir, \"app.asar\"))\n //noinspection ES6MissingAwait\n if (appAsarStat == null || !appAsarStat.isFile()) {\n log.warn(\n {\n solution: \"enable asar and use asarUnpack to unpack files that must be externally available\",\n },\n \"asar usage is disabled — this is strongly not recommended\"\n )\n }\n return null\n }\n\n if (result == null || result === true) {\n return {}\n }\n\n for (const name of [\"unpackDir\", \"unpack\"]) {\n if ((result as any)[name] != null) {\n throw new Error(errorMessage(`asar.${name}`))\n }\n }\n return deepAssign({}, result)\n }\n\n public getElectronSrcDir(dist: string): string {\n return path.resolve(this.projectDir, dist)\n }\n\n public getElectronDestinationDir(appOutDir: string): string {\n return appOutDir\n }\n\n getResourcesDir(appOutDir: string): string {\n if (this.platform === Platform.MAC) {\n return this.getMacOsResourcesDir(appOutDir)\n } else if (isElectronBased(this.info.framework)) {\n return path.join(appOutDir, \"resources\")\n } else {\n return appOutDir\n }\n }\n\n public getMacOsResourcesDir(appOutDir: string): string {\n return path.join(appOutDir, `${this.appInfo.productFilename}.app`, \"Contents\", \"Resources\")\n }\n\n private async checkFileInPackage(resourcesDir: string, file: string, messagePrefix: string, isAsar: boolean, disableSanityCheckAsar: boolean) {\n if (isAsar && disableSanityCheckAsar) {\n return\n }\n const relativeFile = path.relative(this.info.appDir, path.resolve(this.info.appDir, file))\n if (isAsar) {\n checkFileInArchive(path.join(resourcesDir, \"app.asar\"), relativeFile, messagePrefix)\n return\n }\n\n const pathParsed = path.parse(file)\n // Even when packaging to asar is disabled, it does not imply that the main file can not be inside an .asar archive.\n // This may occur when the packaging is done manually before processing with electron-builder.\n if (pathParsed.dir.includes(\".asar\")) {\n // The path needs to be split to the part with an asar archive which acts like a directory and the part with\n // the path to main file itself. (e.g. path/arch.asar/dir/index.js -> path/arch.asar, dir/index.js)\n // noinspection TypeScriptValidateJSTypes\n const pathSplit: Array<string> = pathParsed.dir.split(path.sep)\n let partWithAsarIndex = 0\n pathSplit.some((pathPart: string, index: number) => {\n partWithAsarIndex = index\n return pathPart.endsWith(\".asar\")\n })\n const asarPath = path.join(...pathSplit.slice(0, partWithAsarIndex + 1))\n let mainPath = pathSplit.length > partWithAsarIndex + 1 ? path.join.apply(pathSplit.slice(partWithAsarIndex + 1)) : \"\"\n mainPath += path.join(mainPath, pathParsed.base)\n checkFileInArchive(path.join(resourcesDir, \"app\", asarPath), mainPath, messagePrefix)\n } else {\n const fullPath = path.join(resourcesDir, \"app\", relativeFile)\n const outStat = await statOrNull(fullPath)\n if (outStat == null) {\n throw new Error(`${messagePrefix} \"${fullPath}\" does not exist. Seems like a wrong configuration.`)\n } else {\n //noinspection ES6MissingAwait\n if (!outStat.isFile()) {\n throw new Error(`${messagePrefix} \"${fullPath}\" is not a file. Seems like a wrong configuration.`)\n }\n }\n }\n }\n\n private async sanityCheckPackage(appOutDir: string, isAsar: boolean, framework: Framework, disableSanityCheckAsar: boolean): Promise<any> {\n const outStat = await statOrNull(appOutDir)\n if (outStat == null) {\n throw new Error(`Output directory \"${appOutDir}\" does not exist. Seems like a wrong configuration.`)\n } else {\n //noinspection ES6MissingAwait\n if (!outStat.isDirectory()) {\n throw new Error(`Output directory \"${appOutDir}\" is not a directory. Seems like a wrong configuration.`)\n }\n }\n\n const resourcesDir = this.getResourcesDir(appOutDir)\n const mainFile = (framework.getMainFile == null ? null : framework.getMainFile(this.platform)) || this.info.metadata.main || \"index.js\"\n await this.checkFileInPackage(resourcesDir, mainFile, \"Application entry file\", isAsar, disableSanityCheckAsar)\n await this.checkFileInPackage(resourcesDir, \"package.json\", \"Application\", isAsar, disableSanityCheckAsar)\n }\n\n // tslint:disable-next-line:no-invalid-template-strings\n computeSafeArtifactName(\n suggestedName: string | null,\n ext: string,\n arch?: Arch | null,\n skipDefaultArch = true,\n defaultArch?: string,\n safePattern = \"${name}-${version}-${arch}.${ext}\"\n ): string | null {\n return computeSafeArtifactNameIfNeeded(suggestedName, () =>\n this.computeArtifactName(safePattern, ext, skipDefaultArch && arch === defaultArchFromString(defaultArch) ? null : arch)\n )\n }\n\n expandArtifactNamePattern(\n targetSpecificOptions: TargetSpecificOptions | null | undefined,\n ext: string,\n arch?: Arch | null,\n defaultPattern?: string,\n skipDefaultArch = true,\n defaultArch?: string\n ): string {\n const { pattern, isUserForced } = this.artifactPatternConfig(targetSpecificOptions, defaultPattern)\n return this.computeArtifactName(pattern, ext, !isUserForced && skipDefaultArch && arch === defaultArchFromString(defaultArch) ? null : arch)\n }\n\n artifactPatternConfig(targetSpecificOptions: TargetSpecificOptions | null | undefined, defaultPattern: string | undefined) {\n const userSpecifiedPattern = targetSpecificOptions?.artifactName || this.platformSpecificBuildOptions.artifactName || this.config.artifactName\n return {\n isUserForced: !!userSpecifiedPattern,\n pattern: userSpecifiedPattern || defaultPattern || \"${productName}-${version}-${arch}.${ext}\",\n }\n }\n\n expandArtifactBeautyNamePattern(targetSpecificOptions: TargetSpecificOptions | null | undefined, ext: string, arch?: Arch | null): string {\n // tslint:disable-next-line:no-invalid-template-strings\n return this.expandArtifactNamePattern(targetSpecificOptions, ext, arch, \"${productName} ${version} ${arch}.${ext}\", true)\n }\n\n private computeArtifactName(pattern: any, ext: string, arch: Arch | null | undefined): string {\n const archName = arch == null ? null : getArtifactArchName(arch, ext)\n return this.expandMacro(pattern, archName, {\n ext,\n })\n }\n\n expandMacro(pattern: string, arch?: string | null, extra: any = {}, isProductNameSanitized = true): string {\n return doExpandMacro(pattern, arch, this.appInfo, { os: this.platform.buildConfigurationKey, ...extra }, isProductNameSanitized)\n }\n\n generateName2(ext: string | null, classifier: string | null | undefined, deployment: boolean): string {\n const dotExt = ext == null ? \"\" : `.${ext}`\n const separator = ext === \"deb\" ? \"_\" : \"-\"\n return `${deployment ? this.appInfo.name : this.appInfo.productFilename}${separator}${this.appInfo.version}${classifier == null ? \"\" : `${separator}${classifier}`}${dotExt}`\n }\n\n getTempFile(suffix: string): Promise<string> {\n return this.info.tempDirManager.getTempFile({ suffix })\n }\n\n get fileAssociations(): Array<FileAssociation> {\n return asArray(this.config.fileAssociations).concat(asArray(this.platformSpecificBuildOptions.fileAssociations))\n }\n\n async getResource(custom: string | null | undefined, ...names: Array<string>): Promise<string | null> {\n const resourcesDir = this.info.buildResourcesDir\n if (custom === undefined) {\n const resourceList = await this.resourceList\n for (const name of names) {\n if (resourceList.includes(name)) {\n return path.join(resourcesDir, name)\n }\n }\n } else if (custom != null && !isEmptyOrSpaces(custom)) {\n const resourceList = await this.resourceList\n if (resourceList.includes(custom)) {\n return path.join(resourcesDir, custom)\n }\n\n let p = path.resolve(resourcesDir, custom)\n if ((await statOrNull(p)) == null) {\n p = path.resolve(this.projectDir, custom)\n if ((await statOrNull(p)) == null) {\n throw new InvalidConfigurationError(\n `cannot find specified resource \"${custom}\", nor relative to \"${resourcesDir}\", neither relative to project dir (\"${this.projectDir}\")`\n )\n }\n }\n return p\n }\n return null\n }\n\n get forceCodeSigning(): boolean {\n const forceCodeSigningPlatform = this.platformSpecificBuildOptions.forceCodeSigning\n return (forceCodeSigningPlatform == null ? this.config.forceCodeSigning : forceCodeSigningPlatform) || false\n }\n\n protected async getOrConvertIcon(format: IconFormat): Promise<string | null> {\n const result = await this.resolveIcon(asArray(this.platformSpecificBuildOptions.icon || this.config.icon), [], format)\n if (result.length === 0) {\n const framework = this.info.framework\n if (framework.getDefaultIcon != null) {\n return framework.getDefaultIcon(this.platform)\n }\n\n log.warn({ reason: \"application icon is not set\" }, `default ${capitalizeFirstLetter(framework.name)} icon is used`)\n return this.getDefaultFrameworkIcon()\n } else {\n return result[0].file\n }\n }\n\n getDefaultFrameworkIcon(): string | null {\n const framework = this.info.framework\n return framework.getDefaultIcon == null ? null : framework.getDefaultIcon(this.platform)\n }\n\n // convert if need, validate size (it is a reason why tool is called even if file has target extension (already specified as foo.icns for example))\n async resolveIcon(sources: Array<string>, fallbackSources: Array<string>, outputFormat: IconFormat): Promise<Array<IconInfo>> {\n const output = this.expandMacro(this.config.directories!.output!)\n const args = [\n \"icon\",\n \"--format\",\n outputFormat,\n \"--root\",\n this.buildResourcesDir,\n \"--root\",\n this.projectDir,\n \"--out\",\n path.resolve(this.projectDir, output, `.icon-${outputFormat}`),\n ]\n for (const source of sources) {\n args.push(\"--input\", source)\n }\n for (const source of fallbackSources) {\n args.push(\"--fallback-input\", source)\n }\n\n const result: IconConvertResult = await executeAppBuilderAsJson(args)\n const errorMessage = result.error\n if (errorMessage != null) {\n throw new InvalidConfigurationError(errorMessage, result.errorCode)\n }\n\n if (result.isFallback) {\n log.warn({ reason: \"application icon is not set\" }, `default ${capitalizeFirstLetter(this.info.framework.name)} icon is used`)\n }\n\n return result.icons || []\n }\n}\n\nexport interface IconInfo {\n file: string\n size: number\n}\n\ninterface IconConvertResult {\n icons?: Array<IconInfo>\n\n error?: string\n errorCode?: string\n isFallback?: boolean\n}\n\nexport type IconFormat = \"icns\" | \"ico\" | \"set\"\n\nexport function isSafeGithubName(name: string) {\n return /^[0-9A-Za-z._-]+$/.test(name)\n}\n\nexport function computeSafeArtifactNameIfNeeded(suggestedName: string | null, safeNameProducer: () => string): string | null {\n // GitHub only allows the listed characters in file names.\n if (suggestedName != null) {\n if (isSafeGithubName(suggestedName)) {\n return null\n }\n\n // prefer to use suggested name - so, if space is the only problem, just replace only space to dash\n suggestedName = suggestedName.replace(/ /g, \"-\")\n if (isSafeGithubName(suggestedName)) {\n return suggestedName\n }\n }\n\n return safeNameProducer()\n}\n\n// remove leading dot\nexport function normalizeExt(ext: string) {\n return ext.startsWith(\".\") ? ext.substring(1) : ext\n}\n\nexport function chooseNotNull<T>(v1: T | null | undefined, v2: T | null | undefined): T | null | undefined {\n return v1 == null ? v2 : v1\n}\n\nfunction capitalizeFirstLetter(text: string) {\n return text.charAt(0).toUpperCase() + text.slice(1)\n}\n"]}
|
package/out/targets/FpmTarget.js
CHANGED
|
@@ -42,10 +42,11 @@ class FpmTarget extends core_1.Target {
|
|
|
42
42
|
}
|
|
43
43
|
return path.resolve(packager.projectDir, value);
|
|
44
44
|
}
|
|
45
|
-
return
|
|
46
|
-
writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterInstall, "after-install.tpl"), templateOptions),
|
|
47
|
-
writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterRemove, "after-remove.tpl"), templateOptions),
|
|
48
|
-
|
|
45
|
+
return {
|
|
46
|
+
afterInstall: await writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterInstall, "after-install.tpl"), templateOptions),
|
|
47
|
+
afterRemove: await writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterRemove, "after-remove.tpl"), templateOptions),
|
|
48
|
+
appArmor: await writeConfigFile(packager.info.tempDirManager, getResource(this.options.appArmorProfile, "apparmor-profile.tpl"), templateOptions),
|
|
49
|
+
};
|
|
49
50
|
}
|
|
50
51
|
checkOptions() {
|
|
51
52
|
return this.computeFpmMetaInfoOptions();
|
|
@@ -105,18 +106,21 @@ class FpmTarget extends core_1.Target {
|
|
|
105
106
|
if (packager.packagerOptions.prepackaged != null) {
|
|
106
107
|
await (0, promises_1.mkdir)(this.outDir, { recursive: true });
|
|
107
108
|
}
|
|
109
|
+
const linuxDistType = packager.packagerOptions.prepackaged || path.join(this.outDir, `linux${(0, builder_util_1.getArchSuffix)(arch)}-unpacked`);
|
|
110
|
+
const resourceDir = packager.getResourcesDir(linuxDistType);
|
|
108
111
|
const publishConfig = this.supportsAutoUpdate(target)
|
|
109
112
|
? await (0, PublishManager_1.getAppUpdatePublishConfiguration)(packager, arch, false /* in any case validation will be done on publish */)
|
|
110
113
|
: null;
|
|
111
114
|
if (publishConfig != null) {
|
|
112
|
-
const linuxDistType = this.packager.packagerOptions.prepackaged || path.join(this.outDir, `linux${(0, builder_util_1.getArchSuffix)(arch)}-unpacked`);
|
|
113
|
-
const resourceDir = packager.getResourcesDir(linuxDistType);
|
|
114
115
|
builder_util_1.log.info({ resourceDir: builder_util_1.log.filePath(resourceDir) }, `adding autoupdate files for: ${target}. (Beta feature)`);
|
|
115
116
|
await (0, fs_extra_1.outputFile)(path.join(resourceDir, "app-update.yml"), (0, builder_util_1.serializeToYaml)(publishConfig));
|
|
116
117
|
// Extra file needed for auto-updater to detect installation method
|
|
117
118
|
await (0, fs_extra_1.outputFile)(path.join(resourceDir, "package-type"), target);
|
|
118
119
|
}
|
|
119
120
|
const scripts = await this.scriptFiles;
|
|
121
|
+
// Install AppArmor support for ubuntu 24+
|
|
122
|
+
// https://github.com/electron-userland/electron-builder/issues/8635
|
|
123
|
+
await (0, fs_extra_1.copyFile)(scripts.appArmor, path.join(resourceDir, "apparmor-profile"));
|
|
120
124
|
const appInfo = packager.appInfo;
|
|
121
125
|
const options = this.options;
|
|
122
126
|
const synopsis = options.synopsis;
|
|
@@ -124,9 +128,9 @@ class FpmTarget extends core_1.Target {
|
|
|
124
128
|
"--architecture",
|
|
125
129
|
(0, builder_util_1.toLinuxArchString)(arch, target),
|
|
126
130
|
"--after-install",
|
|
127
|
-
scripts
|
|
131
|
+
scripts.afterInstall,
|
|
128
132
|
"--after-remove",
|
|
129
|
-
scripts
|
|
133
|
+
scripts.afterRemove,
|
|
130
134
|
"--description",
|
|
131
135
|
(0, appInfo_1.smarten)(target === "rpm" ? this.helper.getDescription(options) : `${synopsis || ""}\n ${this.helper.getDescription(options)}`),
|
|
132
136
|
"--version",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FpmTarget.js","sourceRoot":"","sources":["../../src/targets/FpmTarget.ts"],"names":[],"mappings":";;AAAA,+CAAoI;AACpI,+CAA6C;AAC7C,uCAA2C;AAC3C,0CAA6C;AAC7C,6BAA4B;AAC5B,wCAAoC;AACpC,kCAAgC;AAChC,kDAAiD;AAGjD,mDAAiD;AACjD,qDAAgD;AAChD,uDAAoD;AACpD,qDAAqD;AACrD,2DAAsE;AACtE,mCAA2C;AAC3C,uCAAuC;AAEvC,8DAA4E;AAC5E,+CAAyC;AASzC,MAAqB,SAAU,SAAQ,aAAM;IAK3C,YACE,IAAY,EACK,QAAuB,EACvB,MAAyB,EACjC,MAAc;QAEvB,KAAK,CAAC,I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AAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAClD,CAAC;CACF;AA9PD,4BA8PC;AAUD,KAAK,UAAU,eAAe,CAAC,MAAc,EAAE,YAAoB,EAAE,OAAY;IAC/E,mCAAmC;IACnC,SAAS,QAAQ,CAAC,KAAa,EAAE,EAAU;QACzC,IAAI,EAAE,IAAI,OAAO,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,EAAE,CAAC,CAAA;QACpB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,mBAAQ,EAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;QACrI,kBAAG,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAA;QACvE,OAAO,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;IACnC,CAAC,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IAC5F,MAAM,IAAA,qBAAU,EAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACpC,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import { Arch, executeAppBuilder, getArchSuffix, log, TmpDir, toLinuxArchString, use, serializeToYaml, asArray } from \"builder-util\"\nimport { unlinkIfExists } from \"builder-util\"\nimport { outputFile, stat } from \"fs-extra\"\nimport { mkdir, readFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { smarten } from \"../appInfo\"\nimport { Target } from \"../core\"\nimport * as errorMessages from \"../errorMessages\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { DebOptions, LinuxTargetSpecificOptions } from \"../options/linuxOptions\"\nimport { objectToArgs } from \"../util/appBuilder\"\nimport { computeEnv } from \"../util/bundledTool\"\nimport { isMacOsSierra } from \"../util/macosVersion\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { installPrefix, LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { getLinuxToolsPath } from \"./tools\"\nimport { hashFile } from \"../util/hash\"\nimport { ArtifactCreated } from \"../packagerApi\"\nimport { getAppUpdatePublishConfiguration } from \"../publish/PublishManager\"\nimport { getPath7za } from \"builder-util\"\n\ninterface FpmOptions {\n name: string\n maintainer: string | undefined\n vendor: string\n url: string\n}\n\nexport default class FpmTarget extends Target {\n readonly options: LinuxTargetSpecificOptions = { ...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name] }\n\n private readonly scriptFiles: Promise<Array<string>>\n\n constructor(\n name: string,\n private readonly packager: LinuxPackager,\n private readonly helper: LinuxTargetHelper,\n readonly outDir: string\n ) {\n super(name, false)\n\n this.scriptFiles = this.createScripts()\n }\n\n private async createScripts(): Promise<Array<string>> {\n const defaultTemplatesDir = getTemplatePath(\"linux\")\n\n const packager = this.packager\n const templateOptions = {\n // old API compatibility\n executable: packager.executableName,\n sanitizedProductName: packager.appInfo.sanitizedProductName,\n productFilename: packager.appInfo.productFilename,\n ...packager.platformSpecificBuildOptions,\n }\n\n function getResource(value: string | null | undefined, defaultFile: string) {\n if (value == null) {\n return path.join(defaultTemplatesDir, defaultFile)\n }\n return path.resolve(packager.projectDir, value)\n }\n\n return await Promise.all<string>([\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterInstall, \"after-install.tpl\"), templateOptions),\n writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterRemove, \"after-remove.tpl\"), templateOptions),\n ])\n }\n\n checkOptions(): Promise<any> {\n return this.computeFpmMetaInfoOptions()\n }\n\n private async computeFpmMetaInfoOptions(): Promise<FpmOptions> {\n const packager = this.packager\n const projectUrl = await packager.appInfo.computePackageUrl()\n const errors: Array<string> = []\n if (projectUrl == null) {\n errors.push(\"Please specify project homepage, see https://electron.build./configuration.md#Metadata-homepage\")\n }\n\n const options = this.options\n let author = options.maintainer\n if (author == null) {\n const a = packager.info.metadata.author\n if (a == null || a.email == null) {\n errors.push(errorMessages.authorEmailIsMissed)\n } else {\n author = `${a.name} <${a.email}>`\n }\n }\n\n if (errors.length > 0) {\n throw new Error(errors.join(\"\\n\\n\"))\n }\n\n return {\n name: options.packageName ?? this.packager.appInfo.linuxPackageName,\n maintainer: author!,\n url: projectUrl!,\n vendor: options.vendor || author!,\n }\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const target = this.name\n\n // tslint:disable:no-invalid-template-strings\n let nameFormat = \"${name}-${version}-${arch}.${ext}\"\n let isUseArchIfX64 = false\n if (target === \"deb\") {\n nameFormat = \"${name}_${version}_${arch}.${ext}\"\n isUseArchIfX64 = true\n } else if (target === \"rpm\") {\n nameFormat = \"${name}-${version}.${arch}.${ext}\"\n isUseArchIfX64 = true\n }\n\n const packager = this.packager\n const artifactName = packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: target,\n file: artifactPath,\n arch,\n })\n\n await unlinkIfExists(artifactPath)\n if (packager.packagerOptions.prepackaged != null) {\n await mkdir(this.outDir, { recursive: true })\n }\n\n const publishConfig = this.supportsAutoUpdate(target)\n ? await getAppUpdatePublishConfiguration(packager, arch, false /* in any case validation will be done on publish */)\n : null\n if (publishConfig != null) {\n const linuxDistType = this.packager.packagerOptions.prepackaged || path.join(this.outDir, `linux${getArchSuffix(arch)}-unpacked`)\n const resourceDir = packager.getResourcesDir(linuxDistType)\n log.info({ resourceDir: log.filePath(resourceDir) }, `adding autoupdate files for: ${target}. (Beta feature)`)\n await outputFile(path.join(resourceDir, \"app-update.yml\"), serializeToYaml(publishConfig))\n // Extra file needed for auto-updater to detect installation method\n await outputFile(path.join(resourceDir, \"package-type\"), target)\n }\n\n const scripts = await this.scriptFiles\n const appInfo = packager.appInfo\n const options = this.options\n const synopsis = options.synopsis\n const args = [\n \"--architecture\",\n toLinuxArchString(arch, target),\n \"--after-install\",\n scripts[0],\n \"--after-remove\",\n scripts[1],\n \"--description\",\n smarten(target === \"rpm\" ? this.helper.getDescription(options) : `${synopsis || \"\"}\\n ${this.helper.getDescription(options)}`),\n \"--version\",\n this.helper.getSanitizedVersion(target),\n \"--package\",\n artifactPath,\n ]\n\n objectToArgs(args, (await this.computeFpmMetaInfoOptions()) as any)\n\n const packageCategory = options.packageCategory\n if (packageCategory != null) {\n args.push(\"--category\", packageCategory)\n }\n\n if (target === \"deb\") {\n args.push(\"--deb-priority\", (options as DebOptions).priority ?? \"optional\")\n } else if (target === \"rpm\") {\n if (synopsis != null) {\n args.push(\"--rpm-summary\", smarten(synopsis))\n }\n }\n\n const fpmConfiguration: FpmConfiguration = {\n args,\n target,\n }\n\n if (options.compression != null) {\n fpmConfiguration.compression = options.compression\n }\n\n // noinspection JSDeprecatedSymbols\n const depends = options.depends\n if (depends != null) {\n if (Array.isArray(depends)) {\n fpmConfiguration.customDepends = depends\n } else {\n // noinspection SuspiciousTypeOfGuard\n if (typeof depends === \"string\") {\n fpmConfiguration.customDepends = [depends as string]\n } else {\n throw new Error(`depends must be Array or String, but specified as: ${depends}`)\n }\n }\n }\n\n if (target === \"deb\") {\n const recommends = (options as DebOptions).recommends\n if (recommends) {\n fpmConfiguration.customRecommends = asArray(recommends)\n }\n }\n\n use(packager.info.metadata.license, it => args.push(\"--license\", it))\n use(appInfo.buildNumber, it =>\n args.push(\n \"--iteration\",\n // dashes are not supported for iteration in older versions of fpm\n // https://github.com/jordansissel/fpm/issues/1833\n it.split(\"-\").join(\"_\")\n )\n )\n\n use(options.fpm, it => args.push(...it))\n\n args.push(`${appOutDir}/=${installPrefix}/${appInfo.sanitizedProductName}`)\n for (const icon of await this.helper.icons) {\n const extWithDot = path.extname(icon.file)\n const sizeName = extWithDot === \".svg\" ? \"scalable\" : `${icon.size}x${icon.size}`\n args.push(`${icon.file}=/usr/share/icons/hicolor/${sizeName}/apps/${packager.executableName}${extWithDot}`)\n }\n\n const mimeTypeFilePath = await this.helper.mimeTypeFiles\n if (mimeTypeFilePath != null) {\n args.push(`${mimeTypeFilePath}=/usr/share/mime/packages/${packager.executableName}.xml`)\n }\n\n const desktopFilePath = await this.helper.writeDesktopEntry(this.options)\n args.push(`${desktopFilePath}=/usr/share/applications/${packager.executableName}.desktop`)\n\n if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed([args, desktopFilePath]))) {\n return\n }\n\n const env = {\n ...process.env,\n SZA_PATH: await getPath7za(),\n SZA_COMPRESSION_LEVEL: packager.compression === \"store\" ? \"0\" : \"9\",\n }\n\n // rpmbuild wants directory rpm with some default config files. Even if we can use dylibbundler, path to such config files are not changed (we need to replace in the binary)\n // so, for now, brew install rpm is still required.\n if (target !== \"rpm\" && (await isMacOsSierra())) {\n const linuxToolsPath = await getLinuxToolsPath()\n Object.assign(env, {\n PATH: computeEnv(process.env.PATH, [path.join(linuxToolsPath, \"bin\")]),\n DYLD_LIBRARY_PATH: computeEnv(process.env.DYLD_LIBRARY_PATH, [path.join(linuxToolsPath, \"lib\")]),\n })\n }\n\n await executeAppBuilder([\"fpm\", \"--configuration\", JSON.stringify(fpmConfiguration)], undefined, { env })\n\n let info: ArtifactCreated = {\n file: artifactPath,\n target: this,\n arch,\n packager,\n }\n if (publishConfig != null) {\n info = {\n ...info,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, target, arch, !isUseArchIfX64),\n isWriteUpdateInfo: true,\n updateInfo: {\n sha512: await hashFile(artifactPath),\n size: (await stat(artifactPath)).size,\n },\n }\n }\n await packager.info.callArtifactBuildCompleted(info)\n }\n\n private supportsAutoUpdate(target: string) {\n return [\"deb\", \"rpm\", \"pacman\"].includes(target)\n }\n}\n\ninterface FpmConfiguration {\n target: string\n args: Array<string>\n customDepends?: Array<string>\n customRecommends?: Array<string>\n compression?: string | null\n}\n\nasync function writeConfigFile(tmpDir: TmpDir, templatePath: string, options: any): Promise<string> {\n //noinspection JSUnusedLocalSymbols\n function replacer(match: string, p1: string) {\n if (p1 in options) {\n return options[p1]\n } else {\n throw new Error(`Macro ${p1} is not defined`)\n }\n }\n const config = (await readFile(templatePath, \"utf8\")).replace(/\\${([a-zA-Z]+)}/g, replacer).replace(/<%=([a-zA-Z]+)%>/g, (match, p1) => {\n log.warn(\"<%= varName %> is deprecated, please use ${varName} instead\")\n return replacer(match, p1.trim())\n })\n\n const outputPath = await tmpDir.getTempFile({ suffix: path.basename(templatePath, \".tpl\") })\n await outputFile(outputPath, config)\n return outputPath\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FpmTarget.js","sourceRoot":"","sources":["../../src/targets/FpmTarget.ts"],"names":[],"mappings":";;AAAA,+CAAoI;AACpI,+CAA6C;AAC7C,uCAAqD;AACrD,0CAA6C;AAC7C,6BAA4B;AAC5B,wCAAoC;AACpC,kCAAgC;AAChC,kDAAiD;AAGjD,mDAAiD;AACjD,qDAAgD;AAChD,uDAAoD;AACpD,qDAAqD;AACrD,2DAAsE;AACtE,mCAA2C;AAC3C,uCAAuC;AAEvC,8DAA4E;AAC5E,+CAAyC;AAezC,MAAqB,SAAU,SAAQ,aAAM;IAK3C,YACE,IAAY,EACK,QAAuB,EACvB,MAAyB,EACjC,MAAc;QAEvB,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QAJD,aAAQ,GAAR,QAAQ,CAAe;QACvB,WAAM,GAAN,MAAM,CAAmB;QACjC,WAAM,GAAN,MAAM,CAAQ;QARhB,YAAO,GAA+B,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,GAAI,IAAI,CAAC,QAAQ,CAAC,MAAc,CAAC,I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B,CAAC,MAAc;QACvC,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAClD,CAAC;CACF;AApQD,4BAoQC;AAUD,KAAK,UAAU,eAAe,CAAC,MAAc,EAAE,YAAoB,EAAE,OAAY;IAC/E,mCAAmC;IACnC,SAAS,QAAQ,CAAC,KAAa,EAAE,EAAU;QACzC,IAAI,EAAE,IAAI,OAAO,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,EAAE,CAAC,CAAA;QACpB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,CAAC,MAAM,IAAA,mBAAQ,EAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;QACrI,kBAAG,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAA;QACvE,OAAO,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;IACnC,CAAC,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IAC5F,MAAM,IAAA,qBAAU,EAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACpC,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import { Arch, executeAppBuilder, getArchSuffix, log, TmpDir, toLinuxArchString, use, serializeToYaml, asArray } from \"builder-util\"\nimport { unlinkIfExists } from \"builder-util\"\nimport { copyFile, outputFile, stat } from \"fs-extra\"\nimport { mkdir, readFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { smarten } from \"../appInfo\"\nimport { Target } from \"../core\"\nimport * as errorMessages from \"../errorMessages\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { DebOptions, LinuxTargetSpecificOptions } from \"../options/linuxOptions\"\nimport { objectToArgs } from \"../util/appBuilder\"\nimport { computeEnv } from \"../util/bundledTool\"\nimport { isMacOsSierra } from \"../util/macosVersion\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { installPrefix, LinuxTargetHelper } from \"./LinuxTargetHelper\"\nimport { getLinuxToolsPath } from \"./tools\"\nimport { hashFile } from \"../util/hash\"\nimport { ArtifactCreated } from \"../packagerApi\"\nimport { getAppUpdatePublishConfiguration } from \"../publish/PublishManager\"\nimport { getPath7za } from \"builder-util\"\n\ninterface FpmOptions {\n name: string\n maintainer: string | undefined\n vendor: string\n url: string\n}\n\ninterface ScriptFiles {\n afterRemove: string\n afterInstall: string\n appArmor: string\n}\n\nexport default class FpmTarget extends Target {\n readonly options: LinuxTargetSpecificOptions = { ...this.packager.platformSpecificBuildOptions, ...(this.packager.config as any)[this.name] }\n\n private readonly scriptFiles: Promise<ScriptFiles>\n\n constructor(\n name: string,\n private readonly packager: LinuxPackager,\n private readonly helper: LinuxTargetHelper,\n readonly outDir: string\n ) {\n super(name, false)\n\n this.scriptFiles = this.createScripts()\n }\n\n private async createScripts(): Promise<ScriptFiles> {\n const defaultTemplatesDir = getTemplatePath(\"linux\")\n\n const packager = this.packager\n const templateOptions = {\n // old API compatibility\n executable: packager.executableName,\n sanitizedProductName: packager.appInfo.sanitizedProductName,\n productFilename: packager.appInfo.productFilename,\n ...packager.platformSpecificBuildOptions,\n }\n\n function getResource(value: string | null | undefined, defaultFile: string) {\n if (value == null) {\n return path.join(defaultTemplatesDir, defaultFile)\n }\n return path.resolve(packager.projectDir, value)\n }\n\n return {\n afterInstall: await writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterInstall, \"after-install.tpl\"), templateOptions),\n afterRemove: await writeConfigFile(packager.info.tempDirManager, getResource(this.options.afterRemove, \"after-remove.tpl\"), templateOptions),\n appArmor: await writeConfigFile(packager.info.tempDirManager, getResource(this.options.appArmorProfile, \"apparmor-profile.tpl\"), templateOptions),\n }\n }\n\n checkOptions(): Promise<any> {\n return this.computeFpmMetaInfoOptions()\n }\n\n private async computeFpmMetaInfoOptions(): Promise<FpmOptions> {\n const packager = this.packager\n const projectUrl = await packager.appInfo.computePackageUrl()\n const errors: Array<string> = []\n if (projectUrl == null) {\n errors.push(\"Please specify project homepage, see https://electron.build./configuration.md#Metadata-homepage\")\n }\n\n const options = this.options\n let author = options.maintainer\n if (author == null) {\n const a = packager.info.metadata.author\n if (a == null || a.email == null) {\n errors.push(errorMessages.authorEmailIsMissed)\n } else {\n author = `${a.name} <${a.email}>`\n }\n }\n\n if (errors.length > 0) {\n throw new Error(errors.join(\"\\n\\n\"))\n }\n\n return {\n name: options.packageName ?? this.packager.appInfo.linuxPackageName,\n maintainer: author!,\n url: projectUrl!,\n vendor: options.vendor || author!,\n }\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const target = this.name\n\n // tslint:disable:no-invalid-template-strings\n let nameFormat = \"${name}-${version}-${arch}.${ext}\"\n let isUseArchIfX64 = false\n if (target === \"deb\") {\n nameFormat = \"${name}_${version}_${arch}.${ext}\"\n isUseArchIfX64 = true\n } else if (target === \"rpm\") {\n nameFormat = \"${name}-${version}.${arch}.${ext}\"\n isUseArchIfX64 = true\n }\n\n const packager = this.packager\n const artifactName = packager.expandArtifactNamePattern(this.options, target, arch, nameFormat, !isUseArchIfX64)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: target,\n file: artifactPath,\n arch,\n })\n\n await unlinkIfExists(artifactPath)\n if (packager.packagerOptions.prepackaged != null) {\n await mkdir(this.outDir, { recursive: true })\n }\n const linuxDistType = packager.packagerOptions.prepackaged || path.join(this.outDir, `linux${getArchSuffix(arch)}-unpacked`)\n const resourceDir = packager.getResourcesDir(linuxDistType)\n\n const publishConfig = this.supportsAutoUpdate(target)\n ? await getAppUpdatePublishConfiguration(packager, arch, false /* in any case validation will be done on publish */)\n : null\n if (publishConfig != null) {\n log.info({ resourceDir: log.filePath(resourceDir) }, `adding autoupdate files for: ${target}. (Beta feature)`)\n await outputFile(path.join(resourceDir, \"app-update.yml\"), serializeToYaml(publishConfig))\n // Extra file needed for auto-updater to detect installation method\n await outputFile(path.join(resourceDir, \"package-type\"), target)\n }\n\n const scripts = await this.scriptFiles\n\n // Install AppArmor support for ubuntu 24+\n // https://github.com/electron-userland/electron-builder/issues/8635\n await copyFile(scripts.appArmor, path.join(resourceDir, \"apparmor-profile\"))\n\n const appInfo = packager.appInfo\n const options = this.options\n const synopsis = options.synopsis\n const args = [\n \"--architecture\",\n toLinuxArchString(arch, target),\n \"--after-install\",\n scripts.afterInstall,\n \"--after-remove\",\n scripts.afterRemove,\n \"--description\",\n smarten(target === \"rpm\" ? this.helper.getDescription(options) : `${synopsis || \"\"}\\n ${this.helper.getDescription(options)}`),\n \"--version\",\n this.helper.getSanitizedVersion(target),\n \"--package\",\n artifactPath,\n ]\n\n objectToArgs(args, (await this.computeFpmMetaInfoOptions()) as any)\n\n const packageCategory = options.packageCategory\n if (packageCategory != null) {\n args.push(\"--category\", packageCategory)\n }\n\n if (target === \"deb\") {\n args.push(\"--deb-priority\", (options as DebOptions).priority ?? \"optional\")\n } else if (target === \"rpm\") {\n if (synopsis != null) {\n args.push(\"--rpm-summary\", smarten(synopsis))\n }\n }\n\n const fpmConfiguration: FpmConfiguration = {\n args,\n target,\n }\n\n if (options.compression != null) {\n fpmConfiguration.compression = options.compression\n }\n\n // noinspection JSDeprecatedSymbols\n const depends = options.depends\n if (depends != null) {\n if (Array.isArray(depends)) {\n fpmConfiguration.customDepends = depends\n } else {\n // noinspection SuspiciousTypeOfGuard\n if (typeof depends === \"string\") {\n fpmConfiguration.customDepends = [depends as string]\n } else {\n throw new Error(`depends must be Array or String, but specified as: ${depends}`)\n }\n }\n }\n\n if (target === \"deb\") {\n const recommends = (options as DebOptions).recommends\n if (recommends) {\n fpmConfiguration.customRecommends = asArray(recommends)\n }\n }\n\n use(packager.info.metadata.license, it => args.push(\"--license\", it))\n use(appInfo.buildNumber, it =>\n args.push(\n \"--iteration\",\n // dashes are not supported for iteration in older versions of fpm\n // https://github.com/jordansissel/fpm/issues/1833\n it.split(\"-\").join(\"_\")\n )\n )\n\n use(options.fpm, it => args.push(...it))\n\n args.push(`${appOutDir}/=${installPrefix}/${appInfo.sanitizedProductName}`)\n for (const icon of await this.helper.icons) {\n const extWithDot = path.extname(icon.file)\n const sizeName = extWithDot === \".svg\" ? \"scalable\" : `${icon.size}x${icon.size}`\n args.push(`${icon.file}=/usr/share/icons/hicolor/${sizeName}/apps/${packager.executableName}${extWithDot}`)\n }\n\n const mimeTypeFilePath = await this.helper.mimeTypeFiles\n if (mimeTypeFilePath != null) {\n args.push(`${mimeTypeFilePath}=/usr/share/mime/packages/${packager.executableName}.xml`)\n }\n\n const desktopFilePath = await this.helper.writeDesktopEntry(this.options)\n args.push(`${desktopFilePath}=/usr/share/applications/${packager.executableName}.desktop`)\n\n if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed([args, desktopFilePath]))) {\n return\n }\n\n const env = {\n ...process.env,\n SZA_PATH: await getPath7za(),\n SZA_COMPRESSION_LEVEL: packager.compression === \"store\" ? \"0\" : \"9\",\n }\n\n // rpmbuild wants directory rpm with some default config files. Even if we can use dylibbundler, path to such config files are not changed (we need to replace in the binary)\n // so, for now, brew install rpm is still required.\n if (target !== \"rpm\" && (await isMacOsSierra())) {\n const linuxToolsPath = await getLinuxToolsPath()\n Object.assign(env, {\n PATH: computeEnv(process.env.PATH, [path.join(linuxToolsPath, \"bin\")]),\n DYLD_LIBRARY_PATH: computeEnv(process.env.DYLD_LIBRARY_PATH, [path.join(linuxToolsPath, \"lib\")]),\n })\n }\n\n await executeAppBuilder([\"fpm\", \"--configuration\", JSON.stringify(fpmConfiguration)], undefined, { env })\n\n let info: ArtifactCreated = {\n file: artifactPath,\n target: this,\n arch,\n packager,\n }\n if (publishConfig != null) {\n info = {\n ...info,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, target, arch, !isUseArchIfX64),\n isWriteUpdateInfo: true,\n updateInfo: {\n sha512: await hashFile(artifactPath),\n size: (await stat(artifactPath)).size,\n },\n }\n }\n await packager.info.callArtifactBuildCompleted(info)\n }\n\n private supportsAutoUpdate(target: string) {\n return [\"deb\", \"rpm\", \"pacman\"].includes(target)\n }\n}\n\ninterface FpmConfiguration {\n target: string\n args: Array<string>\n customDepends?: Array<string>\n customRecommends?: Array<string>\n compression?: string | null\n}\n\nasync function writeConfigFile(tmpDir: TmpDir, templatePath: string, options: any): Promise<string> {\n //noinspection JSUnusedLocalSymbols\n function replacer(match: string, p1: string) {\n if (p1 in options) {\n return options[p1]\n } else {\n throw new Error(`Macro ${p1} is not defined`)\n }\n }\n const config = (await readFile(templatePath, \"utf8\")).replace(/\\${([a-zA-Z]+)}/g, replacer).replace(/<%=([a-zA-Z]+)%>/g, (match, p1) => {\n log.warn(\"<%= varName %> is deprecated, please use ${varName} instead\")\n return replacer(match, p1.trim())\n })\n\n const outputPath = await tmpDir.getTempFile({ suffix: path.basename(templatePath, \".tpl\") })\n await outputFile(outputPath, config)\n return outputPath\n}\n"]}
|
package/out/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "26.0.0-alpha.
|
|
1
|
+
export declare const PACKAGE_VERSION = "26.0.0-alpha.6";
|
package/out/version.js
CHANGED
package/out/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.0.0-alpha.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.0.0-alpha.6\"\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "app-builder-lib",
|
|
3
3
|
"description": "electron-builder lib",
|
|
4
|
-
"version": "26.0.0-alpha.
|
|
4
|
+
"version": "26.0.0-alpha.6",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"out",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@develar/schema-utils": "~2.6.5",
|
|
50
50
|
"@electron/fuses": "^1.8.0",
|
|
51
|
-
"@electron/asar": "
|
|
51
|
+
"@electron/asar": "3.2.17",
|
|
52
52
|
"@electron/notarize": "2.5.0",
|
|
53
53
|
"@electron/osx-sign": "1.3.1",
|
|
54
54
|
"@electron/rebuild": "3.7.0",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"semver": "^7.3.8",
|
|
76
76
|
"tar": "^6.1.12",
|
|
77
77
|
"temp-file": "^3.4.0",
|
|
78
|
+
"electron-publish": "26.0.0-alpha.4",
|
|
78
79
|
"builder-util": "26.0.0-alpha.3",
|
|
79
|
-
"builder-util-runtime": "9.2.10"
|
|
80
|
-
"electron-publish": "26.0.0-alpha.4"
|
|
80
|
+
"builder-util-runtime": "9.2.10"
|
|
81
81
|
},
|
|
82
82
|
"///": "babel in devDependencies for proton tests",
|
|
83
83
|
"devDependencies": {
|
|
@@ -108,12 +108,12 @@
|
|
|
108
108
|
"@types/semver": "7.3.8",
|
|
109
109
|
"@types/tar": "^6.1.3",
|
|
110
110
|
"toml": "^3.0.0",
|
|
111
|
-
"
|
|
112
|
-
"
|
|
111
|
+
"electron-builder-squirrel-windows": "26.0.0-alpha.6",
|
|
112
|
+
"dmg-builder": "26.0.0-alpha.6"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
115
|
-
"
|
|
116
|
-
"
|
|
115
|
+
"electron-builder-squirrel-windows": "26.0.0-alpha.6",
|
|
116
|
+
"dmg-builder": "26.0.0-alpha.6"
|
|
117
117
|
},
|
|
118
118
|
"//": "electron-builder-squirrel-windows and dmg-builder added as dev dep for tests (as otherwise `require` doesn't work using Yarn 2)",
|
|
119
119
|
"typings": "./out/index.d.ts"
|
package/scheme.json
CHANGED
|
@@ -519,12 +519,21 @@
|
|
|
519
519
|
"additionalProperties": false,
|
|
520
520
|
"properties": {
|
|
521
521
|
"afterInstall": {
|
|
522
|
+
"description": "File path to script to be passed to FPM for `--after-install` arg.",
|
|
522
523
|
"type": [
|
|
523
524
|
"null",
|
|
524
525
|
"string"
|
|
525
526
|
]
|
|
526
527
|
},
|
|
527
528
|
"afterRemove": {
|
|
529
|
+
"description": "File path to script to be passed to FPM for `--after-remove` arg.",
|
|
530
|
+
"type": [
|
|
531
|
+
"null",
|
|
532
|
+
"string"
|
|
533
|
+
]
|
|
534
|
+
},
|
|
535
|
+
"appArmorProfile": {
|
|
536
|
+
"description": "File path to custom AppArmor profile (Ubuntu 24+)",
|
|
528
537
|
"type": [
|
|
529
538
|
"null",
|
|
530
539
|
"string"
|
|
@@ -2050,12 +2059,21 @@
|
|
|
2050
2059
|
"additionalProperties": false,
|
|
2051
2060
|
"properties": {
|
|
2052
2061
|
"afterInstall": {
|
|
2062
|
+
"description": "File path to script to be passed to FPM for `--after-install` arg.",
|
|
2053
2063
|
"type": [
|
|
2054
2064
|
"null",
|
|
2055
2065
|
"string"
|
|
2056
2066
|
]
|
|
2057
2067
|
},
|
|
2058
2068
|
"afterRemove": {
|
|
2069
|
+
"description": "File path to script to be passed to FPM for `--after-remove` arg.",
|
|
2070
|
+
"type": [
|
|
2071
|
+
"null",
|
|
2072
|
+
"string"
|
|
2073
|
+
]
|
|
2074
|
+
},
|
|
2075
|
+
"appArmorProfile": {
|
|
2076
|
+
"description": "File path to custom AppArmor profile (Ubuntu 24+)",
|
|
2059
2077
|
"type": [
|
|
2060
2078
|
"null",
|
|
2061
2079
|
"string"
|
|
@@ -25,3 +25,30 @@ fi
|
|
|
25
25
|
if hash update-desktop-database 2>/dev/null; then
|
|
26
26
|
update-desktop-database /usr/share/applications || true
|
|
27
27
|
fi
|
|
28
|
+
|
|
29
|
+
# Install apparmor profile. (Ubuntu 24+)
|
|
30
|
+
# First check if the version of AppArmor running on the device supports our profile.
|
|
31
|
+
# This is in order to keep backwards compatibility with Ubuntu 22.04 which does not support abi/4.0.
|
|
32
|
+
# In that case, we just skip installing the profile since the app runs fine without it on 22.04.
|
|
33
|
+
#
|
|
34
|
+
# Those apparmor_parser flags are akin to performing a dry run of loading a profile.
|
|
35
|
+
# https://wiki.debian.org/AppArmor/HowToUse#Dumping_profiles
|
|
36
|
+
#
|
|
37
|
+
# Unfortunately, at the moment AppArmor doesn't have a good story for backwards compatibility.
|
|
38
|
+
# https://askubuntu.com/questions/1517272/writing-a-backwards-compatible-apparmor-profile
|
|
39
|
+
APPARMOR_PROFILE_SOURCE='/opt/${sanitizedProductName}/resources/apparmor-profile'
|
|
40
|
+
APPARMOR_PROFILE_TARGET='/etc/apparmor.d/${executable}'
|
|
41
|
+
if test -d "/etc/apparmor.d"; then
|
|
42
|
+
if apparmor_parser --skip-kernel-load --debug "$APPARMOR_PROFILE_SOURCE" > /dev/null 2>&1; then
|
|
43
|
+
cp -f "$APPARMOR_PROFILE_SOURCE" "$APPARMOR_PROFILE_TARGET"
|
|
44
|
+
|
|
45
|
+
if hash apparmor_parser 2>/dev/null; then
|
|
46
|
+
# Extra flags taken from dh_apparmor:
|
|
47
|
+
# > By using '-W -T' we ensure that any abstraction updates are also pulled in.
|
|
48
|
+
# https://wiki.debian.org/AppArmor/Contribute/FirstTimeProfileImport
|
|
49
|
+
apparmor_parser --replace --write-cache --skip-read-cache "$APPARMOR_PROFILE_TARGET"
|
|
50
|
+
fi
|
|
51
|
+
else
|
|
52
|
+
echo "Skipping the installation of the AppArmor profile as this version of AppArmor does not seem to support the bundled profile"
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
@@ -6,3 +6,10 @@ if type update-alternatives >/dev/null 2>&1; then
|
|
|
6
6
|
else
|
|
7
7
|
rm -f '/usr/bin/${executable}'
|
|
8
8
|
fi
|
|
9
|
+
|
|
10
|
+
APPARMOR_PROFILE_DEST='/etc/apparmor.d/${executable}'
|
|
11
|
+
|
|
12
|
+
# Remove apparmor profile.
|
|
13
|
+
if [ -f "$APPARMOR_PROFILE_DEST" ]; then
|
|
14
|
+
rm -f "$APPARMOR_PROFILE_DEST"
|
|
15
|
+
fi
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
abi <abi/4.0>,
|
|
2
|
+
include <tunables/global>
|
|
3
|
+
|
|
4
|
+
profile ${executable} "/opt/${sanitizedProductName}/${executable}" flags=(unconfined) {
|
|
5
|
+
userns,
|
|
6
|
+
|
|
7
|
+
# Site-specific additions and overrides. See local/README for details.
|
|
8
|
+
include if exists <local/${executable}>
|
|
9
|
+
}
|