UNPKG

@jasonscheirer/electron-forge-maker-msix

Version:

An `electron-forge` maker for MSIX that supports `electron-forge` v6 and can be used as a replacement for `electron-builder`. Supports code-signing.

50 lines 2.09 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.codesign = void 0; const windows_sign_1 = require("@electron/windows-sign"); const fs_extra_1 = __importDefault(require("fs-extra")); const run_1 = require("./run"); const codesign = async (config, outPath) => { if (config.codesign) { try { if ((await fs_extra_1.default.stat(outPath)).isDirectory()) { (0, run_1.log)(`Signing directory ${outPath}`); await (0, windows_sign_1.sign)({ ...config.codesign, appDirectory: outPath, hashes: ['sha256'], }); } else { (0, run_1.log)(`Signing file ${outPath}`); await (0, windows_sign_1.sign)({ ...config.codesign, files: [outPath], hashes: ['sha256'], }); } } catch (error) { console.error('Failed to codesign using @electron/windows-sign. Check your config and the output for details!', error); throw error; } // Setup signing. If these variables are set, app-builder-lib will actually // codesign. if (!process.env.CSC_LINK && config.codesign.certificateFile) { (0, run_1.log)(`Setting process.env.CSC_LINK to ${config.codesign.certificateFile}`); process.env.CSC_LINK = config.codesign.certificateFile; } if (!process.env.CSC_KEY_PASSWORD && config.codesign.certificatePassword) { (0, run_1.log)('Setting process.env.CSC_KEY_PASSWORD to the passed password'); process.env.CSC_KEY_PASSWORD = config.codesign.certificatePassword; } } else { (0, run_1.log)("Skipping code signing, if you need it set 'config.codesign'"); } }; exports.codesign = codesign; //# sourceMappingURL=sign.js.map