app-builder-lib 22.10.1 → 22.10.5
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/electron-osx-sign/index.d.ts +2 -0
- package/electron-osx-sign/index.js +10 -1
- package/electron-osx-sign/sign.js +22 -14
- package/electron-osx-sign/util.js +32 -14
- package/out/appInfo.d.ts +1 -0
- package/out/appInfo.js +3 -2
- package/out/appInfo.js.map +1 -1
- package/out/asar/asarUtil.js +4 -2
- package/out/asar/asarUtil.js.map +1 -1
- package/out/asar/unpackDetector.js +12 -12
- package/out/asar/unpackDetector.js.map +1 -1
- package/out/configuration.d.ts +3 -2
- package/out/electron/ElectronFramework.js +21 -8
- package/out/electron/ElectronFramework.js.map +1 -1
- package/out/electron/electronMac.js +1 -1
- package/out/electron/electronMac.js.map +1 -1
- package/out/macPackager.d.ts +2 -1
- package/out/macPackager.js +72 -8
- package/out/macPackager.js.map +1 -1
- package/out/options/CommonWindowsInstallerConfiguration.js +1 -1
- package/out/options/CommonWindowsInstallerConfiguration.js.map +1 -1
- package/out/options/PlatformSpecificBuildOptions.d.ts +5 -0
- package/out/options/linuxOptions.d.ts +0 -5
- package/out/packager.d.ts +1 -1
- package/out/packager.js +1 -7
- package/out/packager.js.map +1 -1
- package/out/platformPackager.d.ts +4 -3
- package/out/platformPackager.js +35 -8
- package/out/platformPackager.js.map +1 -1
- package/out/targets/ArchiveTarget.js +4 -3
- package/out/targets/ArchiveTarget.js.map +1 -1
- package/out/targets/LinuxTargetHelper.js +1 -2
- package/out/targets/LinuxTargetHelper.js.map +1 -1
- package/out/targets/fpm.js +1 -1
- package/out/targets/fpm.js.map +1 -1
- package/out/targets/nsis/nsisLang.js +1 -1
- package/out/targets/nsis/nsisLang.js.map +1 -1
- package/out/targets/snap.js +1 -1
- package/out/targets/snap.js.map +1 -1
- package/out/util/config.js +1 -1
- package/out/util/macroExpander.js +1 -1
- package/out/util/macroExpander.js.map +1 -1
- package/package.json +30 -29
- package/scheme.json +65 -6
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +3 -3
- package/templates/nsis/include/extractAppPackage.nsh +48 -49
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/electron/electronMac.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AAEA,SAAS,QAAT,CAAkB,QAAlB,EAAoC,OAApC,EAAqD,OAArD,EAAoE;AAClE,SAAO,uBAAO,IAAI,CAAC,IAAL,CAAU,QAAV,EAAoB,OAApB,CAAP,EAAqC,IAAI,CAAC,IAAL,CAAU,QAAV,EAAoB,OAApB,CAArC,CAAP;AACD;;AAED,SAAS,WAAT,CAAqB,cAArB,EAAoD,cAApD,EAA4E,OAA5E,EAA6F,MAA7F,EAA2G;AACzG,SAAO,uBAAgB,GAAhB,CAAoB,cAApB,EAAoC,MAAM,IAAG;AAClD,UAAM,kBAAkB,GAAG,IAAI,CAAC,IAAL,CAAU,cAAV,EAA0B,GAAG,MAAM,GAAG,MAAM,MAA5C,EAAoD,UAApD,EAAgE,OAAhE,CAA3B;AACA,WAAO,QAAQ,CAAC,kBAAD,EAAqB,GAAG,MAAM,GAAG,MAAM,EAAvC,EAA2C,OAAO,GAAG,MAArD,CAAR,CACJ,IADI,CACC,MAAM,QAAQ,CAAC,cAAD,EAAiB,GAAG,MAAM,GAAG,MAAM,MAAnC,EAA2C,GAAG,OAAO,GAAG,MAAM,MAA9D,CADf,CAAP;AAED,GAJM,CAAP;AAKD;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":["import BluebirdPromise from \"bluebird-lst\"\nimport { asArray, getPlatformIconFileName, InvalidConfigurationError, log } from \"builder-util\"\nimport { copyOrLinkFile, unlinkIfExists } from \"builder-util/out/fs\"\nimport { rename, utimes } from \"fs-extra\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { AsarIntegrity } from \"../asar/integrity\"\nimport MacPackager from \"../macPackager\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from \"../util/appBuilder\"\n\nfunction doRename(basePath: string, oldName: string, newName: string) {\n return rename(path.join(basePath, oldName), path.join(basePath, newName))\n}\n\nfunction moveHelpers(helperSuffixes: Array<string>, frameworksPath: string, appName: string, prefix: string): Promise<any> {\n return BluebirdPromise.map(helperSuffixes, suffix => {\n const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix)\n .then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`))\n })\n}\n\nfunction getAvailableHelperSuffixes(helperEHPlist: string | null, helperNPPlist: string | null, helperRendererPlist: string | null, helperPluginPlist: string | null, helperGPUPlist: string | null) {\n\n const result = [\" Helper\"]\n if (helperEHPlist != null) {\n result.push(\" Helper EH\")\n }\n if (helperNPPlist != null) {\n result.push(\" Helper NP\")\n }\n if (helperRendererPlist != null) {\n result.push(\" Helper (Renderer)\")\n }\n if (helperPluginPlist != null) {\n result.push(\" Helper (Plugin)\")\n }\n if (helperGPUPlist != null) {\n result.push(\" Helper (GPU)\")\n }\n return result\n}\n\n/** @internal */\nexport async function createMacApp(packager: MacPackager, appOutDir: string, asarIntegrity: AsarIntegrity | null, isMas: boolean) {\n const appInfo = packager.appInfo\n const appFilename = appInfo.productFilename\n\n const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, \"Contents\")\n const frameworksPath = path.join(contentsPath, \"Frameworks\")\n const loginItemPath = path.join(contentsPath, \"Library\", \"LoginItems\")\n\n const appPlistFilename = path.join(contentsPath, \"Info.plist\")\n const helperPlistFilename = path.join(frameworksPath, \"Electron Helper.app\", \"Contents\", \"Info.plist\")\n const helperEHPlistFilename = path.join(frameworksPath, \"Electron Helper EH.app\", \"Contents\", \"Info.plist\")\n const helperNPPlistFilename = path.join(frameworksPath, \"Electron Helper NP.app\", \"Contents\", \"Info.plist\")\n const helperRendererPlistFilename = path.join(frameworksPath, \"Electron Helper (Renderer).app\", \"Contents\", \"Info.plist\")\n const helperPluginPlistFilename = path.join(frameworksPath, \"Electron Helper (Plugin).app\", \"Contents\", \"Info.plist\")\n const helperGPUPlistFilename = path.join(frameworksPath, \"Electron Helper (GPU).app\", \"Contents\", \"Info.plist\")\n const helperLoginPlistFilename = path.join(loginItemPath, \"Electron Login Helper.app\", \"Contents\", \"Info.plist\")\n\n const plistContent: Array<any> = await executeAppBuilderAsJson([\"decode-plist\", \"-f\", appPlistFilename, \"-f\", helperPlistFilename, \"-f\", helperEHPlistFilename, \"-f\", helperNPPlistFilename, \"-f\", helperRendererPlistFilename, \"-f\", helperPluginPlistFilename, \"-f\", helperGPUPlistFilename, \"-f\", helperLoginPlistFilename])\n\n if (plistContent[0] == null) {\n throw new Error(\"corrupted Electron dist\")\n }\n\n const appPlist = plistContent[0]!!\n const helperPlist = plistContent[1]!!\n const helperEHPlist = plistContent[2]\n const helperNPPlist = plistContent[3]\n const helperRendererPlist = plistContent[4]\n const helperPluginPlist = plistContent[5]\n const helperGPUPlist = plistContent[6]\n const helperLoginPlist = plistContent[7]\n\n // if an extend-info file was supplied, copy its contents in first\n if (plistContent[8] != null) {\n Object.assign(appPlist, plistContent[8])\n }\n\n const buildMetadata = packager.config!!\n\n /**\n * Configure bundleIdentifier for the generic Electron Helper process\n *\n * This was the only Helper in Electron 5 and before. Allow users to configure\n * the bundleIdentifier for continuity.\n */\n\n const oldHelperBundleId = (buildMetadata as any)[\"helper-bundle-id\"]\n if (oldHelperBundleId != null) {\n log.warn(\"build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId\")\n }\n const helperBundleIdentifier = filterCFBundleIdentifier(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`)\n\n await packager.applyCommonInfo(appPlist, contentsPath)\n\n // required for electron-updater proxy\n if (!isMas) {\n configureLocalhostAts(appPlist)\n }\n\n helperPlist.CFBundleExecutable = `${appFilename} Helper`\n helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`\n helperPlist.CFBundleIdentifier = helperBundleIdentifier\n helperPlist.CFBundleVersion = appPlist.CFBundleVersion\n\n /**\n * Configure bundleIdentifier for Electron 5+ Helper processes\n *\n * In Electron 6, parts of the generic Electron Helper process were split into\n * individual helper processes. Allow users to configure the bundleIdentifiers\n * for continuity, specifically because macOS keychain access relies on\n * bundleIdentifiers not changing (i.e. across versions of Electron).\n */\n\n function configureHelper(helper: any, postfix: string, userProvidedBundleIdentifier?: string | null) {\n helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`\n helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`\n helper.CFBundleIdentifier = userProvidedBundleIdentifier\n ? filterCFBundleIdentifier(userProvidedBundleIdentifier)\n : `${helperBundleIdentifier}.${postfix.replace(/[^a-z0-9]/gim, \"\")}`\n helper.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n if (helperRendererPlist != null) {\n configureHelper(helperRendererPlist, \"(Renderer)\", packager.platformSpecificBuildOptions.helperRendererBundleId)\n }\n if (helperPluginPlist != null) {\n configureHelper(helperPluginPlist, \"(Plugin)\", packager.platformSpecificBuildOptions.helperPluginBundleId)\n }\n if (helperGPUPlist != null) {\n configureHelper(helperGPUPlist, \"(GPU)\", packager.platformSpecificBuildOptions.helperGPUBundleId)\n }\n if (helperEHPlist != null) {\n configureHelper(helperEHPlist, \"EH\", packager.platformSpecificBuildOptions.helperEHBundleId)\n }\n if (helperNPPlist != null) {\n configureHelper(helperNPPlist, \"NP\", packager.platformSpecificBuildOptions.helperNPBundleId)\n }\n if (helperLoginPlist != null) {\n helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`\n helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`\n // noinspection SpellCheckingInspection\n helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`\n helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n const protocols = asArray(buildMetadata.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))\n if (protocols.length > 0) {\n appPlist.CFBundleURLTypes = protocols.map(protocol => {\n const schemes = asArray(protocol.schemes)\n if (schemes.length === 0) {\n throw new InvalidConfigurationError(`Protocol \"${protocol.name}\": must be at least one scheme specified`)\n }\n return {\n CFBundleURLName: protocol.name,\n CFBundleTypeRole: protocol.role || \"Editor\",\n CFBundleURLSchemes: schemes.slice()\n }\n })\n }\n\n const fileAssociations = packager.fileAssociations\n if (fileAssociations.length > 0) {\n appPlist.CFBundleDocumentTypes = await BluebirdPromise.map(fileAssociations, async fileAssociation => {\n const extensions = asArray(fileAssociation.ext).map(normalizeExt)\n const customIcon = await packager.getResource(getPlatformIconFileName(fileAssociation.icon, true), `${extensions[0]}.icns`)\n let iconFile = appPlist.CFBundleIconFile\n if (customIcon != null) {\n iconFile = path.basename(customIcon)\n await copyOrLinkFile(customIcon, path.join(path.join(contentsPath, \"Resources\"), iconFile))\n }\n\n const result = {\n CFBundleTypeExtensions: extensions,\n CFBundleTypeName: fileAssociation.name || extensions[0],\n CFBundleTypeRole: fileAssociation.role || \"Editor\",\n LSHandlerRank: fileAssociation.rank || \"Default\",\n CFBundleTypeIconFile: iconFile\n } as any\n\n if (fileAssociation.isPackage) {\n result.LSTypeIsPackage = true\n }\n return result\n })\n }\n\n if (asarIntegrity != null) {\n appPlist.AsarIntegrity = JSON.stringify(asarIntegrity)\n }\n\n const plistDataToWrite: any = {\n [appPlistFilename]: appPlist,\n [helperPlistFilename]: helperPlist,\n }\n if (helperEHPlist != null) {\n plistDataToWrite[helperEHPlistFilename] = helperEHPlist\n }\n if (helperNPPlist != null) {\n plistDataToWrite[helperNPPlistFilename] = helperNPPlist\n }\n if (helperRendererPlist != null) {\n plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist\n }\n if (helperPluginPlist != null) {\n plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist\n }\n if (helperGPUPlist != null) {\n plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist\n }\n if (helperLoginPlist != null) {\n plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist\n }\n\n await Promise.all([\n executeAppBuilderAndWriteJson([\"encode-plist\"], plistDataToWrite),\n doRename(path.join(contentsPath, \"MacOS\"), \"Electron\", appPlist.CFBundleExecutable),\n unlinkIfExists(path.join(appOutDir, \"LICENSE\")),\n unlinkIfExists(path.join(appOutDir, \"LICENSES.chromium.html\")),\n ])\n\n await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist), frameworksPath, appFilename, \"Electron\")\n\n if (helperLoginPlist != null) {\n const prefix = \"Electron\"\n const suffix = \" Login Helper\"\n const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix)\n .then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`))\n }\n\n const appPath = path.join(appOutDir, `${appFilename}.app`)\n await rename(path.dirname(contentsPath), appPath)\n // https://github.com/electron-userland/electron-builder/issues/840\n const now = Date.now() / 1000\n await utimes(appPath, now, now)\n}\n\nfunction configureLocalhostAts(appPlist: any) {\n // https://bencoding.com/2015/07/20/app-transport-security-and-localhost/\n let ats = appPlist.NSAppTransportSecurity\n if (ats == null) {\n ats = {}\n appPlist.NSAppTransportSecurity = ats\n }\n\n ats.NSAllowsLocalNetworking = true\n // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814\n ats.NSAllowsArbitraryLoads = true\n\n let exceptionDomains = ats.NSExceptionDomains\n if (exceptionDomains == null) {\n exceptionDomains = {}\n ats.NSExceptionDomains = exceptionDomains\n }\n\n if (exceptionDomains.localhost == null) {\n const allowHttp = {\n NSTemporaryExceptionAllowsInsecureHTTPSLoads: false,\n NSIncludesSubdomains: false,\n NSTemporaryExceptionAllowsInsecureHTTPLoads: true,\n NSTemporaryExceptionMinimumTLSVersion: \"1.0\",\n NSTemporaryExceptionRequiresForwardSecrecy: false\n }\n exceptionDomains.localhost = allowHttp\n exceptionDomains[\"127.0.0.1\"] = allowHttp\n }\n}\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["../../src/electron/electronMac.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;;;;;AAEA,SAAS,QAAT,CAAkB,QAAlB,EAAoC,OAApC,EAAqD,OAArD,EAAoE;AAClE,SAAO,uBAAO,IAAI,CAAC,IAAL,CAAU,QAAV,EAAoB,OAApB,CAAP,EAAqC,IAAI,CAAC,IAAL,CAAU,QAAV,EAAoB,OAApB,CAArC,CAAP;AACD;;AAED,SAAS,WAAT,CAAqB,cAArB,EAAoD,cAApD,EAA4E,OAA5E,EAA6F,MAA7F,EAA2G;AACzG,SAAO,uBAAgB,GAAhB,CAAoB,cAApB,EAAoC,MAAM,IAAG;AAClD,UAAM,kBAAkB,GAAG,IAAI,CAAC,IAAL,CAAU,cAAV,EAA0B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4CAA4C,EAAE,KAD9B;AAEhB,MAAA,oBAAoB,EAAE,KAFN;AAGhB,MAAA,2CAA2C,EAAE,IAH7B;AAIhB,MAAA,qCAAqC,EAAE,KAJvB;AAKhB,MAAA,0CAA0C,EAAE;AAL5B,KAAlB;AAOA,IAAA,gBAAgB,CAAC,SAAjB,GAA6B,SAA7B;AACA,IAAA,gBAAgB,CAAC,WAAD,CAAhB,GAAgC,SAAhC;AACD;AACF,C","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { asArray, getPlatformIconFileName, InvalidConfigurationError, log } from \"builder-util\"\nimport { copyOrLinkFile, unlinkIfExists } from \"builder-util/out/fs\"\nimport { rename, utimes } from \"fs-extra\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { AsarIntegrity } from \"../asar/integrity\"\nimport MacPackager from \"../macPackager\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from \"../util/appBuilder\"\n\nfunction doRename(basePath: string, oldName: string, newName: string) {\n return rename(path.join(basePath, oldName), path.join(basePath, newName))\n}\n\nfunction moveHelpers(helperSuffixes: Array<string>, frameworksPath: string, appName: string, prefix: string): Promise<any> {\n return BluebirdPromise.map(helperSuffixes, suffix => {\n const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix)\n .then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`))\n })\n}\n\nfunction getAvailableHelperSuffixes(helperEHPlist: string | null, helperNPPlist: string | null, helperRendererPlist: string | null, helperPluginPlist: string | null, helperGPUPlist: string | null) {\n\n const result = [\" Helper\"]\n if (helperEHPlist != null) {\n result.push(\" Helper EH\")\n }\n if (helperNPPlist != null) {\n result.push(\" Helper NP\")\n }\n if (helperRendererPlist != null) {\n result.push(\" Helper (Renderer)\")\n }\n if (helperPluginPlist != null) {\n result.push(\" Helper (Plugin)\")\n }\n if (helperGPUPlist != null) {\n result.push(\" Helper (GPU)\")\n }\n return result\n}\n\n/** @internal */\nexport async function createMacApp(packager: MacPackager, appOutDir: string, asarIntegrity: AsarIntegrity | null, isMas: boolean) {\n const appInfo = packager.appInfo\n const appFilename = appInfo.productFilename\n\n const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, \"Contents\")\n const frameworksPath = path.join(contentsPath, \"Frameworks\")\n const loginItemPath = path.join(contentsPath, \"Library\", \"LoginItems\")\n\n const appPlistFilename = path.join(contentsPath, \"Info.plist\")\n const helperPlistFilename = path.join(frameworksPath, \"Electron Helper.app\", \"Contents\", \"Info.plist\")\n const helperEHPlistFilename = path.join(frameworksPath, \"Electron Helper EH.app\", \"Contents\", \"Info.plist\")\n const helperNPPlistFilename = path.join(frameworksPath, \"Electron Helper NP.app\", \"Contents\", \"Info.plist\")\n const helperRendererPlistFilename = path.join(frameworksPath, \"Electron Helper (Renderer).app\", \"Contents\", \"Info.plist\")\n const helperPluginPlistFilename = path.join(frameworksPath, \"Electron Helper (Plugin).app\", \"Contents\", \"Info.plist\")\n const helperGPUPlistFilename = path.join(frameworksPath, \"Electron Helper (GPU).app\", \"Contents\", \"Info.plist\")\n const helperLoginPlistFilename = path.join(loginItemPath, \"Electron Login Helper.app\", \"Contents\", \"Info.plist\")\n\n const plistContent: Array<any> = await executeAppBuilderAsJson([\"decode-plist\", \"-f\", appPlistFilename, \"-f\", helperPlistFilename, \"-f\", helperEHPlistFilename, \"-f\", helperNPPlistFilename, \"-f\", helperRendererPlistFilename, \"-f\", helperPluginPlistFilename, \"-f\", helperGPUPlistFilename, \"-f\", helperLoginPlistFilename])\n\n if (plistContent[0] == null) {\n throw new Error(\"corrupted Electron dist\")\n }\n\n const appPlist = plistContent[0]!!\n const helperPlist = plistContent[1]!!\n const helperEHPlist = plistContent[2]\n const helperNPPlist = plistContent[3]\n const helperRendererPlist = plistContent[4]\n const helperPluginPlist = plistContent[5]\n const helperGPUPlist = plistContent[6]\n const helperLoginPlist = plistContent[7]\n\n // if an extend-info file was supplied, copy its contents in first\n if (plistContent[8] != null) {\n Object.assign(appPlist, plistContent[8])\n }\n\n const buildMetadata = packager.config!!\n\n /**\n * Configure bundleIdentifier for the generic Electron Helper process\n *\n * This was the only Helper in Electron 5 and before. Allow users to configure\n * the bundleIdentifier for continuity.\n */\n\n const oldHelperBundleId = (buildMetadata as any)[\"helper-bundle-id\"]\n if (oldHelperBundleId != null) {\n log.warn(\"build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId\")\n }\n const helperBundleIdentifier = filterCFBundleIdentifier(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`)\n\n await packager.applyCommonInfo(appPlist, contentsPath)\n\n // required for electron-updater proxy\n if (!isMas) {\n configureLocalhostAts(appPlist)\n }\n\n helperPlist.CFBundleExecutable = `${appFilename} Helper`\n helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`\n helperPlist.CFBundleIdentifier = helperBundleIdentifier\n helperPlist.CFBundleVersion = appPlist.CFBundleVersion\n\n /**\n * Configure bundleIdentifier for Electron 5+ Helper processes\n *\n * In Electron 6, parts of the generic Electron Helper process were split into\n * individual helper processes. Allow users to configure the bundleIdentifiers\n * for continuity, specifically because macOS keychain access relies on\n * bundleIdentifiers not changing (i.e. across versions of Electron).\n */\n\n function configureHelper(helper: any, postfix: string, userProvidedBundleIdentifier?: string | null) {\n helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`\n helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`\n helper.CFBundleIdentifier = userProvidedBundleIdentifier\n ? filterCFBundleIdentifier(userProvidedBundleIdentifier)\n : filterCFBundleIdentifier(`${helperBundleIdentifier}.${postfix}`)\n helper.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n if (helperRendererPlist != null) {\n configureHelper(helperRendererPlist, \"(Renderer)\", packager.platformSpecificBuildOptions.helperRendererBundleId)\n }\n if (helperPluginPlist != null) {\n configureHelper(helperPluginPlist, \"(Plugin)\", packager.platformSpecificBuildOptions.helperPluginBundleId)\n }\n if (helperGPUPlist != null) {\n configureHelper(helperGPUPlist, \"(GPU)\", packager.platformSpecificBuildOptions.helperGPUBundleId)\n }\n if (helperEHPlist != null) {\n configureHelper(helperEHPlist, \"EH\", packager.platformSpecificBuildOptions.helperEHBundleId)\n }\n if (helperNPPlist != null) {\n configureHelper(helperNPPlist, \"NP\", packager.platformSpecificBuildOptions.helperNPBundleId)\n }\n if (helperLoginPlist != null) {\n helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`\n helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`\n // noinspection SpellCheckingInspection\n helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`\n helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n const protocols = asArray(buildMetadata.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))\n if (protocols.length > 0) {\n appPlist.CFBundleURLTypes = protocols.map(protocol => {\n const schemes = asArray(protocol.schemes)\n if (schemes.length === 0) {\n throw new InvalidConfigurationError(`Protocol \"${protocol.name}\": must be at least one scheme specified`)\n }\n return {\n CFBundleURLName: protocol.name,\n CFBundleTypeRole: protocol.role || \"Editor\",\n CFBundleURLSchemes: schemes.slice()\n }\n })\n }\n\n const fileAssociations = packager.fileAssociations\n if (fileAssociations.length > 0) {\n appPlist.CFBundleDocumentTypes = await BluebirdPromise.map(fileAssociations, async fileAssociation => {\n const extensions = asArray(fileAssociation.ext).map(normalizeExt)\n const customIcon = await packager.getResource(getPlatformIconFileName(fileAssociation.icon, true), `${extensions[0]}.icns`)\n let iconFile = appPlist.CFBundleIconFile\n if (customIcon != null) {\n iconFile = path.basename(customIcon)\n await copyOrLinkFile(customIcon, path.join(path.join(contentsPath, \"Resources\"), iconFile))\n }\n\n const result = {\n CFBundleTypeExtensions: extensions,\n CFBundleTypeName: fileAssociation.name || extensions[0],\n CFBundleTypeRole: fileAssociation.role || \"Editor\",\n LSHandlerRank: fileAssociation.rank || \"Default\",\n CFBundleTypeIconFile: iconFile\n } as any\n\n if (fileAssociation.isPackage) {\n result.LSTypeIsPackage = true\n }\n return result\n })\n }\n\n if (asarIntegrity != null) {\n appPlist.AsarIntegrity = JSON.stringify(asarIntegrity)\n }\n\n const plistDataToWrite: any = {\n [appPlistFilename]: appPlist,\n [helperPlistFilename]: helperPlist,\n }\n if (helperEHPlist != null) {\n plistDataToWrite[helperEHPlistFilename] = helperEHPlist\n }\n if (helperNPPlist != null) {\n plistDataToWrite[helperNPPlistFilename] = helperNPPlist\n }\n if (helperRendererPlist != null) {\n plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist\n }\n if (helperPluginPlist != null) {\n plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist\n }\n if (helperGPUPlist != null) {\n plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist\n }\n if (helperLoginPlist != null) {\n plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist\n }\n\n await Promise.all([\n executeAppBuilderAndWriteJson([\"encode-plist\"], plistDataToWrite),\n doRename(path.join(contentsPath, \"MacOS\"), \"Electron\", appPlist.CFBundleExecutable),\n unlinkIfExists(path.join(appOutDir, \"LICENSE\")),\n unlinkIfExists(path.join(appOutDir, \"LICENSES.chromium.html\")),\n ])\n\n await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist), frameworksPath, appFilename, \"Electron\")\n\n if (helperLoginPlist != null) {\n const prefix = \"Electron\"\n const suffix = \" Login Helper\"\n const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix)\n .then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`))\n }\n\n const appPath = path.join(appOutDir, `${appFilename}.app`)\n await rename(path.dirname(contentsPath), appPath)\n // https://github.com/electron-userland/electron-builder/issues/840\n const now = Date.now() / 1000\n await utimes(appPath, now, now)\n}\n\nfunction configureLocalhostAts(appPlist: any) {\n // https://bencoding.com/2015/07/20/app-transport-security-and-localhost/\n let ats = appPlist.NSAppTransportSecurity\n if (ats == null) {\n ats = {}\n appPlist.NSAppTransportSecurity = ats\n }\n\n ats.NSAllowsLocalNetworking = true\n // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814\n ats.NSAllowsArbitraryLoads = true\n\n let exceptionDomains = ats.NSExceptionDomains\n if (exceptionDomains == null) {\n exceptionDomains = {}\n ats.NSExceptionDomains = exceptionDomains\n }\n\n if (exceptionDomains.localhost == null) {\n const allowHttp = {\n NSTemporaryExceptionAllowsInsecureHTTPSLoads: false,\n NSIncludesSubdomains: false,\n NSTemporaryExceptionAllowsInsecureHTTPLoads: true,\n NSTemporaryExceptionMinimumTLSVersion: \"1.0\",\n NSTemporaryExceptionRequiresForwardSecrecy: false\n }\n exceptionDomains.localhost = allowHttp\n exceptionDomains[\"127.0.0.1\"] = allowHttp\n }\n}\n"],"sourceRoot":""}
|
package/out/macPackager.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Lazy } from "lazy-val";
|
|
|
4
4
|
import { AppInfo } from "./appInfo";
|
|
5
5
|
import { CodeSigningInfo, Identity } from "./codeSign/macCodeSign";
|
|
6
6
|
import { Target } from "./core";
|
|
7
|
-
import { AfterPackContext } from "./index";
|
|
7
|
+
import { AfterPackContext, ElectronPlatformName } from "./index";
|
|
8
8
|
import { MacConfiguration } from "./options/macOptions";
|
|
9
9
|
import { Packager } from "./packager";
|
|
10
10
|
import { PlatformPackager } from "./platformPackager";
|
|
@@ -16,6 +16,7 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
|
|
|
16
16
|
protected prepareAppInfo(appInfo: AppInfo): AppInfo;
|
|
17
17
|
getIconPath(): Promise<string | null>;
|
|
18
18
|
createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void;
|
|
19
|
+
protected doPack(outDir: string, appOutDir: string, platformName: ElectronPlatformName, arch: Arch, platformSpecificBuildOptions: MacConfiguration, targets: Array<Target>): Promise<any>;
|
|
19
20
|
pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<any>;
|
|
20
21
|
private sign;
|
|
21
22
|
private adjustSignOptions;
|
package/out/macPackager.js
CHANGED
|
@@ -167,6 +167,16 @@ function _pathManager() {
|
|
|
167
167
|
return data;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
function _util() {
|
|
171
|
+
const data = require("util");
|
|
172
|
+
|
|
173
|
+
_util = function () {
|
|
174
|
+
return data;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
return data;
|
|
178
|
+
}
|
|
179
|
+
|
|
170
180
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
171
181
|
|
|
172
182
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -251,6 +261,60 @@ class MacPackager extends _platformPackager().PlatformPackager {
|
|
|
251
261
|
}
|
|
252
262
|
}
|
|
253
263
|
|
|
264
|
+
async doPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets) {
|
|
265
|
+
switch (arch) {
|
|
266
|
+
default:
|
|
267
|
+
{
|
|
268
|
+
return super.doPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
case _builderUtil().Arch.universal:
|
|
272
|
+
{
|
|
273
|
+
const x64Arch = _builderUtil().Arch.x64;
|
|
274
|
+
|
|
275
|
+
const x64AppOutDir = appOutDir + '--' + _builderUtil().Arch[x64Arch];
|
|
276
|
+
|
|
277
|
+
await super.doPack(outDir, x64AppOutDir, platformName, x64Arch, platformSpecificBuildOptions, targets, false, true);
|
|
278
|
+
|
|
279
|
+
const arm64Arch = _builderUtil().Arch.arm64;
|
|
280
|
+
|
|
281
|
+
const arm64AppOutPath = appOutDir + '--' + _builderUtil().Arch[arm64Arch];
|
|
282
|
+
|
|
283
|
+
await super.doPack(outDir, arm64AppOutPath, platformName, arm64Arch, platformSpecificBuildOptions, targets, false, true);
|
|
284
|
+
const framework = this.info.framework;
|
|
285
|
+
|
|
286
|
+
_builderUtil().log.info({
|
|
287
|
+
platform: platformName,
|
|
288
|
+
arch: _builderUtil().Arch[arch],
|
|
289
|
+
[`${framework.name}`]: framework.version,
|
|
290
|
+
appOutDir: _builderUtil().log.filePath(appOutDir)
|
|
291
|
+
}, `packaging`);
|
|
292
|
+
|
|
293
|
+
const appFile = `${this.appInfo.productFilename}.app`;
|
|
294
|
+
|
|
295
|
+
const {
|
|
296
|
+
makeUniversalApp
|
|
297
|
+
} = require('@electron/universal');
|
|
298
|
+
|
|
299
|
+
await makeUniversalApp({
|
|
300
|
+
x64AppPath: path.join(x64AppOutDir, appFile),
|
|
301
|
+
arm64AppPath: path.join(arm64AppOutPath, appFile),
|
|
302
|
+
outAppPath: path.join(appOutDir, appFile),
|
|
303
|
+
force: true
|
|
304
|
+
});
|
|
305
|
+
const rmdir = (0, _util().promisify)(require('fs').rmdir);
|
|
306
|
+
await rmdir(x64AppOutDir, {
|
|
307
|
+
recursive: true
|
|
308
|
+
});
|
|
309
|
+
await rmdir(arm64AppOutPath, {
|
|
310
|
+
recursive: true
|
|
311
|
+
});
|
|
312
|
+
await this.doSignAfterPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets);
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
254
318
|
async pack(outDir, arch, targets, taskManager) {
|
|
255
319
|
let nonMasPromise = null;
|
|
256
320
|
const hasMas = targets.length !== 0 && targets.some(it => it.name === "mas" || it.name === "mas-dev");
|
|
@@ -276,13 +340,13 @@ class MacPackager extends _platformPackager().PlatformPackager {
|
|
|
276
340
|
});
|
|
277
341
|
}
|
|
278
342
|
|
|
279
|
-
const targetOutDir = path.join(outDir, targetName);
|
|
343
|
+
const targetOutDir = path.join(outDir, `${targetName}${(0, _builderUtil().getArchSuffix)(arch)}`);
|
|
280
344
|
|
|
281
345
|
if (prepackaged == null) {
|
|
282
346
|
await this.doPack(outDir, targetOutDir, "mas", arch, masBuildOptions, [target]);
|
|
283
|
-
await this.sign(path.join(targetOutDir, `${this.appInfo.productFilename}.app`), targetOutDir, masBuildOptions);
|
|
347
|
+
await this.sign(path.join(targetOutDir, `${this.appInfo.productFilename}.app`), targetOutDir, masBuildOptions, arch);
|
|
284
348
|
} else {
|
|
285
|
-
await this.sign(prepackaged, targetOutDir, masBuildOptions);
|
|
349
|
+
await this.sign(prepackaged, targetOutDir, masBuildOptions, arch);
|
|
286
350
|
}
|
|
287
351
|
}
|
|
288
352
|
|
|
@@ -291,7 +355,7 @@ class MacPackager extends _platformPackager().PlatformPackager {
|
|
|
291
355
|
}
|
|
292
356
|
}
|
|
293
357
|
|
|
294
|
-
async sign(appPath, outDir, masOptions) {
|
|
358
|
+
async sign(appPath, outDir, masOptions, arch) {
|
|
295
359
|
if (!(0, _macCodeSign().isSignAllowed)()) {
|
|
296
360
|
return;
|
|
297
361
|
}
|
|
@@ -403,10 +467,10 @@ class MacPackager extends _platformPackager().PlatformPackager {
|
|
|
403
467
|
} // mas uploaded to AppStore, so, use "-" instead of space for name
|
|
404
468
|
|
|
405
469
|
|
|
406
|
-
const artifactName = this.expandArtifactNamePattern(masOptions, "pkg");
|
|
470
|
+
const artifactName = this.expandArtifactNamePattern(masOptions, "pkg", arch);
|
|
407
471
|
const artifactPath = path.join(outDir, artifactName);
|
|
408
472
|
await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile);
|
|
409
|
-
await this.dispatchArtifactCreated(artifactPath, null, _builderUtil().Arch.x64, this.computeSafeArtifactName(artifactName, "pkg"));
|
|
473
|
+
await this.dispatchArtifactCreated(artifactPath, null, _builderUtil().Arch.x64, this.computeSafeArtifactName(artifactName, "pkg", arch, true, this.platformSpecificBuildOptions.defaultArch));
|
|
410
474
|
}
|
|
411
475
|
}
|
|
412
476
|
|
|
@@ -521,7 +585,7 @@ class MacPackager extends _platformPackager().PlatformPackager {
|
|
|
521
585
|
const appFileName = `${this.appInfo.productFilename}.app`;
|
|
522
586
|
await _bluebirdLst().default.map((0, _fsExtra().readdir)(packContext.appOutDir), file => {
|
|
523
587
|
if (file === appFileName) {
|
|
524
|
-
return this.sign(path.join(packContext.appOutDir, file), null, null);
|
|
588
|
+
return this.sign(path.join(packContext.appOutDir, file), null, null, null);
|
|
525
589
|
}
|
|
526
590
|
|
|
527
591
|
return null;
|
|
@@ -534,7 +598,7 @@ class MacPackager extends _platformPackager().PlatformPackager {
|
|
|
534
598
|
const outResourcesDir = path.join(packContext.appOutDir, "resources", "app.asar.unpacked");
|
|
535
599
|
await _bluebirdLst().default.map((0, _promise().orIfFileNotExist)((0, _fsExtra().readdir)(outResourcesDir), []), file => {
|
|
536
600
|
if (file.endsWith(".app")) {
|
|
537
|
-
return this.sign(path.join(outResourcesDir, file), null, null);
|
|
601
|
+
return this.sign(path.join(outResourcesDir, file), null, null, null);
|
|
538
602
|
} else {
|
|
539
603
|
return null;
|
|
540
604
|
}
|
package/out/macPackager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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AQ,eAAR,CAAjB,EAA2C,EAA3C,CAApB,EAAqE,IAAD,IAAsB;AAC9F,UAAI,IAAI,CAAC,QAAL,CAAc,MAAd,CAAJ,EAA2B;AACzB,eAAO,KAAK,IAAL,CAAU,IAAI,CAAC,IAAL,CAAU,eAAV,EAA2B,IAA3B,CAAV,EAA4C,IAA5C,EAAkD,IAAlD,CAAP;AACD,OAFD,MAGK;AACH,eAAO,IAAP;AACD;AACF,KAPK,CAAN;AAQD;;AAjWwE;;;;AAoW3E,SAAS,kBAAT,CAA4B,KAA5B,EAA4C,aAA5C,EAAkE;AAChE,MAAI,aAAJ,EAAmB;AACjB,WAAO,eAAP;AACD;;AACD,SAAO,KAAK,GAAG,qCAAH,GAA2C,0BAAvD;AACD,C","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { deepAssign, Arch, AsyncTaskManager, exec, InvalidConfigurationError, log, use } from \"builder-util\"\nimport { signAsync, SignOptions } from \"../electron-osx-sign\"\nimport { mkdirs, readdir } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { copyFile, unlinkIfExists } from \"builder-util/out/fs\"\nimport { orIfFileNotExist } from \"builder-util/out/promise\"\nimport { AppInfo } from \"./appInfo\"\nimport { CertType, CodeSigningInfo, createKeychain, findIdentity, Identity, isSignAllowed, removeKeychain, reportError } from \"./codeSign/macCodeSign\"\nimport { DIR_TARGET, Platform, Target } from \"./core\"\nimport { AfterPackContext, ElectronPlatformName } from \"./index\"\nimport { MacConfiguration, MasConfiguration } from \"./options/macOptions\"\nimport { Packager } from \"./packager\"\nimport { chooseNotNull, PlatformPackager } from \"./platformPackager\"\nimport { ArchiveTarget } from \"./targets/ArchiveTarget\"\nimport { PkgTarget, prepareProductBuildArgs } from \"./targets/pkg\"\nimport { createCommonTarget, NoOpTarget } from \"./targets/targetFactory\"\nimport { isMacOsHighSierra } from \"./util/macosVersion\"\nimport { getTemplatePath } from \"./util/pathManager\"\n\nexport default class MacPackager extends PlatformPackager<MacConfiguration> {\n readonly codeSigningInfo = new Lazy<CodeSigningInfo>(() => {\n const cscLink = this.getCscLink()\n if (cscLink == null || process.platform !== \"darwin\") {\n return Promise.resolve({keychainFile: process.env.CSC_KEYCHAIN || null})\n }\n\n return createKeychain({\n tmpDir: this.info.tempDirManager,\n cscLink,\n cscKeyPassword: this.getCscPassword(),\n cscILink: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK),\n cscIKeyPassword: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD),\n currentDir: this.projectDir\n })\n .then(result => {\n const keychainFile = result.keychainFile\n if (keychainFile != null) {\n this.info.disposeOnBuildFinish(() => removeKeychain(keychainFile))\n }\n return result\n })\n })\n\n private _iconPath = new Lazy(() => this.getOrConvertIcon(\"icns\"))\n\n constructor(info: Packager) {\n super(info, Platform.MAC)\n }\n\n get defaultTarget(): Array<string> {\n return this.info.framework.macOsDefaultTargets\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected prepareAppInfo(appInfo: AppInfo): AppInfo {\n return new AppInfo(this.info, this.platformSpecificBuildOptions.bundleVersion, this.platformSpecificBuildOptions)\n }\n\n async getIconPath(): Promise<string | null> {\n return this._iconPath.value\n }\n\n createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void {\n for (const name of targets) {\n switch (name) {\n case DIR_TARGET:\n break\n\n case \"dmg\": {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const {DmgTarget} = require(\"dmg-builder\")\n mapper(name, outDir => new DmgTarget(this, outDir))\n break\n }\n\n case \"zip\":\n // https://github.com/electron-userland/electron-builder/issues/2313\n mapper(name, outDir => new ArchiveTarget(name, outDir, this, true))\n break\n\n case \"pkg\":\n mapper(name, outDir => new PkgTarget(this, outDir))\n break\n\n default:\n mapper(name, outDir => name === \"mas\" || name === \"mas-dev\" ? new NoOpTarget(name) : createCommonTarget(name, outDir, this))\n break\n }\n }\n }\n\n async pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<any> {\n let nonMasPromise: Promise<any> | null = null\n\n const hasMas = targets.length !== 0 && targets.some(it => it.name === \"mas\" || it.name === \"mas-dev\")\n const prepackaged = this.packagerOptions.prepackaged\n\n if (!hasMas || targets.length > 1) {\n const appPath = prepackaged == null ? path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`) : prepackaged\n nonMasPromise = (prepackaged ? Promise.resolve() : this.doPack(outDir, path.dirname(appPath), this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets))\n .then(() => this.packageInDistributableFormat(appPath, arch, targets, taskManager))\n }\n\n for (const target of targets) {\n const targetName = target.name\n if (!(targetName === \"mas\" || targetName === \"mas-dev\")) {\n continue\n }\n\n const masBuildOptions = deepAssign({}, this.platformSpecificBuildOptions, this.config.mas)\n if (targetName === \"mas-dev\") {\n deepAssign(masBuildOptions, this.config.masDev, {\n type: \"development\",\n })\n }\n\n const targetOutDir = path.join(outDir, targetName)\n if (prepackaged == null) {\n await this.doPack(outDir, targetOutDir, \"mas\", arch, masBuildOptions, [target])\n await this.sign(path.join(targetOutDir, `${this.appInfo.productFilename}.app`), targetOutDir, masBuildOptions)\n }\n else {\n await this.sign(prepackaged, targetOutDir, masBuildOptions)\n }\n }\n\n if (nonMasPromise != null) {\n await nonMasPromise\n }\n }\n\n private async sign(appPath: string, outDir: string | null, masOptions: MasConfiguration | null): Promise<void> {\n if (!isSignAllowed()) {\n return\n }\n\n const isMas = masOptions != null\n const options = masOptions == null ? this.platformSpecificBuildOptions : masOptions\n const qualifier = options.identity\n\n if (!isMas && qualifier === null) {\n if (this.forceCodeSigning) {\n throw new InvalidConfigurationError(\"identity explicitly is set to null, but forceCodeSigning is set to true\")\n }\n log.info({reason: \"identity explicitly is set to null\"}, \"skipped macOS code signing\")\n return\n }\n\n const keychainFile = (await this.codeSigningInfo.value).keychainFile\n const explicitType = options.type\n const type = explicitType || \"distribution\"\n const isDevelopment = type === \"development\"\n const certificateType = getCertificateType(isMas, isDevelopment)\n let identity = await findIdentity(certificateType, qualifier, keychainFile)\n if (identity == null) {\n if (!isMas && !isDevelopment && explicitType !== \"distribution\") {\n identity = await findIdentity(\"Mac Developer\", qualifier, keychainFile)\n if (identity != null) {\n log.warn(\"Mac Developer is used to sign app — it is only for development and testing, not for production\")\n }\n }\n\n if (identity == null) {\n await reportError(isMas, certificateType, qualifier, keychainFile, this.forceCodeSigning)\n return\n }\n }\n\n if (!isMacOsHighSierra()) {\n throw new InvalidConfigurationError(\"macOS High Sierra 10.13.6 is required to sign\")\n }\n\n let filter = options.signIgnore\n if (Array.isArray(filter)) {\n if (filter.length == 0) {\n filter = null\n }\n }\n else if (filter != null) {\n filter = filter.length === 0 ? null : [filter]\n }\n\n const filterRe = filter == null ? null : filter.map(it => new RegExp(it))\n\n const signOptions: any = {\n \"identity-validation\": false,\n // https://github.com/electron-userland/electron-builder/issues/1699\n // kext are signed by the chipset manufacturers. You need a special certificate (only available on request) from Apple to be able to sign kext.\n ignore: (file: string) => {\n if (filterRe != null) {\n for (const regExp of filterRe) {\n if (regExp.test(file)) {\n return true\n }\n }\n }\n return file.endsWith(\".kext\") || file.startsWith(\"/Contents/PlugIns\", appPath.length) ||\n file.includes(\"/node_modules/puppeteer/.local-chromium\") || file.includes(\"/node_modules/playwright-firefox/.local-browsers\") || file.includes(\"/node_modules/playwright/.local-browsers\") \n \n /* Those are browser automating modules, browser (chromium, nightly) cannot be signed\n https://github.com/electron-userland/electron-builder/issues/2010 \n https://github.com/electron-userland/electron-builder/issues/5383\n */\n },\n identity: identity!,\n type,\n platform: isMas ? \"mas\" : \"darwin\",\n version: this.config.electronVersion,\n app: appPath,\n keychain: keychainFile || undefined,\n binaries: options.binaries || undefined,\n requirements: isMas || this.platformSpecificBuildOptions.requirements == null ? undefined : await this.getResource(this.platformSpecificBuildOptions.requirements),\n // https://github.com/electron-userland/electron-osx-sign/issues/196\n // will fail on 10.14.5+ because a signed but unnotarized app is also rejected.\n \"gatekeeper-assess\": options.gatekeeperAssess === true,\n // https://github.com/electron-userland/electron-builder/issues/1480\n \"strict-verify\": options.strictVerify,\n hardenedRuntime: isMas ? masOptions && masOptions.hardenedRuntime === true : options.hardenedRuntime !== false,\n }\n\n await this.adjustSignOptions(signOptions, masOptions)\n log.info({\n file: log.filePath(appPath),\n identityName: identity.name,\n identityHash: identity.hash,\n provisioningProfile: signOptions[\"provisioning-profile\"] || \"none\",\n }, \"signing\")\n await this.doSign(signOptions)\n\n // https://github.com/electron-userland/electron-builder/issues/1196#issuecomment-312310209\n if (masOptions != null && !isDevelopment) {\n const certType = isDevelopment ? \"Mac Developer\" : \"3rd Party Mac Developer Installer\"\n const masInstallerIdentity = await findIdentity(certType, masOptions.identity, keychainFile)\n if (masInstallerIdentity == null) {\n throw new InvalidConfigurationError(`Cannot find valid \"${certType}\" identity to sign MAS installer, please see https://electron.build/code-signing`)\n }\n\n // mas uploaded to AppStore, so, use \"-\" instead of space for name\n const artifactName = this.expandArtifactNamePattern(masOptions, \"pkg\")\n const artifactPath = path.join(outDir!, artifactName)\n await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile)\n await this.dispatchArtifactCreated(artifactPath, null, Arch.x64, this.computeSafeArtifactName(artifactName, \"pkg\"))\n }\n }\n\n private async adjustSignOptions(signOptions: any, masOptions: MasConfiguration | null) {\n const resourceList = await this.resourceList\n const customSignOptions = masOptions || this.platformSpecificBuildOptions\n const entitlementsSuffix = masOptions == null ? \"mac\" : \"mas\"\n\n let entitlements = customSignOptions.entitlements\n if (entitlements == null) {\n const p = `entitlements.${entitlementsSuffix}.plist`\n if (resourceList.includes(p)) {\n entitlements = path.join(this.info.buildResourcesDir, p)\n }\n else {\n entitlements = getTemplatePath(\"entitlements.mac.plist\")\n }\n }\n signOptions.entitlements = entitlements\n\n let entitlementsInherit = customSignOptions.entitlementsInherit\n if (entitlementsInherit == null) {\n const p = `entitlements.${entitlementsSuffix}.inherit.plist`\n if (resourceList.includes(p)) {\n entitlementsInherit = path.join(this.info.buildResourcesDir, p)\n }\n else {\n entitlementsInherit = getTemplatePath(\"entitlements.mac.plist\")\n }\n }\n signOptions[\"entitlements-inherit\"] = entitlementsInherit\n\n if (customSignOptions.provisioningProfile != null) {\n signOptions[\"provisioning-profile\"] = customSignOptions.provisioningProfile\n }\n signOptions['entitlements-loginhelper'] = customSignOptions.entitlementsLoginHelper\n }\n\n //noinspection JSMethodCanBeStatic\n protected async doSign(opts: SignOptions): Promise<any> {\n return signAsync(opts)\n }\n\n //noinspection JSMethodCanBeStatic\n protected async doFlat(appPath: string, outFile: string, identity: Identity, keychain: string | null | undefined): Promise<any> {\n // productbuild doesn't created directory for out file\n await mkdirs(path.dirname(outFile))\n\n const args = prepareProductBuildArgs(identity, keychain)\n args.push(\"--component\", appPath, \"/Applications\")\n args.push(outFile)\n return await exec(\"productbuild\", args)\n }\n\n public getElectronSrcDir(dist: string) {\n return path.resolve(this.projectDir, dist, this.info.framework.distMacOsAppName)\n }\n\n public getElectronDestinationDir(appOutDir: string) {\n return path.join(appOutDir, this.info.framework.distMacOsAppName)\n }\n\n // todo fileAssociations\n async applyCommonInfo(appPlist: any, contentsPath: string) {\n const appInfo = this.appInfo\n const appFilename = appInfo.productFilename\n\n // https://github.com/electron-userland/electron-builder/issues/1278\n appPlist.CFBundleExecutable = appFilename.endsWith(\" Helper\") ? appFilename.substring(0, appFilename.length - \" Helper\".length) : appFilename\n\n const icon = await this.getIconPath()\n if (icon != null) {\n const oldIcon = appPlist.CFBundleIconFile\n const resourcesPath = path.join(contentsPath, \"Resources\")\n if (oldIcon != null) {\n await unlinkIfExists(path.join(resourcesPath, oldIcon))\n }\n const iconFileName = `${appFilename}.icns`\n appPlist.CFBundleIconFile = iconFileName\n await copyFile(icon, path.join(resourcesPath, iconFileName))\n }\n appPlist.CFBundleName = appInfo.productName\n appPlist.CFBundleDisplayName = appInfo.productName\n\n const minimumSystemVersion = this.platformSpecificBuildOptions.minimumSystemVersion\n if (minimumSystemVersion != null) {\n appPlist.LSMinimumSystemVersion = minimumSystemVersion\n }\n\n appPlist.CFBundleIdentifier = appInfo.macBundleIdentifier\n\n appPlist.CFBundleShortVersionString = this.platformSpecificBuildOptions.bundleShortVersion || appInfo.version\n appPlist.CFBundleVersion = appInfo.buildVersion\n\n use(this.platformSpecificBuildOptions.category || (this.config as any).category, it => appPlist.LSApplicationCategoryType = it)\n appPlist.NSHumanReadableCopyright = appInfo.copyright\n\n if (this.platformSpecificBuildOptions.darkModeSupport) {\n appPlist.NSRequiresAquaSystemAppearance = false\n }\n\n const extendInfo = this.platformSpecificBuildOptions.extendInfo\n if (extendInfo != null) {\n Object.assign(appPlist, extendInfo)\n }\n }\n\n protected async signApp(packContext: AfterPackContext, isAsar: boolean): Promise<any> {\n const appFileName = `${this.appInfo.productFilename}.app`\n\n await BluebirdPromise.map(readdir(packContext.appOutDir), (file: string): any => {\n if (file === appFileName) {\n return this.sign(path.join(packContext.appOutDir, file), null, null)\n }\n return null\n })\n\n if (!isAsar) {\n return\n }\n\n const outResourcesDir = path.join(packContext.appOutDir, \"resources\", \"app.asar.unpacked\")\n await BluebirdPromise.map(orIfFileNotExist(readdir(outResourcesDir), []), (file: string): any => {\n if (file.endsWith(\".app\")) {\n return this.sign(path.join(outResourcesDir, file), null, null)\n }\n else {\n return null\n }\n })\n }\n}\n\nfunction getCertificateType(isMas: boolean, isDevelopment: boolean): CertType {\n if (isDevelopment) {\n return \"Mac Developer\"\n }\n return isMas ? \"3rd Party Mac Developer Application\" : \"Developer ID Application\"\n}\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["../src/macPackager.ts"],"names":[],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAA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, Arch, AsyncTaskManager, exec, InvalidConfigurationError, log, use, getArchSuffix } from \"builder-util\"\nimport { signAsync, SignOptions } from \"../electron-osx-sign\"\nimport { mkdirs, readdir } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { copyFile, unlinkIfExists } from \"builder-util/out/fs\"\nimport { orIfFileNotExist } from \"builder-util/out/promise\"\nimport { AppInfo } from \"./appInfo\"\nimport { CertType, CodeSigningInfo, createKeychain, findIdentity, Identity, isSignAllowed, removeKeychain, reportError } from \"./codeSign/macCodeSign\"\nimport { DIR_TARGET, Platform, Target } from \"./core\"\nimport { AfterPackContext, ElectronPlatformName } from \"./index\"\nimport { MacConfiguration, MasConfiguration } from \"./options/macOptions\"\nimport { Packager } from \"./packager\"\nimport { chooseNotNull, PlatformPackager } from \"./platformPackager\"\nimport { ArchiveTarget } from \"./targets/ArchiveTarget\"\nimport { PkgTarget, prepareProductBuildArgs } from \"./targets/pkg\"\nimport { createCommonTarget, NoOpTarget } from \"./targets/targetFactory\"\nimport { isMacOsHighSierra } from \"./util/macosVersion\"\nimport { getTemplatePath } from \"./util/pathManager\"\nimport { promisify } from \"util\"\n\nexport default class MacPackager extends PlatformPackager<MacConfiguration> {\n readonly codeSigningInfo = new Lazy<CodeSigningInfo>(() => {\n const cscLink = this.getCscLink()\n if (cscLink == null || process.platform !== \"darwin\") {\n return Promise.resolve({keychainFile: process.env.CSC_KEYCHAIN || null})\n }\n\n return createKeychain({\n tmpDir: this.info.tempDirManager,\n cscLink,\n cscKeyPassword: this.getCscPassword(),\n cscILink: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerLink, process.env.CSC_INSTALLER_LINK),\n cscIKeyPassword: chooseNotNull(this.platformSpecificBuildOptions.cscInstallerKeyPassword, process.env.CSC_INSTALLER_KEY_PASSWORD),\n currentDir: this.projectDir\n })\n .then(result => {\n const keychainFile = result.keychainFile\n if (keychainFile != null) {\n this.info.disposeOnBuildFinish(() => removeKeychain(keychainFile))\n }\n return result\n })\n })\n\n private _iconPath = new Lazy(() => this.getOrConvertIcon(\"icns\"))\n\n constructor(info: Packager) {\n super(info, Platform.MAC)\n }\n\n get defaultTarget(): Array<string> {\n return this.info.framework.macOsDefaultTargets\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected prepareAppInfo(appInfo: AppInfo): AppInfo {\n return new AppInfo(this.info, this.platformSpecificBuildOptions.bundleVersion, this.platformSpecificBuildOptions)\n }\n\n async getIconPath(): Promise<string | null> {\n return this._iconPath.value\n }\n\n createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void {\n for (const name of targets) {\n switch (name) {\n case DIR_TARGET:\n break\n\n case \"dmg\": {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const {DmgTarget} = require(\"dmg-builder\")\n mapper(name, outDir => new DmgTarget(this, outDir))\n break\n }\n\n case \"zip\":\n // https://github.com/electron-userland/electron-builder/issues/2313\n mapper(name, outDir => new ArchiveTarget(name, outDir, this, true))\n break\n\n case \"pkg\":\n mapper(name, outDir => new PkgTarget(this, outDir))\n break\n\n default:\n mapper(name, outDir => name === \"mas\" || name === \"mas-dev\" ? new NoOpTarget(name) : createCommonTarget(name, outDir, this))\n break\n }\n }\n }\n\n protected async doPack(outDir: string, appOutDir: string, platformName: ElectronPlatformName, arch: Arch, platformSpecificBuildOptions: MacConfiguration, targets: Array<Target>): Promise<any> {\n switch (arch) {\n default: {\n return super.doPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets);\n }\n case Arch.universal: {\n const x64Arch = Arch.x64;\n const x64AppOutDir = appOutDir + '--' + Arch[x64Arch];\n await super.doPack(outDir, x64AppOutDir, platformName, x64Arch, platformSpecificBuildOptions, targets, false, true);\n const arm64Arch = Arch.arm64;\n const arm64AppOutPath = appOutDir + '--' + Arch[arm64Arch];\n await super.doPack(outDir, arm64AppOutPath, platformName, arm64Arch, platformSpecificBuildOptions, targets, false, true);\n const framework = this.info.framework\n log.info({\n platform: platformName,\n arch: Arch[arch],\n [`${framework.name}`]: framework.version,\n appOutDir: log.filePath(appOutDir),\n }, `packaging`)\n const appFile = `${this.appInfo.productFilename}.app`;\n const { makeUniversalApp } = require('@electron/universal');\n await makeUniversalApp({\n x64AppPath: path.join(x64AppOutDir, appFile),\n arm64AppPath: path.join(arm64AppOutPath, appFile),\n outAppPath: path.join(appOutDir, appFile),\n force: true\n });\n const rmdir = promisify(require('fs').rmdir);\n await rmdir(x64AppOutDir, { recursive: true });\n await rmdir(arm64AppOutPath, { recursive: true });\n await this.doSignAfterPack(outDir, appOutDir, platformName, arch, platformSpecificBuildOptions, targets);\n break;\n }\n }\n }\n\n async pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<any> {\n let nonMasPromise: Promise<any> | null = null\n\n const hasMas = targets.length !== 0 && targets.some(it => it.name === \"mas\" || it.name === \"mas-dev\")\n const prepackaged = this.packagerOptions.prepackaged\n\n if (!hasMas || targets.length > 1) {\n const appPath = prepackaged == null ? path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`) : prepackaged\n nonMasPromise = (prepackaged ? Promise.resolve() : this.doPack(outDir, path.dirname(appPath), this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets))\n .then(() => this.packageInDistributableFormat(appPath, arch, targets, taskManager))\n }\n\n for (const target of targets) {\n const targetName = target.name\n if (!(targetName === \"mas\" || targetName === \"mas-dev\")) {\n continue\n }\n\n const masBuildOptions = deepAssign({}, this.platformSpecificBuildOptions, this.config.mas)\n if (targetName === \"mas-dev\") {\n deepAssign(masBuildOptions, this.config.masDev, {\n type: \"development\",\n })\n }\n\n const targetOutDir = path.join(outDir, `${targetName}${getArchSuffix(arch)}`)\n if (prepackaged == null) {\n await this.doPack(outDir, targetOutDir, \"mas\", arch, masBuildOptions, [target])\n await this.sign(path.join(targetOutDir, `${this.appInfo.productFilename}.app`), targetOutDir, masBuildOptions, arch)\n }\n else {\n await this.sign(prepackaged, targetOutDir, masBuildOptions, arch)\n }\n }\n\n if (nonMasPromise != null) {\n await nonMasPromise\n }\n }\n\n private async sign(appPath: string, outDir: string | null, masOptions: MasConfiguration | null, arch: Arch | null): Promise<void> {\n if (!isSignAllowed()) {\n return\n }\n\n const isMas = masOptions != null\n const options = masOptions == null ? this.platformSpecificBuildOptions : masOptions\n const qualifier = options.identity\n\n if (!isMas && qualifier === null) {\n if (this.forceCodeSigning) {\n throw new InvalidConfigurationError(\"identity explicitly is set to null, but forceCodeSigning is set to true\")\n }\n log.info({reason: \"identity explicitly is set to null\"}, \"skipped macOS code signing\")\n return\n }\n\n const keychainFile = (await this.codeSigningInfo.value).keychainFile\n const explicitType = options.type\n const type = explicitType || \"distribution\"\n const isDevelopment = type === \"development\"\n const certificateType = getCertificateType(isMas, isDevelopment)\n let identity = await findIdentity(certificateType, qualifier, keychainFile)\n if (identity == null) {\n if (!isMas && !isDevelopment && explicitType !== \"distribution\") {\n identity = await findIdentity(\"Mac Developer\", qualifier, keychainFile)\n if (identity != null) {\n log.warn(\"Mac Developer is used to sign app — it is only for development and testing, not for production\")\n }\n }\n\n if (identity == null) {\n await reportError(isMas, certificateType, qualifier, keychainFile, this.forceCodeSigning)\n return\n }\n }\n\n if (!isMacOsHighSierra()) {\n throw new InvalidConfigurationError(\"macOS High Sierra 10.13.6 is required to sign\")\n }\n\n let filter = options.signIgnore\n if (Array.isArray(filter)) {\n if (filter.length == 0) {\n filter = null\n }\n }\n else if (filter != null) {\n filter = filter.length === 0 ? null : [filter]\n }\n\n const filterRe = filter == null ? null : filter.map(it => new RegExp(it))\n\n const signOptions: any = {\n \"identity-validation\": false,\n // https://github.com/electron-userland/electron-builder/issues/1699\n // kext are signed by the chipset manufacturers. You need a special certificate (only available on request) from Apple to be able to sign kext.\n ignore: (file: string) => {\n if (filterRe != null) {\n for (const regExp of filterRe) {\n if (regExp.test(file)) {\n return true\n }\n }\n }\n return file.endsWith(\".kext\") || file.startsWith(\"/Contents/PlugIns\", appPath.length) ||\n file.includes(\"/node_modules/puppeteer/.local-chromium\") || file.includes(\"/node_modules/playwright-firefox/.local-browsers\") || file.includes(\"/node_modules/playwright/.local-browsers\") \n \n /* Those are browser automating modules, browser (chromium, nightly) cannot be signed\n https://github.com/electron-userland/electron-builder/issues/2010 \n https://github.com/electron-userland/electron-builder/issues/5383\n */\n },\n identity: identity!,\n type,\n platform: isMas ? \"mas\" : \"darwin\",\n version: this.config.electronVersion,\n app: appPath,\n keychain: keychainFile || undefined,\n binaries: options.binaries || undefined,\n requirements: isMas || this.platformSpecificBuildOptions.requirements == null ? undefined : await this.getResource(this.platformSpecificBuildOptions.requirements),\n // https://github.com/electron-userland/electron-osx-sign/issues/196\n // will fail on 10.14.5+ because a signed but unnotarized app is also rejected.\n \"gatekeeper-assess\": options.gatekeeperAssess === true,\n // https://github.com/electron-userland/electron-builder/issues/1480\n \"strict-verify\": options.strictVerify,\n hardenedRuntime: isMas ? masOptions && masOptions.hardenedRuntime === true : options.hardenedRuntime !== false,\n }\n\n await this.adjustSignOptions(signOptions, masOptions)\n log.info({\n file: log.filePath(appPath),\n identityName: identity.name,\n identityHash: identity.hash,\n provisioningProfile: signOptions[\"provisioning-profile\"] || \"none\",\n }, \"signing\")\n await this.doSign(signOptions)\n\n // https://github.com/electron-userland/electron-builder/issues/1196#issuecomment-312310209\n if (masOptions != null && !isDevelopment) {\n const certType = isDevelopment ? \"Mac Developer\" : \"3rd Party Mac Developer Installer\"\n const masInstallerIdentity = await findIdentity(certType, masOptions.identity, keychainFile)\n if (masInstallerIdentity == null) {\n throw new InvalidConfigurationError(`Cannot find valid \"${certType}\" identity to sign MAS installer, please see https://electron.build/code-signing`)\n }\n\n // mas uploaded to AppStore, so, use \"-\" instead of space for name\n const artifactName = this.expandArtifactNamePattern(masOptions, \"pkg\", arch)\n const artifactPath = path.join(outDir!, artifactName)\n await this.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile)\n await this.dispatchArtifactCreated(artifactPath, null, Arch.x64, this.computeSafeArtifactName(artifactName, \"pkg\", arch, true, this.platformSpecificBuildOptions.defaultArch))\n }\n }\n\n private async adjustSignOptions(signOptions: any, masOptions: MasConfiguration | null) {\n const resourceList = await this.resourceList\n const customSignOptions = masOptions || this.platformSpecificBuildOptions\n const entitlementsSuffix = masOptions == null ? \"mac\" : \"mas\"\n\n let entitlements = customSignOptions.entitlements\n if (entitlements == null) {\n const p = `entitlements.${entitlementsSuffix}.plist`\n if (resourceList.includes(p)) {\n entitlements = path.join(this.info.buildResourcesDir, p)\n }\n else {\n entitlements = getTemplatePath(\"entitlements.mac.plist\")\n }\n }\n signOptions.entitlements = entitlements\n\n let entitlementsInherit = customSignOptions.entitlementsInherit\n if (entitlementsInherit == null) {\n const p = `entitlements.${entitlementsSuffix}.inherit.plist`\n if (resourceList.includes(p)) {\n entitlementsInherit = path.join(this.info.buildResourcesDir, p)\n }\n else {\n entitlementsInherit = getTemplatePath(\"entitlements.mac.plist\")\n }\n }\n signOptions[\"entitlements-inherit\"] = entitlementsInherit\n\n if (customSignOptions.provisioningProfile != null) {\n signOptions[\"provisioning-profile\"] = customSignOptions.provisioningProfile\n }\n signOptions['entitlements-loginhelper'] = customSignOptions.entitlementsLoginHelper\n }\n\n //noinspection JSMethodCanBeStatic\n protected async doSign(opts: SignOptions): Promise<any> {\n return signAsync(opts)\n }\n\n //noinspection JSMethodCanBeStatic\n protected async doFlat(appPath: string, outFile: string, identity: Identity, keychain: string | null | undefined): Promise<any> {\n // productbuild doesn't created directory for out file\n await mkdirs(path.dirname(outFile))\n\n const args = prepareProductBuildArgs(identity, keychain)\n args.push(\"--component\", appPath, \"/Applications\")\n args.push(outFile)\n return await exec(\"productbuild\", args)\n }\n\n public getElectronSrcDir(dist: string) {\n return path.resolve(this.projectDir, dist, this.info.framework.distMacOsAppName)\n }\n\n public getElectronDestinationDir(appOutDir: string) {\n return path.join(appOutDir, this.info.framework.distMacOsAppName)\n }\n\n // todo fileAssociations\n async applyCommonInfo(appPlist: any, contentsPath: string) {\n const appInfo = this.appInfo\n const appFilename = appInfo.productFilename\n\n // https://github.com/electron-userland/electron-builder/issues/1278\n appPlist.CFBundleExecutable = appFilename.endsWith(\" Helper\") ? appFilename.substring(0, appFilename.length - \" Helper\".length) : appFilename\n\n const icon = await this.getIconPath()\n if (icon != null) {\n const oldIcon = appPlist.CFBundleIconFile\n const resourcesPath = path.join(contentsPath, \"Resources\")\n if (oldIcon != null) {\n await unlinkIfExists(path.join(resourcesPath, oldIcon))\n }\n const iconFileName = `${appFilename}.icns`\n appPlist.CFBundleIconFile = iconFileName\n await copyFile(icon, path.join(resourcesPath, iconFileName))\n }\n appPlist.CFBundleName = appInfo.productName\n appPlist.CFBundleDisplayName = appInfo.productName\n\n const minimumSystemVersion = this.platformSpecificBuildOptions.minimumSystemVersion\n if (minimumSystemVersion != null) {\n appPlist.LSMinimumSystemVersion = minimumSystemVersion\n }\n\n appPlist.CFBundleIdentifier = appInfo.macBundleIdentifier\n\n appPlist.CFBundleShortVersionString = this.platformSpecificBuildOptions.bundleShortVersion || appInfo.version\n appPlist.CFBundleVersion = appInfo.buildVersion\n\n use(this.platformSpecificBuildOptions.category || (this.config as any).category, it => appPlist.LSApplicationCategoryType = it)\n appPlist.NSHumanReadableCopyright = appInfo.copyright\n\n if (this.platformSpecificBuildOptions.darkModeSupport) {\n appPlist.NSRequiresAquaSystemAppearance = false\n }\n\n const extendInfo = this.platformSpecificBuildOptions.extendInfo\n if (extendInfo != null) {\n Object.assign(appPlist, extendInfo)\n }\n }\n\n protected async signApp(packContext: AfterPackContext, isAsar: boolean): Promise<any> {\n const appFileName = `${this.appInfo.productFilename}.app`\n\n await BluebirdPromise.map(readdir(packContext.appOutDir), (file: string): any => {\n if (file === appFileName) {\n return this.sign(path.join(packContext.appOutDir, file), null, null, null)\n }\n return null\n })\n\n if (!isAsar) {\n return\n }\n\n const outResourcesDir = path.join(packContext.appOutDir, \"resources\", \"app.asar.unpacked\")\n await BluebirdPromise.map(orIfFileNotExist(readdir(outResourcesDir), []), (file: string): any => {\n if (file.endsWith(\".app\")) {\n return this.sign(path.join(outResourcesDir, file), null, null, null)\n }\n else {\n return null\n }\n })\n }\n}\n\nfunction getCertificateType(isMas: boolean, isDevelopment: boolean): CertType {\n if (isDevelopment) {\n return \"Mac Developer\"\n }\n return isMas ? \"3rd Party Mac Developer Application\" : \"Developer ID Application\"\n}\n"],"sourceRoot":""}
|
|
@@ -49,7 +49,7 @@ function getEffectiveOptions(options, packager) {
|
|
|
49
49
|
return {
|
|
50
50
|
isPerMachine: options.perMachine === true,
|
|
51
51
|
isAssisted: options.oneClick === false,
|
|
52
|
-
shortcutName: (0, _builderUtil().isEmptyOrSpaces)(options.shortcutName) ? appInfo.
|
|
52
|
+
shortcutName: (0, _builderUtil().isEmptyOrSpaces)(options.shortcutName) ? appInfo.sanitizedProductName : packager.expandMacro(options.shortcutName),
|
|
53
53
|
isCreateDesktopShortcut: convertToDesktopShortcutCreationPolicy(options.createDesktopShortcut),
|
|
54
54
|
isCreateStartMenuShortcut: options.createStartMenuShortcut !== false,
|
|
55
55
|
menuCategory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/options/CommonWindowsInstallerConfiguration.ts"],"names":[],"mappings":";;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAqDM,SAAU,mBAAV,CAA8B,OAA9B,EAA4E,QAA5E,EAAiG;AACrG,QAAM,OAAO,GAAG,QAAQ,CAAC,OAAzB;AAEA,MAAI,YAAY,GAAkB,IAAlC;;AACA,MAAI,OAAO,CAAC,YAAR,IAAwB,IAAxB,IAAgC,OAAO,CAAC,YAAR,KAAyB,KAA7D,EAAoE;AAClE,QAAI,OAAO,CAAC,YAAR,KAAyB,IAA7B,EAAmC;AACjC,YAAM,WAAW,GAAG,QAAQ,CAAC,OAAT,CAAiB,WAArC;;AACA,UAAI,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C,EAA+C,GAA/C,CAAmD,EAAE,IAAI,iCAAiB,EAAjB,CAAzD,EAA+E,IAA/E,CAAoF,IAApF,CAAhB;AACD;AACF;;AAED,SAAO;AACL,IAAA,YAAY,EAAE,OAAO,CAAC,UAAR,KAAuB,IADhC;AAEL,IAAA,UAAU,EAAE,OAAO,CAAC,QAAR,KAAqB,KAF5B;AAIL,IAAA,YAAY,EAAE,oCAAgB,OAAO,CAAC,YAAxB,IAAwC,OAAO,CAAC,oBAAhD,GAAuE,QAAQ,CAAC,WAAT,CAAqB,OAAO,CAAC,YAA7B,CAJhF;AAKL,IAAA,uBAAuB,EAAE,sCAAsC,CAAC,OAAO,CAAC,qBAAT,CAL1D;AAML,IAAA,yBAAyB,EAAE,OAAO,CAAC,uBAAR,KAAoC,KAN1D;AAOL,IAAA;AAPK,GAAP;AASD;;AAED,SAAS,sCAAT,CAAgD,KAAhD,EAAmF;AACjF,MAAI,KAAK,KAAK,KAAd,EAAqB;AACnB,WAAO,6BAA6B,CAAC,KAArC;AACD,GAFD,MAGK,IAAI,KAAK,KAAK,QAAd,EAAwB;AAC3B,WAAO,6BAA6B,CAAC,MAArC;AACD,GAFI,MAGA;AACH,WAAO,6BAA6B,CAAC,aAArC;AACD;AACF;;AAED,IAAY,6BAAZ;;;AAAA,CAAA,UAAY,6BAAZ,EAAyC;AACvC,EAAA,6BAAA,CAAA,6BAAA,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,GAAA,eAAA;AAAe,EAAA,6BAAA,CAAA,6BAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAA;AAAQ,EAAA,6BAAA,CAAA,6BAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAA;AACxB,CAFD,EAAY,6BAA6B,6CAA7B,6BAA6B,GAAA,EAAA,CAAzC,E","sourcesContent":["import { InvalidConfigurationError, isEmptyOrSpaces } from \"builder-util\"\nimport sanitizeFileName from \"sanitize-filename\"\nimport { WinPackager } from \"../winPackager\"\n\nexport interface CommonWindowsInstallerConfiguration {\n readonly oneClick?: boolean\n\n /**\n * Whether to install per all users (per-machine).\n * @default false\n */\n readonly perMachine?: boolean\n\n /**\n * Whether to run the installed application after finish. For assisted installer corresponding checkbox will be removed.\n * @default true\n */\n readonly runAfterFinish?: boolean\n\n /**\n * Whether to create desktop shortcut. Set to `always` if to recreate also on reinstall (even if removed by user).\n * @default true\n */\n readonly createDesktopShortcut?: boolean | \"always\"\n\n /**\n * Whether to create start menu shortcut.\n * @default true\n */\n readonly createStartMenuShortcut?: boolean\n\n /**\n * Whether to create submenu for start menu shortcut and program files directory. If `true`, company name will be used. Or string value.\n * @default false\n */\n readonly menuCategory?: boolean | string\n\n /**\n * The name that will be used for all shortcuts. Defaults to the application name.\n */\n readonly shortcutName?: string | null\n}\n\nexport interface FinalCommonWindowsInstallerOptions {\n isAssisted: boolean\n isPerMachine: boolean\n\n shortcutName: string\n menuCategory: string | null\n\n isCreateDesktopShortcut: DesktopShortcutCreationPolicy\n isCreateStartMenuShortcut: boolean\n}\n\nexport function getEffectiveOptions(options: CommonWindowsInstallerConfiguration, packager: WinPackager): FinalCommonWindowsInstallerOptions {\n const appInfo = packager.appInfo\n\n let menuCategory: string | null = null\n if (options.menuCategory != null && options.menuCategory !== false) {\n if (options.menuCategory === true) {\n const companyName = packager.appInfo.companyName\n if (companyName == null) {\n throw new InvalidConfigurationError(`Please specify \"author\" in the application package.json — it is required because \"menuCategory\" is set to true.`)\n }\n menuCategory = sanitizeFileName(companyName)\n }\n else {\n menuCategory = (options.menuCategory as string).split(/[/\\\\]/).map(it => sanitizeFileName(it)).join(\"\\\\\")\n }\n }\n\n return {\n isPerMachine: options.perMachine === true,\n isAssisted: options.oneClick === false,\n\n shortcutName: isEmptyOrSpaces(options.shortcutName) ? appInfo.sanitizedProductName : packager.expandMacro(options.shortcutName!!),\n isCreateDesktopShortcut: convertToDesktopShortcutCreationPolicy(options.createDesktopShortcut),\n isCreateStartMenuShortcut: options.createStartMenuShortcut !== false,\n menuCategory,\n }\n}\n\nfunction convertToDesktopShortcutCreationPolicy(value: boolean | undefined | string): DesktopShortcutCreationPolicy {\n if (value === false) {\n return DesktopShortcutCreationPolicy.NEVER\n }\n else if (value === \"always\") {\n return DesktopShortcutCreationPolicy.ALWAYS\n }\n else {\n return DesktopShortcutCreationPolicy.FRESH_INSTALL\n }\n}\n\nexport enum DesktopShortcutCreationPolicy {\n FRESH_INSTALL, ALWAYS, NEVER\n}"],"sourceRoot":""}
|
|
@@ -34,6 +34,10 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions {
|
|
|
34
34
|
* The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).
|
|
35
35
|
*/
|
|
36
36
|
readonly artifactName?: string | null;
|
|
37
|
+
/**
|
|
38
|
+
* The executable name. Defaults to `productName`.
|
|
39
|
+
*/
|
|
40
|
+
readonly executableName?: string | null;
|
|
37
41
|
/**
|
|
38
42
|
* The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time.
|
|
39
43
|
* @default normal
|
|
@@ -95,6 +99,7 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions {
|
|
|
95
99
|
cscLink?: string | null;
|
|
96
100
|
/** @private */
|
|
97
101
|
cscKeyPassword?: string | null;
|
|
102
|
+
readonly defaultArch?: string;
|
|
98
103
|
}
|
|
99
104
|
export interface ReleaseInfo {
|
|
100
105
|
/**
|
|
@@ -17,11 +17,6 @@ export interface LinuxConfiguration extends CommonLinuxOptions, PlatformSpecific
|
|
|
17
17
|
* The vendor. Defaults to [author](/configuration/configuration#Metadata-author).
|
|
18
18
|
*/
|
|
19
19
|
readonly vendor?: string | null;
|
|
20
|
-
/**
|
|
21
|
-
* The executable name. Defaults to `productName`.
|
|
22
|
-
* Cannot be specified per target, allowed only in the `linux`.
|
|
23
|
-
*/
|
|
24
|
-
readonly executableName?: string | null;
|
|
25
20
|
/**
|
|
26
21
|
* The path to icon set directory or one png file, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory. The icon filename must contain the size (e.g. 32x32.png) of the icon.
|
|
27
22
|
* By default will be generated automatically based on the macOS icns file.
|
package/out/packager.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare class Packager {
|
|
|
58
58
|
private readProjectMetadataIfTwoPackageStructureOrPrepacked;
|
|
59
59
|
private doBuild;
|
|
60
60
|
private createHelper;
|
|
61
|
-
|
|
61
|
+
installAppDependencies(platform: Platform, arch: Arch): Promise<any>;
|
|
62
62
|
afterPack(context: AfterPackContext): Promise<any>;
|
|
63
63
|
}
|
|
64
64
|
export interface BuildResult {
|
package/out/packager.js
CHANGED
|
@@ -360,7 +360,7 @@ class Packager {
|
|
|
360
360
|
|
|
361
361
|
try {
|
|
362
362
|
_builderUtil().log.info({
|
|
363
|
-
version: "22.10.
|
|
363
|
+
version: "22.10.5",
|
|
364
364
|
os: require("os").release()
|
|
365
365
|
}, "electron-builder");
|
|
366
366
|
} catch (e) {
|
|
@@ -639,12 +639,6 @@ class Packager {
|
|
|
639
639
|
platformToTarget.set(platform, nameToTarget);
|
|
640
640
|
|
|
641
641
|
for (const [arch, targetNames] of (0, _targetFactory().computeArchToTargetNamesMap)(archToType, packager, platform)) {
|
|
642
|
-
if (this.cancellationToken.cancelled) {
|
|
643
|
-
break;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
await this.installAppDependencies(platform, arch);
|
|
647
|
-
|
|
648
642
|
if (this.cancellationToken.cancelled) {
|
|
649
643
|
break;
|
|
650
644
|
} // support os and arch macro in output value
|