app-builder-lib 23.6.0 → 24.0.0-alpha.10
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/ProtonFramework.js +4 -4
- package/out/ProtonFramework.js.map +1 -1
- package/out/appInfo.js +21 -9
- package/out/appInfo.js.map +1 -1
- package/out/asar/asar.d.ts +12 -0
- package/out/asar/asar.js +10 -11
- package/out/asar/asar.js.map +1 -1
- package/out/asar/asarFileChecker.js +2 -2
- package/out/asar/asarFileChecker.js.map +1 -1
- package/out/asar/asarUtil.js +13 -13
- package/out/asar/asarUtil.js.map +1 -1
- package/out/asar/integrity.js +9 -9
- package/out/asar/integrity.js.map +1 -1
- package/out/asar/unpackDetector.js +6 -6
- package/out/asar/unpackDetector.js.map +1 -1
- package/out/binDownload.js +2 -2
- package/out/binDownload.js.map +1 -1
- package/out/codeSign/codesign.js +4 -4
- package/out/codeSign/codesign.js.map +1 -1
- package/out/codeSign/macCodeSign.d.ts +2 -2
- package/out/codeSign/macCodeSign.js +26 -26
- package/out/codeSign/macCodeSign.js.map +1 -1
- package/out/codeSign/windowsCodeSign.js +16 -15
- package/out/codeSign/windowsCodeSign.js.map +1 -1
- package/out/core.js +1 -1
- package/out/core.js.map +1 -1
- package/out/electron/ElectronFramework.js +17 -17
- package/out/electron/ElectronFramework.js.map +1 -1
- package/out/electron/electronMac.js +16 -16
- package/out/electron/electronMac.js.map +1 -1
- package/out/electron/electronVersion.js +5 -5
- package/out/electron/electronVersion.js.map +1 -1
- package/out/fileMatcher.js +11 -11
- package/out/fileMatcher.js.map +1 -1
- package/out/fileTransformer.js +5 -5
- package/out/fileTransformer.js.map +1 -1
- package/out/forge-maker.js +1 -1
- package/out/forge-maker.js.map +1 -1
- package/out/frameworks/LibUiFramework.js +10 -10
- package/out/frameworks/LibUiFramework.js.map +1 -1
- package/out/index.js +3 -3
- package/out/index.js.map +1 -1
- package/out/linuxPackager.js +3 -3
- package/out/linuxPackager.js.map +1 -1
- package/out/macPackager.d.ts +3 -1
- package/out/macPackager.js +80 -31
- package/out/macPackager.js.map +1 -1
- package/out/options/CommonWindowsInstallerConfiguration.js +3 -3
- package/out/options/CommonWindowsInstallerConfiguration.js.map +1 -1
- package/out/options/SnapOptions.d.ts +4 -0
- package/out/options/SnapOptions.js.map +1 -1
- package/out/options/macOptions.d.ts +27 -5
- package/out/options/macOptions.js.map +1 -1
- package/out/packager.js +34 -34
- package/out/packager.js.map +1 -1
- package/out/platformPackager.js +39 -39
- package/out/platformPackager.js.map +1 -1
- package/out/presets/rectCra.js +1 -1
- package/out/presets/rectCra.js.map +1 -1
- package/out/publish/BitbucketPublisher.js +5 -5
- package/out/publish/BitbucketPublisher.js.map +1 -1
- package/out/publish/KeygenPublisher.js +7 -7
- package/out/publish/KeygenPublisher.js.map +1 -1
- package/out/publish/PublishManager.d.ts +0 -1
- package/out/publish/PublishManager.js +24 -28
- package/out/publish/PublishManager.js.map +1 -1
- package/out/publish/SnapStorePublisher.js +1 -1
- package/out/publish/SnapStorePublisher.js.map +1 -1
- package/out/publish/s3/BaseS3Publisher.js +3 -3
- package/out/publish/s3/BaseS3Publisher.js.map +1 -1
- package/out/publish/s3/s3Publisher.js +1 -1
- package/out/publish/s3/s3Publisher.js.map +1 -1
- package/out/publish/s3/spacesPublisher.js +2 -2
- package/out/publish/s3/spacesPublisher.js.map +1 -1
- package/out/publish/updateInfoBuilder.js +9 -9
- package/out/publish/updateInfoBuilder.js.map +1 -1
- package/out/remoteBuilder/ProjectInfoManager.js +1 -1
- package/out/remoteBuilder/ProjectInfoManager.js.map +1 -1
- package/out/remoteBuilder/RemoteBuilder.js +3 -3
- package/out/remoteBuilder/RemoteBuilder.js.map +1 -1
- package/out/remoteBuilder/builder-cli.js +3 -3
- package/out/remoteBuilder/builder-cli.js.map +1 -1
- package/out/targets/AppImageTarget.js +6 -6
- package/out/targets/AppImageTarget.js.map +1 -1
- package/out/targets/AppxTarget.js +19 -19
- package/out/targets/AppxTarget.js.map +1 -1
- package/out/targets/ArchiveTarget.js +7 -7
- package/out/targets/ArchiveTarget.js.map +1 -1
- package/out/targets/FlatpakTarget.js +8 -8
- package/out/targets/FlatpakTarget.js.map +1 -1
- package/out/targets/{fpm.d.ts → FpmTarget.d.ts} +1 -0
- package/out/targets/{fpm.js → FpmTarget.js} +54 -20
- package/out/targets/FpmTarget.js.map +1 -0
- package/out/targets/LinuxTargetHelper.js +9 -9
- package/out/targets/LinuxTargetHelper.js.map +1 -1
- package/out/targets/MsiTarget.js +11 -11
- package/out/targets/MsiTarget.js.map +1 -1
- package/out/targets/archive.js +9 -9
- package/out/targets/archive.js.map +1 -1
- package/out/targets/differentialUpdateInfoBuilder.js +2 -2
- package/out/targets/differentialUpdateInfoBuilder.js.map +1 -1
- package/out/targets/nsis/NsisTarget.js +37 -37
- package/out/targets/nsis/NsisTarget.js.map +1 -1
- package/out/targets/nsis/WebInstallerTarget.js +2 -2
- package/out/targets/nsis/WebInstallerTarget.js.map +1 -1
- package/out/targets/nsis/nsisLang.js +5 -5
- package/out/targets/nsis/nsisLang.js.map +1 -1
- package/out/targets/nsis/nsisLicense.js +2 -2
- package/out/targets/nsis/nsisLicense.js.map +1 -1
- package/out/targets/nsis/nsisUtil.js +5 -5
- package/out/targets/nsis/nsisUtil.js.map +1 -1
- package/out/targets/pkg.js +19 -25
- package/out/targets/pkg.js.map +1 -1
- package/out/targets/snap.js +22 -11
- package/out/targets/snap.js.map +1 -1
- package/out/targets/targetFactory.js +4 -4
- package/out/targets/targetFactory.js.map +1 -1
- package/out/targets/tools.js +1 -1
- package/out/targets/tools.js.map +1 -1
- package/out/util/AppFileWalker.js +2 -2
- package/out/util/AppFileWalker.js.map +1 -1
- package/out/util/NodeModuleCopyHelper.js +3 -3
- package/out/util/NodeModuleCopyHelper.js.map +1 -1
- package/out/util/appBuilder.js +2 -2
- package/out/util/appBuilder.js.map +1 -1
- package/out/util/appFileCopier.d.ts +1 -0
- package/out/util/appFileCopier.js +10 -9
- package/out/util/appFileCopier.js.map +1 -1
- package/out/util/cacheManager.js +5 -5
- package/out/util/cacheManager.js.map +1 -1
- package/out/util/config.js +10 -10
- package/out/util/config.js.map +1 -1
- package/out/util/flags.js +2 -2
- package/out/util/flags.js.map +1 -1
- package/out/util/hash.js +2 -2
- package/out/util/hash.js.map +1 -1
- package/out/util/license.js +2 -2
- package/out/util/license.js.map +1 -1
- package/out/util/macosVersion.js +3 -3
- package/out/util/macosVersion.js.map +1 -1
- package/out/util/normalizePackageData.js +4 -4
- package/out/util/normalizePackageData.js.map +1 -1
- package/out/util/packageDependencies.js +1 -1
- package/out/util/packageDependencies.js.map +1 -1
- package/out/util/packageMetadata.js +8 -8
- package/out/util/packageMetadata.js.map +1 -1
- package/out/util/repositoryInfo.js +2 -2
- package/out/util/repositoryInfo.js.map +1 -1
- package/out/util/yarn.d.ts +1 -1
- package/out/util/yarn.js +27 -38
- package/out/util/yarn.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/out/vm/MonoVm.js +2 -2
- package/out/vm/MonoVm.js.map +1 -1
- package/out/vm/ParallelsVm.js +6 -6
- package/out/vm/ParallelsVm.js.map +1 -1
- package/out/vm/WineVm.js +1 -1
- package/out/vm/WineVm.js.map +1 -1
- package/out/vm/vm.js +2 -2
- package/out/vm/vm.js.map +1 -1
- package/out/winPackager.js +25 -25
- package/out/winPackager.js.map +1 -1
- package/out/wine.js +2 -2
- package/out/wine.js.map +1 -1
- package/package.json +17 -15
- package/scheme.json +96 -18
- package/templates/nsis/installSection.nsh +4 -1
- package/out/targets/fpm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nsisLang.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisLang.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AACtC,4CAAyF;AACzF,iCAA0B;AAC1B,uCAA+C;AAC/C,qCAA8B;AAC9B,6BAA4B;AAI5B,yCAA6C;AAE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C,CAAA;SACxC;QAED,IAAI,gBAAgB,CAAC,WAAW,EAAE;YAChC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;YAC3E,KAAK,MAAM,cAAc,IAAI,gBAAgB,EAAE;gBAC7C,MAAM,CAAC,IAAI,CAAC,cAAc,SAAS,IAAI,YAAI,CAAC,cAAc,CAAC,KAAK,kBAAkB,GAAG,CAAC,CAAA;aACvF;SACF;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { asArray } from \"builder-util\"\nimport { bundledLanguages, langIdToName, lcid, toLangWithRegion } from \"../../util/langs\"\nimport _debug from \"debug\"\nimport { outputFile, readFile } from \"fs-extra\"\nimport { load } from \"js-yaml\"\nimport * as path from \"path\"\nimport { PlatformPackager } from \"../../platformPackager\"\nimport { NsisOptions } from \"./nsisOptions\"\nimport { NsisScriptGenerator } from \"./nsisScriptGenerator\"\nimport { nsisTemplatesDir } from \"./nsisUtil\"\n\nconst debug = _debug(\"electron-builder:nsis\")\n\nexport class LangConfigurator {\n readonly isMultiLang: boolean\n readonly langs: Array<string>\n\n constructor(options: NsisOptions) {\n const rawList = options.installerLanguages\n\n if (options.unicode === false || rawList === null || (Array.isArray(rawList) && rawList.length === 0)) {\n this.isMultiLang = false\n } else {\n this.isMultiLang = options.multiLanguageInstaller !== false\n }\n\n if (this.isMultiLang) {\n this.langs = rawList == null ? bundledLanguages.slice() : asArray(rawList).map(it => toLangWithRegion(it.replace(\"-\", \"_\")))\n } else {\n this.langs = [\"en_US\"]\n }\n }\n}\n\nexport function createAddLangsMacro(scriptGenerator: NsisScriptGenerator, langConfigurator: LangConfigurator) {\n const result: Array<string> = []\n for (const langWithRegion of langConfigurator.langs) {\n let name: string\n if (langWithRegion === \"zh_CN\") {\n name = \"SimpChinese\"\n } else if (langWithRegion === \"zh_TW\") {\n name = \"TradChinese\"\n } else if (langWithRegion === \"nb_NO\") {\n name = \"Norwegian\"\n } else if (langWithRegion === \"pt_BR\") {\n name = \"PortugueseBR\"\n } else {\n const lang = langWithRegion.substring(0, langWithRegion.indexOf(\"_\"))\n name = (langIdToName as any)[lang]\n if (name == null) {\n throw new Error(`Language name is unknown for ${lang}`)\n }\n\n if (name === \"Spanish\") {\n name = \"SpanishInternational\"\n }\n }\n result.push(`!insertmacro MUI_LANGUAGE \"${name}\"`)\n }\n\n scriptGenerator.macro(\"addLangs\", result)\n}\n\nasync function writeCustomLangFile(data: string, packager: PlatformPackager<any>) {\n const file = await packager.getTempFile(\"messages.nsh\")\n await outputFile(file, data)\n return file\n}\n\nexport async function addCustomMessageFileInclude(input: string, packager: PlatformPackager<any>, scriptGenerator: NsisScriptGenerator, langConfigurator: LangConfigurator) {\n const data = load(await readFile(path.join(nsisTemplatesDir, input), \"utf-8\"))\n const instructions = computeCustomMessageTranslations(data, langConfigurator).join(\"\\n\")\n debug(instructions)\n scriptGenerator.include(await writeCustomLangFile(instructions, packager))\n}\n\nfunction computeCustomMessageTranslations(messages: any, langConfigurator: LangConfigurator): Array<string> {\n const result: Array<string> = []\n const includedLangs = new Set(langConfigurator.langs)\n for (const messageId of Object.keys(messages)) {\n const langToTranslations = messages[messageId]\n const unspecifiedLangs = new Set(langConfigurator.langs)\n for (const lang of Object.keys(langToTranslations)) {\n const langWithRegion = toLangWithRegion(lang)\n\n if (!includedLangs.has(langWithRegion)) {\n continue\n }\n\n const value = langToTranslations[lang]\n if (value == null) {\n throw new Error(`${messageId} not specified for ${lang}`)\n }\n\n result.push(`LangString ${messageId} ${lcid[langWithRegion]} \"${value.replace(/\\n/g, \"$\\\\r$\\\\n\")}\"`)\n unspecifiedLangs.delete(langWithRegion)\n }\n\n if (langConfigurator.isMultiLang) {\n const defaultTranslation = langToTranslations.en.replace(/\\n/g, \"$\\\\r$\\\\n\")\n for (const langWithRegion of unspecifiedLangs) {\n result.push(`LangString ${messageId} ${lcid[langWithRegion]} \"${defaultTranslation}\"`)\n }\n }\n }\n return result\n}\n"]}
|
|
@@ -6,7 +6,7 @@ const license_1 = require("../../util/license");
|
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const nsisUtil_1 = require("./nsisUtil");
|
|
8
8
|
async function computeLicensePage(packager, options, scriptGenerator, languages) {
|
|
9
|
-
const license = await license_1.getNotLocalizedLicenseFile(options.license, packager);
|
|
9
|
+
const license = await (0, license_1.getNotLocalizedLicenseFile)(options.license, packager);
|
|
10
10
|
if (license != null) {
|
|
11
11
|
let licensePage;
|
|
12
12
|
if (license.endsWith(".html")) {
|
|
@@ -29,7 +29,7 @@ async function computeLicensePage(packager, options, scriptGenerator, languages)
|
|
|
29
29
|
}
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const licenseFiles = await license_1.getLicenseFiles(packager);
|
|
32
|
+
const licenseFiles = await (0, license_1.getLicenseFiles)(packager);
|
|
33
33
|
if (licenseFiles.length === 0) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nsisLicense.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisLicense.ts"],"names":[],"mappings":";;;AAAA,4CAAuC;AACvC,gDAAgF;AAChF,6BAA4B;AAI5B,yCAA6C;AAEtC,KAAK,UAAU,kBAAkB,CAAC,QAAqB,EAAE,OAAoB,EAAE,eAAoC,EAAE,SAAwB;IAClJ,MAAM,OAAO,GAAG,MAAM,oCAA0B,
|
|
1
|
+
{"version":3,"file":"nsisLicense.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisLicense.ts"],"names":[],"mappings":";;;AAAA,4CAAuC;AACvC,gDAAgF;AAChF,6BAA4B;AAI5B,yCAA6C;AAEtC,KAAK,UAAU,kBAAkB,CAAC,QAAqB,EAAE,OAAoB,EAAE,eAAoC,EAAE,SAAwB;IAClJ,MAAM,OAAO,GAAG,MAAM,IAAA,oCAA0B,EAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;IAC3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K,MAAM,CAAC,IAAI,gBAAgB,EAAE;QAChC,WAAW,CAAC,IAAI,CAAC,gCAAgC,YAAI,CAAC,CAAC,CAAC,KAAK,WAAW,GAAG,CAAC,CAAA;KAC7E;IAED,WAAW,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAA;IACjE,eAAe,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;AACnD,CAAC;AAjDD,gDAiDC","sourcesContent":["import { lcid } from \"../../util/langs\"\nimport { getLicenseFiles, getNotLocalizedLicenseFile } from \"../../util/license\"\nimport * as path from \"path\"\nimport { WinPackager } from \"../../winPackager\"\nimport { NsisOptions } from \"./nsisOptions\"\nimport { NsisScriptGenerator } from \"./nsisScriptGenerator\"\nimport { nsisTemplatesDir } from \"./nsisUtil\"\n\nexport async function computeLicensePage(packager: WinPackager, options: NsisOptions, scriptGenerator: NsisScriptGenerator, languages: Array<string>): Promise<void> {\n const license = await getNotLocalizedLicenseFile(options.license, packager)\n if (license != null) {\n let licensePage: Array<string>\n if (license.endsWith(\".html\")) {\n licensePage = [\n \"!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow\",\n \"Function LicenseShow\",\n \" FindWindow $R0 `#32770` `` $HWNDPARENT\",\n \" GetDlgItem $R0 $R0 1000\",\n \"EmbedHTML::Load /replace $R0 file://$PLUGINSDIR\\\\license.html\",\n \"FunctionEnd\",\n\n `!insertmacro MUI_PAGE_LICENSE \"${path.join(nsisTemplatesDir, \"empty-license.txt\")}\"`,\n ]\n } else {\n licensePage = [`!insertmacro MUI_PAGE_LICENSE \"${license}\"`]\n }\n\n scriptGenerator.macro(\"licensePage\", licensePage)\n if (license.endsWith(\".html\")) {\n scriptGenerator.macro(\"addLicenseFiles\", [`File /oname=$PLUGINSDIR\\\\license.html \"${license}\"`])\n }\n return\n }\n\n const licenseFiles = await getLicenseFiles(packager)\n if (licenseFiles.length === 0) {\n return\n }\n\n const licensePage: Array<string> = []\n const unspecifiedLangs = new Set(languages)\n\n let defaultFile: string | null = null\n for (const item of licenseFiles) {\n unspecifiedLangs.delete(item.langWithRegion)\n if (defaultFile == null) {\n defaultFile = item.file\n }\n licensePage.push(`LicenseLangString MUILicense ${lcid[item.langWithRegion] || item.lang} \"${item.file}\"`)\n }\n\n for (const l of unspecifiedLangs) {\n licensePage.push(`LicenseLangString MUILicense ${lcid[l]} \"${defaultFile}\"`)\n }\n\n licensePage.push('!insertmacro MUI_PAGE_LICENSE \"$(MUILicense)\"')\n scriptGenerator.macro(\"licensePage\", licensePage)\n}\n"]}
|
|
@@ -8,7 +8,7 @@ const path = require("path");
|
|
|
8
8
|
const pathManager_1 = require("../../util/pathManager");
|
|
9
9
|
const fs = require("fs/promises");
|
|
10
10
|
const zlib = require("zlib");
|
|
11
|
-
exports.nsisTemplatesDir = pathManager_1.getTemplatePath("nsis");
|
|
11
|
+
exports.nsisTemplatesDir = (0, pathManager_1.getTemplatePath)("nsis");
|
|
12
12
|
exports.NsisTargetOptions = (() => {
|
|
13
13
|
let _resolve;
|
|
14
14
|
const promise = new Promise(resolve => (_resolve = resolve));
|
|
@@ -27,12 +27,12 @@ const NSIS_PATH = () => {
|
|
|
27
27
|
const { checksum, url, version } = options.customNsisBinary;
|
|
28
28
|
if (checksum && url) {
|
|
29
29
|
const binaryVersion = version || checksum.substr(0, 8);
|
|
30
|
-
return binDownload_1.getBinFromCustomLoc("nsis", binaryVersion, url, checksum);
|
|
30
|
+
return (0, binDownload_1.getBinFromCustomLoc)("nsis", binaryVersion, url, checksum);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
// Warning: Don't use v3.0.4.2 - https://github.com/electron-userland/electron-builder/issues/6334
|
|
34
34
|
// noinspection SpellCheckingInspection
|
|
35
|
-
return binDownload_1.getBinFromUrl("nsis", "3.0.4.1", "VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==");
|
|
35
|
+
return (0, binDownload_1.getBinFromUrl)("nsis", "3.0.4.1", "VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==");
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
exports.NSIS_PATH = NSIS_PATH;
|
|
@@ -94,9 +94,9 @@ class CopyElevateHelper {
|
|
|
94
94
|
if (promise != null) {
|
|
95
95
|
return promise;
|
|
96
96
|
}
|
|
97
|
-
promise = exports.NSIS_PATH().then(it => {
|
|
97
|
+
promise = (0, exports.NSIS_PATH)().then(it => {
|
|
98
98
|
const outFile = path.join(appOutDir, "resources", "elevate.exe");
|
|
99
|
-
const promise = fs_1.copyFile(path.join(it, "elevate.exe"), outFile, false);
|
|
99
|
+
const promise = (0, fs_1.copyFile)(path.join(it, "elevate.exe"), outFile, false);
|
|
100
100
|
if (target.packager.platformSpecificBuildOptions.signAndEditExecutable !== false) {
|
|
101
101
|
return promise.then(() => target.packager.sign(outFile));
|
|
102
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nsisUtil.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisUtil.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,mDAAsE;AACtE,4CAA8C;AAC9C,6BAA4B;AAC5B,wDAAwD;AAExD,kCAAiC;AACjC,6BAA4B;AAGf,QAAA,gBAAgB,GAAG,6BAAe,CAAC,MAAM,CAAC,CAAA;AAE1C,QAAA,iBAAiB,GAAG,CAAC,GAAG,EAAE;IACrC,IAAI,QAAuC,CAAA;IAC3C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAc,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAA;IACzE,OAAO;QACL,IAAI,EAAE,CAAC,QAAuC,EAAmB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC1F,OAAO,EAAE,CAAC,OAAoB,EAAO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IAAI,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACnC,IAAI,UAAU,EAAE;gBACd,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;aACrC;YACD,MAAM,WAAW,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAA;YAC5C,WAAW,CAAC,MAAM,EAAE,CAAA,CAAC,IAAI;YACzB,IAAI,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;gBACpC,IAAI,WAAW,EAAE;oBACf,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;iBAC1C;gBACD,WAAW,GAAG,MAAM,CAAA;aACrB;SACF;QACD,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;SAC1C;QACD,MAAM,EAAE,CAAC,SAAS,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;QAC/C,MAAM,EAAE,CAAC,UAAU,CAAC,eAAe,EAAE,WAAW,CAAC,CAAA;IACnD,CAAC;CACF;AAtFD,8CAsFC","sourcesContent":["import { Arch, log } from \"builder-util\"\nimport { PackageFileInfo } from \"builder-util-runtime\"\nimport { getBinFromUrl, getBinFromCustomLoc } from \"../../binDownload\"\nimport { copyFile } from \"builder-util/out/fs\"\nimport * as path from \"path\"\nimport { getTemplatePath } from \"../../util/pathManager\"\nimport { NsisTarget } from \"./NsisTarget\"\nimport * as fs from \"fs/promises\"\nimport * as zlib from \"zlib\"\nimport { NsisOptions } from \"./nsisOptions\"\n\nexport const nsisTemplatesDir = getTemplatePath(\"nsis\")\n\nexport const NsisTargetOptions = (() => {\n let _resolve: (options: NsisOptions) => any\n const promise = new Promise<NsisOptions>(resolve => (_resolve = resolve))\n return {\n then: (callback: (options: NsisOptions) => any): Promise<string> => promise.then(callback),\n resolve: (options: NsisOptions): any => _resolve(options),\n }\n})()\n\nexport const NSIS_PATH = () => {\n const custom = process.env.ELECTRON_BUILDER_NSIS_DIR\n if (custom != null && custom.length > 0) {\n return Promise.resolve(custom.trim())\n }\n return NsisTargetOptions.then((options: NsisOptions) => {\n if (options.customNsisBinary) {\n const { checksum, url, version } = options.customNsisBinary\n if (checksum && url) {\n const binaryVersion = version || checksum.substr(0, 8)\n return getBinFromCustomLoc(\"nsis\", binaryVersion, url, checksum)\n }\n }\n // Warning: Don't use v3.0.4.2 - https://github.com/electron-userland/electron-builder/issues/6334\n // noinspection SpellCheckingInspection\n return getBinFromUrl(\"nsis\", \"3.0.4.1\", \"VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==\")\n })\n}\n\nexport class AppPackageHelper {\n private readonly archToFileInfo = new Map<Arch, Promise<PackageFileInfo>>()\n private readonly infoToIsDelete = new Map<PackageFileInfo, boolean>()\n\n /** @private */\n refCount = 0\n\n constructor(private readonly elevateHelper: CopyElevateHelper) {}\n\n async packArch(arch: Arch, target: NsisTarget): Promise<PackageFileInfo> {\n let infoPromise = this.archToFileInfo.get(arch)\n if (infoPromise == null) {\n const appOutDir = target.archs.get(arch)!\n infoPromise = this.elevateHelper.copy(appOutDir, target).then(() => target.buildAppPackage(appOutDir, arch))\n this.archToFileInfo.set(arch, infoPromise)\n }\n\n const info = await infoPromise\n if (target.isWebInstaller) {\n this.infoToIsDelete.set(info, false)\n } else if (!this.infoToIsDelete.has(info)) {\n this.infoToIsDelete.set(info, true)\n }\n return info\n }\n\n async finishBuild(): Promise<any> {\n if (--this.refCount > 0) {\n return\n }\n\n const filesToDelete: Array<string> = []\n for (const [info, isDelete] of this.infoToIsDelete.entries()) {\n if (isDelete) {\n filesToDelete.push(info.path)\n }\n }\n\n await Promise.all(filesToDelete.map(it => fs.unlink(it)))\n }\n}\n\nexport class CopyElevateHelper {\n private readonly copied = new Map<string, Promise<any>>()\n\n copy(appOutDir: string, target: NsisTarget): Promise<any> {\n if (!target.packager.info.framework.isCopyElevateHelper) {\n return Promise.resolve()\n }\n\n let isPackElevateHelper = target.options.packElevateHelper\n if (isPackElevateHelper === false && target.options.perMachine === true) {\n isPackElevateHelper = true\n log.warn(\"`packElevateHelper = false` is ignored, because `perMachine` is set to `true`\")\n }\n\n if (isPackElevateHelper === false) {\n return Promise.resolve()\n }\n\n let promise = this.copied.get(appOutDir)\n if (promise != null) {\n return promise\n }\n\n promise = NSIS_PATH().then(it => {\n const outFile = path.join(appOutDir, \"resources\", \"elevate.exe\")\n const promise = copyFile(path.join(it, \"elevate.exe\"), outFile, false)\n if (target.packager.platformSpecificBuildOptions.signAndEditExecutable !== false) {\n return promise.then(() => target.packager.sign(outFile))\n }\n return promise\n })\n this.copied.set(appOutDir, promise)\n return promise\n }\n}\n\nclass BinaryReader {\n private readonly _buffer: Buffer\n private _position: number\n\n constructor(buffer: Buffer) {\n this._buffer = buffer\n this._position = 0\n }\n\n get length(): number {\n return this._buffer.length\n }\n\n get position(): number {\n return this._position\n }\n\n match(signature: Array<number>): boolean {\n if (signature.every((v, i) => this._buffer[this._position + i] === v)) {\n this._position += signature.length\n return true\n }\n return false\n }\n\n skip(offset: number) {\n this._position += offset\n }\n\n bytes(size: number): Buffer {\n const value = this._buffer.subarray(this._position, this._position + size)\n this._position += size\n return value\n }\n\n uint16(): number {\n const value = this._buffer[this._position] | (this._buffer[this._position + 1] << 8)\n this._position += 2\n return value\n }\n\n uint32(): number {\n return this.uint16() | (this.uint16() << 16)\n }\n\n string(length: number): string {\n let value = \"\"\n for (let i = 0; i < length; i++) {\n const c = this._buffer[this._position + i]\n if (c === 0x00) {\n break\n }\n value += String.fromCharCode(c)\n }\n this._position += length\n return value\n }\n}\n\nexport class UninstallerReader {\n // noinspection SpellCheckingInspection\n static async exec(installerPath: string, uninstallerPath: string) {\n const buffer = await fs.readFile(installerPath)\n const reader = new BinaryReader(buffer)\n // IMAGE_DOS_HEADER\n if (!reader.match([0x4d, 0x5a])) {\n throw new Error(\"Invalid 'MZ' signature.\")\n }\n reader.skip(58)\n // e_lfanew\n reader.skip(reader.uint32() - reader.position)\n // IMAGE_FILE_HEADER\n if (!reader.match([0x50, 0x45, 0x00, 0x00])) {\n throw new Error(\"Invalid 'PE' signature.\")\n }\n reader.skip(2)\n const numberOfSections = reader.uint16()\n reader.skip(12)\n const sizeOfOptionalHeader = reader.uint16()\n reader.skip(2)\n reader.skip(sizeOfOptionalHeader)\n // IMAGE_SECTION_HEADER\n let nsisOffset = 0\n for (let i = 0; i < numberOfSections; i++) {\n const name = reader.string(8)\n reader.skip(8)\n const rawSize = reader.uint32()\n const rawPointer = reader.uint32()\n reader.skip(16)\n switch (name) {\n case \".text\":\n case \".rdata\":\n case \".data\":\n case \".rsrc\": {\n nsisOffset = Math.max(rawPointer + rawSize, nsisOffset)\n break\n }\n default: {\n if (rawPointer !== 0 && rawSize !== 0) {\n throw new Error(\"Unsupported section '\" + name + \"'.\")\n }\n break\n }\n }\n }\n const executable = buffer.subarray(0, nsisOffset)\n const nsisSize = buffer.length - nsisOffset\n const nsisReader = new BinaryReader(buffer.subarray(nsisOffset, nsisOffset + nsisSize))\n const nsisSignature = [0xef, 0xbe, 0xad, 0xde, 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74]\n nsisReader.uint32() // ?\n if (!nsisReader.match(nsisSignature)) {\n throw new Error(\"Invalid signature.\")\n }\n nsisReader.uint32() // ?\n if (nsisSize !== nsisReader.uint32()) {\n throw new Error(\"Size mismatch.\")\n }\n\n let innerBuffer = null\n while (true) {\n let size = nsisReader.uint32()\n const compressed = (size & 0x80000000) !== 0\n size = size & 0x7fffffff\n if (size === 0 || nsisReader.position + size > nsisReader.length || nsisReader.position >= nsisReader.length) {\n break\n }\n let buffer = nsisReader.bytes(size)\n if (compressed) {\n buffer = zlib.inflateRawSync(buffer)\n }\n const innerReader = new BinaryReader(buffer)\n innerReader.uint32() // ?\n if (innerReader.match(nsisSignature)) {\n if (innerBuffer) {\n throw new Error(\"Multiple inner blocks.\")\n }\n innerBuffer = buffer\n }\n }\n if (!innerBuffer) {\n throw new Error(\"Inner block not found.\")\n }\n await fs.writeFile(uninstallerPath, executable)\n await fs.appendFile(uninstallerPath, innerBuffer)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nsisUtil.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisUtil.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,mDAAsE;AACtE,4CAA8C;AAC9C,6BAA4B;AAC5B,wDAAwD;AAExD,kCAAiC;AACjC,6BAA4B;AAGf,QAAA,gBAAgB,GAAG,IAAA,6BAAe,EAAC,MAAM,CAAC,CAAA;AAE1C,QAAA,iBAAiB,GAAG,CAAC,GAAG,EAAE;IACrC,IAAI,QAAuC,CAAA;IAC3C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAc,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAA;IACzE,OAAO;QACL,IAAI,EAAE,CAAC,QAAuC,EAAmB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC1F,OAAO,EAAE,CAAC,OAAoB,EAAO,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;KAC1D,CAAA;AACH,CAAC,CAAC,EAAE,CAAA;AAEG,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAA;IACpD,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACvC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;KACtC;IACD,OAAO,yBAAiB,CAAC,IAAI,CAAC,CAAC,OAAoB,EAAE,EAAE;QACrD,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC5B,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,E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,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;SAC1C;QACD,MAAM,EAAE,CAAC,SAAS,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;QAC/C,MAAM,EAAE,CAAC,UAAU,CAAC,eAAe,EAAE,WAAW,CAAC,CAAA;IACnD,CAAC;CACF;AAtFD,8CAsFC","sourcesContent":["import { Arch, log } from \"builder-util\"\nimport { PackageFileInfo } from \"builder-util-runtime\"\nimport { getBinFromUrl, getBinFromCustomLoc } from \"../../binDownload\"\nimport { copyFile } from \"builder-util/out/fs\"\nimport * as path from \"path\"\nimport { getTemplatePath } from \"../../util/pathManager\"\nimport { NsisTarget } from \"./NsisTarget\"\nimport * as fs from \"fs/promises\"\nimport * as zlib from \"zlib\"\nimport { NsisOptions } from \"./nsisOptions\"\n\nexport const nsisTemplatesDir = getTemplatePath(\"nsis\")\n\nexport const NsisTargetOptions = (() => {\n let _resolve: (options: NsisOptions) => any\n const promise = new Promise<NsisOptions>(resolve => (_resolve = resolve))\n return {\n then: (callback: (options: NsisOptions) => any): Promise<string> => promise.then(callback),\n resolve: (options: NsisOptions): any => _resolve(options),\n }\n})()\n\nexport const NSIS_PATH = () => {\n const custom = process.env.ELECTRON_BUILDER_NSIS_DIR\n if (custom != null && custom.length > 0) {\n return Promise.resolve(custom.trim())\n }\n return NsisTargetOptions.then((options: NsisOptions) => {\n if (options.customNsisBinary) {\n const { checksum, url, version } = options.customNsisBinary\n if (checksum && url) {\n const binaryVersion = version || checksum.substr(0, 8)\n return getBinFromCustomLoc(\"nsis\", binaryVersion, url, checksum)\n }\n }\n // Warning: Don't use v3.0.4.2 - https://github.com/electron-userland/electron-builder/issues/6334\n // noinspection SpellCheckingInspection\n return getBinFromUrl(\"nsis\", \"3.0.4.1\", \"VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==\")\n })\n}\n\nexport class AppPackageHelper {\n private readonly archToFileInfo = new Map<Arch, Promise<PackageFileInfo>>()\n private readonly infoToIsDelete = new Map<PackageFileInfo, boolean>()\n\n /** @private */\n refCount = 0\n\n constructor(private readonly elevateHelper: CopyElevateHelper) {}\n\n async packArch(arch: Arch, target: NsisTarget): Promise<PackageFileInfo> {\n let infoPromise = this.archToFileInfo.get(arch)\n if (infoPromise == null) {\n const appOutDir = target.archs.get(arch)!\n infoPromise = this.elevateHelper.copy(appOutDir, target).then(() => target.buildAppPackage(appOutDir, arch))\n this.archToFileInfo.set(arch, infoPromise)\n }\n\n const info = await infoPromise\n if (target.isWebInstaller) {\n this.infoToIsDelete.set(info, false)\n } else if (!this.infoToIsDelete.has(info)) {\n this.infoToIsDelete.set(info, true)\n }\n return info\n }\n\n async finishBuild(): Promise<any> {\n if (--this.refCount > 0) {\n return\n }\n\n const filesToDelete: Array<string> = []\n for (const [info, isDelete] of this.infoToIsDelete.entries()) {\n if (isDelete) {\n filesToDelete.push(info.path)\n }\n }\n\n await Promise.all(filesToDelete.map(it => fs.unlink(it)))\n }\n}\n\nexport class CopyElevateHelper {\n private readonly copied = new Map<string, Promise<any>>()\n\n copy(appOutDir: string, target: NsisTarget): Promise<any> {\n if (!target.packager.info.framework.isCopyElevateHelper) {\n return Promise.resolve()\n }\n\n let isPackElevateHelper = target.options.packElevateHelper\n if (isPackElevateHelper === false && target.options.perMachine === true) {\n isPackElevateHelper = true\n log.warn(\"`packElevateHelper = false` is ignored, because `perMachine` is set to `true`\")\n }\n\n if (isPackElevateHelper === false) {\n return Promise.resolve()\n }\n\n let promise = this.copied.get(appOutDir)\n if (promise != null) {\n return promise\n }\n\n promise = NSIS_PATH().then(it => {\n const outFile = path.join(appOutDir, \"resources\", \"elevate.exe\")\n const promise = copyFile(path.join(it, \"elevate.exe\"), outFile, false)\n if (target.packager.platformSpecificBuildOptions.signAndEditExecutable !== false) {\n return promise.then(() => target.packager.sign(outFile))\n }\n return promise\n })\n this.copied.set(appOutDir, promise)\n return promise\n }\n}\n\nclass BinaryReader {\n private readonly _buffer: Buffer\n private _position: number\n\n constructor(buffer: Buffer) {\n this._buffer = buffer\n this._position = 0\n }\n\n get length(): number {\n return this._buffer.length\n }\n\n get position(): number {\n return this._position\n }\n\n match(signature: Array<number>): boolean {\n if (signature.every((v, i) => this._buffer[this._position + i] === v)) {\n this._position += signature.length\n return true\n }\n return false\n }\n\n skip(offset: number) {\n this._position += offset\n }\n\n bytes(size: number): Buffer {\n const value = this._buffer.subarray(this._position, this._position + size)\n this._position += size\n return value\n }\n\n uint16(): number {\n const value = this._buffer[this._position] | (this._buffer[this._position + 1] << 8)\n this._position += 2\n return value\n }\n\n uint32(): number {\n return this.uint16() | (this.uint16() << 16)\n }\n\n string(length: number): string {\n let value = \"\"\n for (let i = 0; i < length; i++) {\n const c = this._buffer[this._position + i]\n if (c === 0x00) {\n break\n }\n value += String.fromCharCode(c)\n }\n this._position += length\n return value\n }\n}\n\nexport class UninstallerReader {\n // noinspection SpellCheckingInspection\n static async exec(installerPath: string, uninstallerPath: string) {\n const buffer = await fs.readFile(installerPath)\n const reader = new BinaryReader(buffer)\n // IMAGE_DOS_HEADER\n if (!reader.match([0x4d, 0x5a])) {\n throw new Error(\"Invalid 'MZ' signature.\")\n }\n reader.skip(58)\n // e_lfanew\n reader.skip(reader.uint32() - reader.position)\n // IMAGE_FILE_HEADER\n if (!reader.match([0x50, 0x45, 0x00, 0x00])) {\n throw new Error(\"Invalid 'PE' signature.\")\n }\n reader.skip(2)\n const numberOfSections = reader.uint16()\n reader.skip(12)\n const sizeOfOptionalHeader = reader.uint16()\n reader.skip(2)\n reader.skip(sizeOfOptionalHeader)\n // IMAGE_SECTION_HEADER\n let nsisOffset = 0\n for (let i = 0; i < numberOfSections; i++) {\n const name = reader.string(8)\n reader.skip(8)\n const rawSize = reader.uint32()\n const rawPointer = reader.uint32()\n reader.skip(16)\n switch (name) {\n case \".text\":\n case \".rdata\":\n case \".data\":\n case \".rsrc\": {\n nsisOffset = Math.max(rawPointer + rawSize, nsisOffset)\n break\n }\n default: {\n if (rawPointer !== 0 && rawSize !== 0) {\n throw new Error(\"Unsupported section '\" + name + \"'.\")\n }\n break\n }\n }\n }\n const executable = buffer.subarray(0, nsisOffset)\n const nsisSize = buffer.length - nsisOffset\n const nsisReader = new BinaryReader(buffer.subarray(nsisOffset, nsisOffset + nsisSize))\n const nsisSignature = [0xef, 0xbe, 0xad, 0xde, 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74]\n nsisReader.uint32() // ?\n if (!nsisReader.match(nsisSignature)) {\n throw new Error(\"Invalid signature.\")\n }\n nsisReader.uint32() // ?\n if (nsisSize !== nsisReader.uint32()) {\n throw new Error(\"Size mismatch.\")\n }\n\n let innerBuffer = null\n while (true) {\n let size = nsisReader.uint32()\n const compressed = (size & 0x80000000) !== 0\n size = size & 0x7fffffff\n if (size === 0 || nsisReader.position + size > nsisReader.length || nsisReader.position >= nsisReader.length) {\n break\n }\n let buffer = nsisReader.bytes(size)\n if (compressed) {\n buffer = zlib.inflateRawSync(buffer)\n }\n const innerReader = new BinaryReader(buffer)\n innerReader.uint32() // ?\n if (innerReader.match(nsisSignature)) {\n if (innerBuffer) {\n throw new Error(\"Multiple inner blocks.\")\n }\n innerBuffer = buffer\n }\n }\n if (!innerBuffer) {\n throw new Error(\"Inner block not found.\")\n }\n await fs.writeFile(uninstallerPath, executable)\n await fs.appendFile(uninstallerPath, innerBuffer)\n }\n}\n"]}
|
package/out/targets/pkg.js
CHANGED
|
@@ -14,7 +14,7 @@ const certType = "Developer ID Installer";
|
|
|
14
14
|
// http://www.shanekirk.com/2013/10/creating-flat-packages-in-osx/
|
|
15
15
|
// to use --scripts, we must build .app bundle separately using pkgbuild
|
|
16
16
|
// productbuild --scripts doesn't work (because scripts in this case not added to our package)
|
|
17
|
-
// https://github.com/electron-userland/
|
|
17
|
+
// https://github.com/electron-userland/@electron/osx-sign/issues/96#issuecomment-274986942
|
|
18
18
|
class PkgTarget extends core_1.Target {
|
|
19
19
|
constructor(packager, outDir) {
|
|
20
20
|
super("pkg");
|
|
@@ -43,10 +43,10 @@ class PkgTarget extends core_1.Target {
|
|
|
43
43
|
const appOutDir = this.outDir;
|
|
44
44
|
// https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html
|
|
45
45
|
const distInfoFile = path.join(appOutDir, "distribution.xml");
|
|
46
|
-
const innerPackageFile = path.join(appOutDir, `${appInfo_1.filterCFBundleIdentifier(appInfo.id)}.pkg`);
|
|
47
|
-
const componentPropertyListFile = path.join(appOutDir, `${appInfo_1.filterCFBundleIdentifier(appInfo.id)}.plist`);
|
|
46
|
+
const innerPackageFile = path.join(appOutDir, `${(0, appInfo_1.filterCFBundleIdentifier)(appInfo.id)}.pkg`);
|
|
47
|
+
const componentPropertyListFile = path.join(appOutDir, `${(0, appInfo_1.filterCFBundleIdentifier)(appInfo.id)}.plist`);
|
|
48
48
|
const identity = (await Promise.all([
|
|
49
|
-
macCodeSign_1.findIdentity(certType, options.identity || packager.platformSpecificBuildOptions.identity, keychainFile),
|
|
49
|
+
(0, macCodeSign_1.findIdentity)(certType, options.identity || packager.platformSpecificBuildOptions.identity, keychainFile),
|
|
50
50
|
this.customizeDistributionConfiguration(distInfoFile, appPath),
|
|
51
51
|
this.buildComponentPackage(appPath, componentPropertyListFile, innerPackageFile),
|
|
52
52
|
]))[0];
|
|
@@ -56,19 +56,19 @@ class PkgTarget extends core_1.Target {
|
|
|
56
56
|
const args = prepareProductBuildArgs(identity, keychainFile);
|
|
57
57
|
args.push("--distribution", distInfoFile);
|
|
58
58
|
args.push(artifactPath);
|
|
59
|
-
builder_util_1.use(options.productbuild, it => args.push(...it));
|
|
60
|
-
await builder_util_1.exec("productbuild", args, {
|
|
59
|
+
(0, builder_util_1.use)(options.productbuild, it => args.push(...it));
|
|
60
|
+
await (0, builder_util_1.exec)("productbuild", args, {
|
|
61
61
|
cwd: appOutDir,
|
|
62
62
|
});
|
|
63
|
-
await Promise.all([promises_1.unlink(innerPackageFile), promises_1.unlink(distInfoFile)]);
|
|
63
|
+
await Promise.all([(0, promises_1.unlink)(innerPackageFile), (0, promises_1.unlink)(distInfoFile)]);
|
|
64
64
|
await packager.dispatchArtifactCreated(artifactPath, this, arch, packager.computeSafeArtifactName(artifactName, "pkg", arch));
|
|
65
65
|
}
|
|
66
66
|
async customizeDistributionConfiguration(distInfoFile, appPath) {
|
|
67
|
-
await builder_util_1.exec("productbuild", ["--synthesize", "--component", appPath, distInfoFile], {
|
|
67
|
+
await (0, builder_util_1.exec)("productbuild", ["--synthesize", "--component", appPath, distInfoFile], {
|
|
68
68
|
cwd: this.outDir,
|
|
69
69
|
});
|
|
70
70
|
const options = this.options;
|
|
71
|
-
let distInfo = await promises_1.readFile(distInfoFile, "utf-8");
|
|
71
|
+
let distInfo = await (0, promises_1.readFile)(distInfoFile, "utf-8");
|
|
72
72
|
if (options.mustClose != null && options.mustClose.length !== 0) {
|
|
73
73
|
const startContent = ` <pkg-ref id="${this.packager.appInfo.id}">\n <must-close>\n`;
|
|
74
74
|
const endContent = " </must-close>\n </pkg-ref>\n</installer-gui-script>";
|
|
@@ -98,7 +98,7 @@ class PkgTarget extends core_1.Target {
|
|
|
98
98
|
if (welcome != null) {
|
|
99
99
|
distInfo = distInfo.substring(0, insertIndex) + ` <welcome file="${welcome}"/>\n` + distInfo.substring(insertIndex);
|
|
100
100
|
}
|
|
101
|
-
const license = await license_1.getNotLocalizedLicenseFile(options.license, this.packager);
|
|
101
|
+
const license = await (0, license_1.getNotLocalizedLicenseFile)(options.license, this.packager);
|
|
102
102
|
if (license != null) {
|
|
103
103
|
distInfo = distInfo.substring(0, insertIndex) + ` <license file="${license}"/>\n` + distInfo.substring(insertIndex);
|
|
104
104
|
}
|
|
@@ -106,16 +106,16 @@ class PkgTarget extends core_1.Target {
|
|
|
106
106
|
if (conclusion != null) {
|
|
107
107
|
distInfo = distInfo.substring(0, insertIndex) + ` <conclusion file="${conclusion}"/>\n` + distInfo.substring(insertIndex);
|
|
108
108
|
}
|
|
109
|
-
builder_util_1.debug(distInfo);
|
|
110
|
-
await promises_1.writeFile(distInfoFile, distInfo);
|
|
109
|
+
(0, builder_util_1.debug)(distInfo);
|
|
110
|
+
await (0, promises_1.writeFile)(distInfoFile, distInfo);
|
|
111
111
|
}
|
|
112
112
|
async buildComponentPackage(appPath, propertyListOutputFile, packageOutputFile) {
|
|
113
113
|
const options = this.options;
|
|
114
114
|
const rootPath = path.dirname(appPath);
|
|
115
115
|
// first produce a component plist template
|
|
116
|
-
await builder_util_1.exec("pkgbuild", ["--analyze", "--root", rootPath, propertyListOutputFile]);
|
|
116
|
+
await (0, builder_util_1.exec)("pkgbuild", ["--analyze", "--root", rootPath, propertyListOutputFile]);
|
|
117
117
|
// process the template plist
|
|
118
|
-
const plistInfo = (await appBuilder_1.executeAppBuilderAsJson(["decode-plist", "-f", propertyListOutputFile]))[0].filter((it) => it.RootRelativeBundlePath !== "Electron.dSYM");
|
|
118
|
+
const plistInfo = (await (0, appBuilder_1.executeAppBuilderAsJson)(["decode-plist", "-f", propertyListOutputFile]))[0].filter((it) => it.RootRelativeBundlePath !== "Electron.dSYM");
|
|
119
119
|
if (plistInfo.length > 0) {
|
|
120
120
|
const packageInfo = plistInfo[0];
|
|
121
121
|
// ChildBundles lists all of electron binaries within the .app.
|
|
@@ -134,29 +134,23 @@ class PkgTarget extends core_1.Target {
|
|
|
134
134
|
if (options.overwriteAction != null) {
|
|
135
135
|
packageInfo.BundleOverwriteAction = options.overwriteAction;
|
|
136
136
|
}
|
|
137
|
-
await appBuilder_1.executeAppBuilderAndWriteJson(["encode-plist"], { [propertyListOutputFile]: plistInfo });
|
|
137
|
+
await (0, appBuilder_1.executeAppBuilderAndWriteJson)(["encode-plist"], { [propertyListOutputFile]: plistInfo });
|
|
138
138
|
}
|
|
139
139
|
// now build the package
|
|
140
|
-
const args = [
|
|
141
|
-
|
|
142
|
-
rootPath,
|
|
143
|
-
// "--identifier", this.packager.appInfo.id,
|
|
144
|
-
"--component-plist",
|
|
145
|
-
propertyListOutputFile,
|
|
146
|
-
];
|
|
147
|
-
builder_util_1.use(this.options.installLocation || "/Applications", it => args.push("--install-location", it));
|
|
140
|
+
const args = ["--root", rootPath, "--identifier", this.packager.appInfo.id, "--component-plist", propertyListOutputFile];
|
|
141
|
+
(0, builder_util_1.use)(this.options.installLocation || "/Applications", it => args.push("--install-location", it));
|
|
148
142
|
if (options.scripts != null) {
|
|
149
143
|
args.push("--scripts", path.resolve(this.packager.info.buildResourcesDir, options.scripts));
|
|
150
144
|
}
|
|
151
145
|
else if (options.scripts !== null) {
|
|
152
146
|
const dir = path.join(this.packager.info.buildResourcesDir, "pkg-scripts");
|
|
153
|
-
const stat = await fs_1.statOrNull(dir);
|
|
147
|
+
const stat = await (0, fs_1.statOrNull)(dir);
|
|
154
148
|
if (stat != null && stat.isDirectory()) {
|
|
155
149
|
args.push("--scripts", dir);
|
|
156
150
|
}
|
|
157
151
|
}
|
|
158
152
|
args.push(packageOutputFile);
|
|
159
|
-
await builder_util_1.exec("pkgbuild", args);
|
|
153
|
+
await (0, builder_util_1.exec)("pkgbuild", args);
|
|
160
154
|
}
|
|
161
155
|
}
|
|
162
156
|
exports.PkgTarget = PkgTarget;
|
package/out/targets/pkg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pkg.js","sourceRoot":"","sources":["../../src/targets/pkg.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AACrD,4CAAgD;AAEhD,mDAA2F;AAC3F,6CAA4D;AAC5D,0CAAyD;AACzD,6BAA4B;AAC5B,wCAAqD;AACrD,yDAAgE;AAChE,kCAAgC;AAGhC,MAAM,QAAQ,GAAG,wBAAwB,CAAA;AAEzC,kEAAkE;AAClE,wEAAwE;AACxE,8FAA8F;AAC9F,0FAA0F;AAC1F,MAAa,SAAU,SAAQ,aAAM;IAQ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I,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAA;aAC5B;SACF;QAED,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;QAE5B,MAAM,mBAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IAC9B,CAAC;CACF;AAhLD,8BAgLC;AAED,SAAgB,uBAAuB,CAAC,QAAyB,EAAE,QAAmC;IACpG,MAAM,IAAI,GAAkB,EAAE,CAAA;IAC9B,IAAI,QAAQ,IAAI,IAAI,EAAE;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;SAClC;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AATD,0DASC","sourcesContent":["import { Arch, debug, exec, use } from \"builder-util\"\nimport { statOrNull } from \"builder-util/out/fs\"\nimport { PkgOptions } from \"../options/pkgOptions\"\nimport { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from \"../util/appBuilder\"\nimport { getNotLocalizedLicenseFile } from \"../util/license\"\nimport { readFile, unlink, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { findIdentity, Identity } from \"../codeSign/macCodeSign\"\nimport { Target } from \"../core\"\nimport MacPackager from \"../macPackager\"\n\nconst certType = \"Developer ID Installer\"\n\n// http://www.shanekirk.com/2013/10/creating-flat-packages-in-osx/\n// to use --scripts, we must build .app bundle separately using pkgbuild\n// productbuild --scripts doesn't work (because scripts in this case not added to our package)\n// https://github.com/electron-userland/electron-osx-sign/issues/96#issuecomment-274986942\nexport class PkgTarget extends Target {\n readonly options: PkgOptions = {\n allowAnywhere: true,\n allowCurrentUserHome: true,\n allowRootDirectory: true,\n ...this.packager.config.pkg,\n }\n\n constructor(private readonly packager: MacPackager, readonly outDir: string) {\n super(\"pkg\")\n }\n\n async build(appPath: string, arch: Arch): Promise<any> {\n const packager = this.packager\n const options = this.options\n const appInfo = packager.appInfo\n\n // pkg doesn't like not ASCII symbols (Could not open package to list files: /Volumes/test/t-gIjdGK/test-project-0/dist/Test App ßW-1.1.0.pkg)\n const artifactName = packager.expandArtifactNamePattern(options, \"pkg\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"pkg\",\n file: artifactPath,\n arch,\n })\n\n const keychainFile = (await packager.codeSigningInfo.value).keychainFile\n\n const appOutDir = this.outDir\n // https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html\n const distInfoFile = path.join(appOutDir, \"distribution.xml\")\n\n const innerPackageFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.pkg`)\n const componentPropertyListFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.plist`)\n const identity = (\n await Promise.all([\n findIdentity(certType, options.identity || packager.platformSpecificBuildOptions.identity, keychainFile),\n this.customizeDistributionConfiguration(distInfoFile, appPath),\n this.buildComponentPackage(appPath, componentPropertyListFile, innerPackageFile),\n ])\n )[0]\n\n if (identity == null && packager.forceCodeSigning) {\n throw new Error(`Cannot find valid \"${certType}\" to sign standalone installer, please see https://electron.build/code-signing`)\n }\n\n const args = prepareProductBuildArgs(identity, keychainFile)\n args.push(\"--distribution\", distInfoFile)\n args.push(artifactPath)\n use(options.productbuild, it => args.push(...(it as any)))\n await exec(\"productbuild\", args, {\n cwd: appOutDir,\n })\n await Promise.all([unlink(innerPackageFile), unlink(distInfoFile)])\n\n await packager.dispatchArtifactCreated(artifactPath, this, arch, packager.computeSafeArtifactName(artifactName, \"pkg\", arch))\n }\n\n private async customizeDistributionConfiguration(distInfoFile: string, appPath: string) {\n await exec(\"productbuild\", [\"--synthesize\", \"--component\", appPath, distInfoFile], {\n cwd: this.outDir,\n })\n\n const options = this.options\n let distInfo = await readFile(distInfoFile, \"utf-8\")\n\n if (options.mustClose != null && options.mustClose.length !== 0) {\n const startContent = ` <pkg-ref id=\"${this.packager.appInfo.id}\">\\n <must-close>\\n`\n const endContent = \" </must-close>\\n </pkg-ref>\\n</installer-gui-script>\"\n let mustCloseContent = \"\"\n options.mustClose.forEach(appId => {\n mustCloseContent += ` <app id=\"${appId}\"/>\\n`\n })\n distInfo = distInfo.replace(\"</installer-gui-script>\", `${startContent}${mustCloseContent}${endContent}`)\n }\n\n const insertIndex = distInfo.lastIndexOf(\"</installer-gui-script>\")\n distInfo =\n distInfo.substring(0, insertIndex) +\n ` <domains enable_anywhere=\"${options.allowAnywhere}\" enable_currentUserHome=\"${options.allowCurrentUserHome}\" enable_localSystem=\"${options.allowRootDirectory}\" />\\n` +\n distInfo.substring(insertIndex)\n\n if (options.background != null) {\n const background = await this.packager.getResource(options.background.file)\n if (background != null) {\n const alignment = options.background.alignment || \"center\"\n // noinspection SpellCheckingInspection\n const scaling = options.background.scaling || \"tofit\"\n distInfo = distInfo.substring(0, insertIndex) + ` <background file=\"${background}\" alignment=\"${alignment}\" scaling=\"${scaling}\"/>\\n` + distInfo.substring(insertIndex)\n distInfo =\n distInfo.substring(0, insertIndex) + ` <background-darkAqua file=\"${background}\" alignment=\"${alignment}\" scaling=\"${scaling}\"/>\\n` + distInfo.substring(insertIndex)\n }\n }\n\n const welcome = await this.packager.getResource(options.welcome)\n if (welcome != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <welcome file=\"${welcome}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n const license = await getNotLocalizedLicenseFile(options.license, this.packager)\n if (license != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <license file=\"${license}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n const conclusion = await this.packager.getResource(options.conclusion)\n if (conclusion != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <conclusion file=\"${conclusion}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n debug(distInfo)\n await writeFile(distInfoFile, distInfo)\n }\n\n private async buildComponentPackage(appPath: string, propertyListOutputFile: string, packageOutputFile: string) {\n const options = this.options\n const rootPath = path.dirname(appPath)\n\n // first produce a component plist template\n await exec(\"pkgbuild\", [\"--analyze\", \"--root\", rootPath, propertyListOutputFile])\n\n // process the template plist\n const plistInfo = (await executeAppBuilderAsJson<Array<any>>([\"decode-plist\", \"-f\", propertyListOutputFile]))[0].filter(\n (it: any) => it.RootRelativeBundlePath !== \"Electron.dSYM\"\n )\n if (plistInfo.length > 0) {\n const packageInfo = plistInfo[0]\n\n // ChildBundles lists all of electron binaries within the .app.\n // There is no particular reason for removing that key, except to be as close as possible to\n // the PackageInfo generated by previous versions of electron-builder.\n delete packageInfo.ChildBundles\n\n if (options.isRelocatable != null) {\n packageInfo.BundleIsRelocatable = options.isRelocatable\n }\n\n if (options.isVersionChecked != null) {\n packageInfo.BundleIsVersionChecked = options.isVersionChecked\n }\n\n if (options.hasStrictIdentifier != null) {\n packageInfo.BundleHasStrictIdentifier = options.hasStrictIdentifier\n }\n\n if (options.overwriteAction != null) {\n packageInfo.BundleOverwriteAction = options.overwriteAction\n }\n\n await executeAppBuilderAndWriteJson([\"encode-plist\"], { [propertyListOutputFile]: plistInfo })\n }\n\n // now build the package\n const args = [\n \"--root\",\n rootPath,\n // \"--identifier\", this.packager.appInfo.id,\n \"--component-plist\",\n propertyListOutputFile,\n ]\n\n use(this.options.installLocation || \"/Applications\", it => args.push(\"--install-location\", it))\n if (options.scripts != null) {\n args.push(\"--scripts\", path.resolve(this.packager.info.buildResourcesDir, options.scripts))\n } else if (options.scripts !== null) {\n const dir = path.join(this.packager.info.buildResourcesDir, \"pkg-scripts\")\n const stat = await statOrNull(dir)\n if (stat != null && stat.isDirectory()) {\n args.push(\"--scripts\", dir)\n }\n }\n\n args.push(packageOutputFile)\n\n await exec(\"pkgbuild\", args)\n }\n}\n\nexport function prepareProductBuildArgs(identity: Identity | null, keychain: string | null | undefined): Array<string> {\n const args: Array<string> = []\n if (identity != null) {\n args.push(\"--sign\", identity.hash)\n if (keychain != null) {\n args.push(\"--keychain\", keychain)\n }\n }\n return args\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pkg.js","sourceRoot":"","sources":["../../src/targets/pkg.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AACrD,4CAAgD;AAEhD,mDAA2F;AAC3F,6CAA4D;AAC5D,0CAAyD;AACzD,6BAA4B;AAC5B,wCAAqD;AACrD,yDAAgE;AAChE,kCAAgC;AAGhC,MAAM,QAAQ,GAAG,wBAAwB,CAAA;AAEzC,kEAAkE;AAClE,wEAAwE;AACxE,8FAA8F;AAC9F,2FAA2F;AAC3F,MAAa,SAAU,SAAQ,aAAM;IAQnC,YAA6B,QAAqB,EAAW,MAAc;QACzE,KAAK,CAAC,KAAK,CAAC,CAAA;QADe,aAAQ,GAAR,QAAQ,CAAa;QAAW,WAAM,GAAN,MAAM,CAAQ;QAPlE,YAAO,GAAe;YAC7B,aAAa,EAAE,IAAI;YACnB,oBAAoB,EAAE,IAAI;YAC1B,kBAAkB,EAAE,IAAI;YACxB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG;SAC5B,CAAA;IAID,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAAe,EAAE,IAAU;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAA;QAEhC,8IAA8I;QAC9I,MAAM,YAAY,GAAG,QAAQ,CAAC,yBAAyB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;QAC7E,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;QAEzD,MAAM,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAC;YA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} from \"builder-util/out/fs\"\nimport { PkgOptions } from \"../options/pkgOptions\"\nimport { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from \"../util/appBuilder\"\nimport { getNotLocalizedLicenseFile } from \"../util/license\"\nimport { readFile, unlink, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { findIdentity, Identity } from \"../codeSign/macCodeSign\"\nimport { Target } from \"../core\"\nimport MacPackager from \"../macPackager\"\n\nconst certType = \"Developer ID Installer\"\n\n// http://www.shanekirk.com/2013/10/creating-flat-packages-in-osx/\n// to use --scripts, we must build .app bundle separately using pkgbuild\n// productbuild --scripts doesn't work (because scripts in this case not added to our package)\n// https://github.com/electron-userland/@electron/osx-sign/issues/96#issuecomment-274986942\nexport class PkgTarget extends Target {\n readonly options: PkgOptions = {\n allowAnywhere: true,\n allowCurrentUserHome: true,\n allowRootDirectory: true,\n ...this.packager.config.pkg,\n }\n\n constructor(private readonly packager: MacPackager, readonly outDir: string) {\n super(\"pkg\")\n }\n\n async build(appPath: string, arch: Arch): Promise<any> {\n const packager = this.packager\n const options = this.options\n const appInfo = packager.appInfo\n\n // pkg doesn't like not ASCII symbols (Could not open package to list files: /Volumes/test/t-gIjdGK/test-project-0/dist/Test App ßW-1.1.0.pkg)\n const artifactName = packager.expandArtifactNamePattern(options, \"pkg\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.callArtifactBuildStarted({\n targetPresentableName: \"pkg\",\n file: artifactPath,\n arch,\n })\n\n const keychainFile = (await packager.codeSigningInfo.value).keychainFile\n\n const appOutDir = this.outDir\n // https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html\n const distInfoFile = path.join(appOutDir, \"distribution.xml\")\n\n const innerPackageFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.pkg`)\n const componentPropertyListFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.plist`)\n const identity = (\n await Promise.all([\n findIdentity(certType, options.identity || packager.platformSpecificBuildOptions.identity, keychainFile),\n this.customizeDistributionConfiguration(distInfoFile, appPath),\n this.buildComponentPackage(appPath, componentPropertyListFile, innerPackageFile),\n ])\n )[0]\n\n if (identity == null && packager.forceCodeSigning) {\n throw new Error(`Cannot find valid \"${certType}\" to sign standalone installer, please see https://electron.build/code-signing`)\n }\n\n const args = prepareProductBuildArgs(identity, keychainFile)\n args.push(\"--distribution\", distInfoFile)\n args.push(artifactPath)\n use(options.productbuild, it => args.push(...(it as any)))\n await exec(\"productbuild\", args, {\n cwd: appOutDir,\n })\n await Promise.all([unlink(innerPackageFile), unlink(distInfoFile)])\n\n await packager.dispatchArtifactCreated(artifactPath, this, arch, packager.computeSafeArtifactName(artifactName, \"pkg\", arch))\n }\n\n private async customizeDistributionConfiguration(distInfoFile: string, appPath: string) {\n await exec(\"productbuild\", [\"--synthesize\", \"--component\", appPath, distInfoFile], {\n cwd: this.outDir,\n })\n\n const options = this.options\n let distInfo = await readFile(distInfoFile, \"utf-8\")\n\n if (options.mustClose != null && options.mustClose.length !== 0) {\n const startContent = ` <pkg-ref id=\"${this.packager.appInfo.id}\">\\n <must-close>\\n`\n const endContent = \" </must-close>\\n </pkg-ref>\\n</installer-gui-script>\"\n let mustCloseContent = \"\"\n options.mustClose.forEach(appId => {\n mustCloseContent += ` <app id=\"${appId}\"/>\\n`\n })\n distInfo = distInfo.replace(\"</installer-gui-script>\", `${startContent}${mustCloseContent}${endContent}`)\n }\n\n const insertIndex = distInfo.lastIndexOf(\"</installer-gui-script>\")\n distInfo =\n distInfo.substring(0, insertIndex) +\n ` <domains enable_anywhere=\"${options.allowAnywhere}\" enable_currentUserHome=\"${options.allowCurrentUserHome}\" enable_localSystem=\"${options.allowRootDirectory}\" />\\n` +\n distInfo.substring(insertIndex)\n\n if (options.background != null) {\n const background = await this.packager.getResource(options.background.file)\n if (background != null) {\n const alignment = options.background.alignment || \"center\"\n // noinspection SpellCheckingInspection\n const scaling = options.background.scaling || \"tofit\"\n distInfo = distInfo.substring(0, insertIndex) + ` <background file=\"${background}\" alignment=\"${alignment}\" scaling=\"${scaling}\"/>\\n` + distInfo.substring(insertIndex)\n distInfo =\n distInfo.substring(0, insertIndex) + ` <background-darkAqua file=\"${background}\" alignment=\"${alignment}\" scaling=\"${scaling}\"/>\\n` + distInfo.substring(insertIndex)\n }\n }\n\n const welcome = await this.packager.getResource(options.welcome)\n if (welcome != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <welcome file=\"${welcome}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n const license = await getNotLocalizedLicenseFile(options.license, this.packager)\n if (license != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <license file=\"${license}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n const conclusion = await this.packager.getResource(options.conclusion)\n if (conclusion != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <conclusion file=\"${conclusion}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n debug(distInfo)\n await writeFile(distInfoFile, distInfo)\n }\n\n private async buildComponentPackage(appPath: string, propertyListOutputFile: string, packageOutputFile: string) {\n const options = this.options\n const rootPath = path.dirname(appPath)\n\n // first produce a component plist template\n await exec(\"pkgbuild\", [\"--analyze\", \"--root\", rootPath, propertyListOutputFile])\n\n // process the template plist\n const plistInfo = (await executeAppBuilderAsJson<Array<any>>([\"decode-plist\", \"-f\", propertyListOutputFile]))[0].filter(\n (it: any) => it.RootRelativeBundlePath !== \"Electron.dSYM\"\n )\n if (plistInfo.length > 0) {\n const packageInfo = plistInfo[0]\n\n // ChildBundles lists all of electron binaries within the .app.\n // There is no particular reason for removing that key, except to be as close as possible to\n // the PackageInfo generated by previous versions of electron-builder.\n delete packageInfo.ChildBundles\n\n if (options.isRelocatable != null) {\n packageInfo.BundleIsRelocatable = options.isRelocatable\n }\n\n if (options.isVersionChecked != null) {\n packageInfo.BundleIsVersionChecked = options.isVersionChecked\n }\n\n if (options.hasStrictIdentifier != null) {\n packageInfo.BundleHasStrictIdentifier = options.hasStrictIdentifier\n }\n\n if (options.overwriteAction != null) {\n packageInfo.BundleOverwriteAction = options.overwriteAction\n }\n\n await executeAppBuilderAndWriteJson([\"encode-plist\"], { [propertyListOutputFile]: plistInfo })\n }\n\n // now build the package\n const args = [\"--root\", rootPath, \"--identifier\", this.packager.appInfo.id, \"--component-plist\", propertyListOutputFile]\n\n use(this.options.installLocation || \"/Applications\", it => args.push(\"--install-location\", it))\n if (options.scripts != null) {\n args.push(\"--scripts\", path.resolve(this.packager.info.buildResourcesDir, options.scripts))\n } else if (options.scripts !== null) {\n const dir = path.join(this.packager.info.buildResourcesDir, \"pkg-scripts\")\n const stat = await statOrNull(dir)\n if (stat != null && stat.isDirectory()) {\n args.push(\"--scripts\", dir)\n }\n }\n\n args.push(packageOutputFile)\n\n await exec(\"pkgbuild\", args)\n }\n}\n\nexport function prepareProductBuildArgs(identity: Identity | null, keychain: string | null | undefined): Array<string> {\n const args: Array<string> = []\n if (identity != null) {\n args.push(\"--sign\", identity.hash!)\n if (keychain != null) {\n args.push(\"--keychain\", keychain)\n }\n }\n return args\n}\n"]}
|
package/out/targets/snap.js
CHANGED
|
@@ -20,7 +20,7 @@ class SnapTarget extends core_1.Target {
|
|
|
20
20
|
this.isUseTemplateApp = false;
|
|
21
21
|
}
|
|
22
22
|
replaceDefault(inList, defaultList) {
|
|
23
|
-
const result = builder_util_1.replaceDefault(inList, defaultList);
|
|
23
|
+
const result = (0, builder_util_1.replaceDefault)(inList, defaultList);
|
|
24
24
|
if (result !== defaultList) {
|
|
25
25
|
this.isUseTemplateApp = false;
|
|
26
26
|
}
|
|
@@ -39,7 +39,7 @@ class SnapTarget extends core_1.Target {
|
|
|
39
39
|
const plugs = normalizePlugConfiguration(this.options.plugs);
|
|
40
40
|
const plugNames = this.replaceDefault(plugs == null ? null : Object.getOwnPropertyNames(plugs), defaultPlugs);
|
|
41
41
|
const slots = normalizePlugConfiguration(this.options.slots);
|
|
42
|
-
const buildPackages = builder_util_runtime_1.asArray(options.buildPackages);
|
|
42
|
+
const buildPackages = (0, builder_util_runtime_1.asArray)(options.buildPackages);
|
|
43
43
|
const defaultStagePackages = getDefaultStagePackages();
|
|
44
44
|
const stagePackages = this.replaceDefault(options.stagePackages, defaultStagePackages);
|
|
45
45
|
this.isUseTemplateApp =
|
|
@@ -52,10 +52,13 @@ class SnapTarget extends core_1.Target {
|
|
|
52
52
|
plugs: plugNames,
|
|
53
53
|
adapter: "none",
|
|
54
54
|
};
|
|
55
|
-
const snap = js_yaml_1.load(await fs_extra_1.readFile(path.join(pathManager_1.getTemplatePath("snap"), "snapcraft.yaml"), "utf-8"));
|
|
55
|
+
const snap = (0, js_yaml_1.load)(await (0, fs_extra_1.readFile)(path.join((0, pathManager_1.getTemplatePath)("snap"), "snapcraft.yaml"), "utf-8"));
|
|
56
56
|
if (this.isUseTemplateApp) {
|
|
57
57
|
delete appDescriptor.adapter;
|
|
58
58
|
}
|
|
59
|
+
if (options.base != null) {
|
|
60
|
+
snap.base = options.base;
|
|
61
|
+
}
|
|
59
62
|
if (options.grade != null) {
|
|
60
63
|
snap.grade = options.grade;
|
|
61
64
|
}
|
|
@@ -81,14 +84,14 @@ class SnapTarget extends core_1.Target {
|
|
|
81
84
|
snap.slots[slotName] = slotOptions;
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
|
-
builder_util_1.deepAssign(snap, {
|
|
87
|
+
(0, builder_util_1.deepAssign)(snap, {
|
|
85
88
|
name: snapName,
|
|
86
89
|
version: appInfo.version,
|
|
87
90
|
title: options.title || appInfo.productName,
|
|
88
91
|
summary: options.summary || appInfo.productName,
|
|
89
92
|
compression: options.compression,
|
|
90
93
|
description: this.helper.getDescription(options),
|
|
91
|
-
architectures: [builder_util_1.toLinuxArchString(arch, "snap")],
|
|
94
|
+
architectures: [(0, builder_util_1.toLinuxArchString)(arch, "snap")],
|
|
92
95
|
apps: {
|
|
93
96
|
[snapName]: appDescriptor,
|
|
94
97
|
},
|
|
@@ -136,11 +139,12 @@ class SnapTarget extends core_1.Target {
|
|
|
136
139
|
snap.parts.app.after = options.after;
|
|
137
140
|
}
|
|
138
141
|
if (options.assumes != null) {
|
|
139
|
-
snap.assumes = builder_util_runtime_1.asArray(options.assumes);
|
|
142
|
+
snap.assumes = (0, builder_util_runtime_1.asArray)(options.assumes);
|
|
140
143
|
}
|
|
141
144
|
return snap;
|
|
142
145
|
}
|
|
143
146
|
async build(appOutDir, arch) {
|
|
147
|
+
var _a;
|
|
144
148
|
const packager = this.packager;
|
|
145
149
|
const options = this.options;
|
|
146
150
|
// tslint:disable-next-line:no-invalid-template-strings
|
|
@@ -152,8 +156,8 @@ class SnapTarget extends core_1.Target {
|
|
|
152
156
|
arch,
|
|
153
157
|
});
|
|
154
158
|
const snap = await this.createDescriptor(arch);
|
|
155
|
-
const stageDir = await targetUtil_1.createStageDirPath(this, packager, arch);
|
|
156
|
-
const snapArch = builder_util_1.toLinuxArchString(arch, "snap");
|
|
159
|
+
const stageDir = await (0, targetUtil_1.createStageDirPath)(this, packager, arch);
|
|
160
|
+
const snapArch = (0, builder_util_1.toLinuxArchString)(arch, "snap");
|
|
157
161
|
const args = ["snap", "--app", appOutDir, "--stage", stageDir, "--arch", snapArch, "--output", artifactPath, "--executable", this.packager.executableName];
|
|
158
162
|
await this.helper.icons;
|
|
159
163
|
if (this.helper.maxIconPath != null) {
|
|
@@ -169,12 +173,19 @@ class SnapTarget extends core_1.Target {
|
|
|
169
173
|
// tslint:disable:no-invalid-template-strings
|
|
170
174
|
Icon: "${SNAP}/meta/gui/icon.png",
|
|
171
175
|
});
|
|
176
|
+
const extraAppArgs = (_a = options.executableArgs) !== null && _a !== void 0 ? _a : [];
|
|
172
177
|
if (this.isElectronVersionGreaterOrEqualThan("5.0.0") && !isBrowserSandboxAllowed(snap)) {
|
|
173
|
-
|
|
178
|
+
const noSandboxArg = "--no-sandbox";
|
|
179
|
+
if (!extraAppArgs.includes(noSandboxArg)) {
|
|
180
|
+
extraAppArgs.push(noSandboxArg);
|
|
181
|
+
}
|
|
174
182
|
if (this.isUseTemplateApp) {
|
|
175
183
|
args.push("--exclude", "chrome-sandbox");
|
|
176
184
|
}
|
|
177
185
|
}
|
|
186
|
+
if (extraAppArgs.length > 0) {
|
|
187
|
+
args.push("--extraAppArgs=" + extraAppArgs.join(" "));
|
|
188
|
+
}
|
|
178
189
|
if (snap.compression != null) {
|
|
179
190
|
args.push("--compression", snap.compression);
|
|
180
191
|
}
|
|
@@ -188,7 +199,7 @@ class SnapTarget extends core_1.Target {
|
|
|
188
199
|
if (packager.packagerOptions.effectiveOptionComputed != null && (await packager.packagerOptions.effectiveOptionComputed({ snap, desktopFile, args }))) {
|
|
189
200
|
return;
|
|
190
201
|
}
|
|
191
|
-
await fs_extra_1.outputFile(path.join(snapMetaDir, this.isUseTemplateApp ? "snap.yaml" : "snapcraft.yaml"), builder_util_1.serializeToYaml(snap));
|
|
202
|
+
await (0, fs_extra_1.outputFile)(path.join(snapMetaDir, this.isUseTemplateApp ? "snap.yaml" : "snapcraft.yaml"), (0, builder_util_1.serializeToYaml)(snap));
|
|
192
203
|
const hooksDir = await packager.getResource(options.hooks, "snap-hooks");
|
|
193
204
|
if (hooksDir != null) {
|
|
194
205
|
args.push("--hooks", hooksDir);
|
|
@@ -196,7 +207,7 @@ class SnapTarget extends core_1.Target {
|
|
|
196
207
|
if (this.isUseTemplateApp) {
|
|
197
208
|
args.push("--template-url", `electron4:${snapArch}`);
|
|
198
209
|
}
|
|
199
|
-
await builder_util_1.executeAppBuilder(args);
|
|
210
|
+
await (0, builder_util_1.executeAppBuilder)(args);
|
|
200
211
|
await packager.info.callArtifactBuildCompleted({
|
|
201
212
|
file: artifactPath,
|
|
202
213
|
safeArtifactName: packager.computeSafeArtifactName(artifactName, "snap", arch, false),
|