78 lines
8.2 KiB
JavaScript
78 lines
8.2 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
|
|
require("source-map-support/register");
|
|
|
|
var _makerBase = _interopRequireDefault(require("@electron-forge/maker-base"));
|
|
|
|
var _electronWinstaller = require("electron-winstaller");
|
|
|
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
|
|
var _path = _interopRequireDefault(require("path"));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
class MakerSquirrel extends _makerBase.default {
|
|
constructor(...args) {
|
|
super(...args);
|
|
|
|
_defineProperty(this, "name", 'squirrel');
|
|
|
|
_defineProperty(this, "defaultPlatforms", ['win32']);
|
|
}
|
|
|
|
isSupportedOnCurrentPlatform() {
|
|
return this.isInstalled('electron-winstaller') && !process.env.DISABLE_SQUIRREL_TEST;
|
|
}
|
|
|
|
async make({
|
|
dir,
|
|
makeDir,
|
|
targetArch,
|
|
packageJSON,
|
|
appName,
|
|
forgeConfig
|
|
}) {
|
|
const outPath = _path.default.resolve(makeDir, `squirrel.windows/${targetArch}`);
|
|
|
|
await this.ensureDirectory(outPath);
|
|
const winstallerConfig = {
|
|
name: packageJSON.name,
|
|
title: appName,
|
|
noMsi: true,
|
|
exe: `${forgeConfig.packagerConfig.executableName || appName}.exe`,
|
|
setupExe: `${appName}-${packageJSON.version} Setup.exe`,
|
|
...this.config,
|
|
appDirectory: dir,
|
|
outputDirectory: outPath
|
|
};
|
|
await (0, _electronWinstaller.createWindowsInstaller)(winstallerConfig);
|
|
const nupkgVersion = (0, _electronWinstaller.convertVersion)(packageJSON.version);
|
|
const artifacts = [_path.default.resolve(outPath, 'RELEASES'), _path.default.resolve(outPath, winstallerConfig.setupExe || `${appName}Setup.exe`), _path.default.resolve(outPath, `${winstallerConfig.name}-${nupkgVersion}-full.nupkg`)];
|
|
|
|
const deltaPath = _path.default.resolve(outPath, `${winstallerConfig.name}-${nupkgVersion}-delta.nupkg`);
|
|
|
|
if (winstallerConfig.remoteReleases || (await _fsExtra.default.pathExists(deltaPath))) {
|
|
artifacts.push(deltaPath);
|
|
}
|
|
|
|
const msiPath = _path.default.resolve(outPath, winstallerConfig.setupMsi || `${appName}Setup.msi`);
|
|
|
|
if (!winstallerConfig.noMsi && (await _fsExtra.default.pathExists(msiPath))) {
|
|
artifacts.push(msiPath);
|
|
}
|
|
|
|
return artifacts;
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = MakerSquirrel;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9NYWtlclNxdWlycmVsLnRzIl0sIm5hbWVzIjpbIk1ha2VyU3F1aXJyZWwiLCJNYWtlckJhc2UiLCJpc1N1cHBvcnRlZE9uQ3VycmVudFBsYXRmb3JtIiwiaXNJbnN0YWxsZWQiLCJwcm9jZXNzIiwiZW52IiwiRElTQUJMRV9TUVVJUlJFTF9URVNUIiwibWFrZSIsImRpciIsIm1ha2VEaXIiLCJ0YXJnZXRBcmNoIiwicGFja2FnZUpTT04iLCJhcHBOYW1lIiwiZm9yZ2VDb25maWciLCJvdXRQYXRoIiwicGF0aCIsInJlc29sdmUiLCJlbnN1cmVEaXJlY3RvcnkiLCJ3aW5zdGFsbGVyQ29uZmlnIiwibmFtZSIsInRpdGxlIiwibm9Nc2kiLCJleGUiLCJwYWNrYWdlckNvbmZpZyIsImV4ZWN1dGFibGVOYW1lIiwic2V0dXBFeGUiLCJ2ZXJzaW9uIiwiY29uZmlnIiwiYXBwRGlyZWN0b3J5Iiwib3V0cHV0RGlyZWN0b3J5IiwibnVwa2dWZXJzaW9uIiwiYXJ0aWZhY3RzIiwiZGVsdGFQYX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