UNPKG

electron-builder

Version:

A complete solution to package and build a ready for distribution Electron app for MacOS, Windows and Linux with “auto update” support out of the box

65 lines (52 loc) 2.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PkgTarget = undefined; var _bluebirdLstC; function _load_bluebirdLstC() { return _bluebirdLstC = require("bluebird-lst-c"); } exports.prepareProductBuildArgs = prepareProductBuildArgs; var _util; function _load_util() { return _util = require("../util/util"); } var _platformPackager; function _load_platformPackager() { return _platformPackager = require("../platformPackager"); } var _path; function _load_path() { return _path = _interopRequireWildcard(require("path")); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } class PkgTarget extends (_platformPackager || _load_platformPackager()).TargetEx { constructor(packager) { super("pkg"); this.packager = packager; } build(appOutDir, arch) { var _this = this; return (0, (_bluebirdLstC || _load_bluebirdLstC()).coroutine)(function* () { const packager = _this.packager; const appInfo = packager.appInfo; const outFile = (_path || _load_path()).join(appOutDir, `${ appInfo.productFilename }-${ appInfo.version }.pkg`); const keychainName = (yield packager.codeSigningInfo).keychainName; const args = prepareProductBuildArgs((_path || _load_path()).join(appOutDir, `${ appInfo.productFilename }.app`), (yield packager.findInstallerIdentity(false, keychainName)), keychainName); args.push("--version", appInfo.buildVersion); args.push(outFile); yield (0, (_util || _load_util()).exec)("productbuild", args); packager.dispatchArtifactCreated(outFile, `${ appInfo.name }-${ appInfo.version }.pkg`); })(); } } exports.PkgTarget = PkgTarget; function prepareProductBuildArgs(appPath, identity, keychain) { const args = ["--component", appPath, "/Applications", "--sign", identity]; if (keychain != null) { args.push("--keychain", keychain); } return args; } //# sourceMappingURL=pkg.js.map