UNPKG

@interopio/desktop-cli

Version:

CLI tool for setting up, building and packaging io.Connect Desktop projects

91 lines 4.29 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MakerSquirrel = void 0; const node_path_1 = __importStar(require("node:path")); const maker_base_1 = require("@electron-forge/maker-base"); const electron_winstaller_1 = require("electron-winstaller"); const fs_extra_1 = __importDefault(require("fs-extra")); const path_1 = require("../../../utils/path"); class MakerSquirrel extends maker_base_1.MakerBase { name = 'squirrel'; defaultPlatforms = ['win32']; isSupportedOnCurrentPlatform() { return this.isInstalled('electron-winstaller') && !process.env["DISABLE_SQUIRREL_TEST"]; } async make({ dir, makeDir, targetArch, packageJSON, appName, forgeConfig, }) { console.log('Using custom squirrel maker'); const outPath = node_path_1.default.resolve(makeDir, `squirrel.windows/${targetArch}`); await this.ensureDirectory(outPath); const winstallerConfig = { name: typeof packageJSON.name === 'string' ? packageJSON.name.replace(/-/g, '_') : undefined, // squirrel hates hyphens title: appName, noMsi: true, exe: `${forgeConfig.packagerConfig.executableName || appName}.exe`, setupExe: `${appName}-${packageJSON.version} Setup.exe`, ...this.config, appDirectory: dir, outputDirectory: outPath, usePackageJson: false, nuspecTemplate: (0, node_path_1.join)(path_1.PathUtils.getConfigDir(), "win-build", "template.nuspectemplate") }; await (0, electron_winstaller_1.createWindowsInstaller)(winstallerConfig); const nupkgVersion = (0, electron_winstaller_1.convertVersion)(packageJSON.version); const artifacts = [ node_path_1.default.resolve(outPath, 'RELEASES'), node_path_1.default.resolve(outPath, winstallerConfig.setupExe || `${appName}Setup.exe`), node_path_1.default.resolve(outPath, `${winstallerConfig.name}-${nupkgVersion}-full.nupkg`), ]; const deltaPath = node_path_1.default.resolve(outPath, `${winstallerConfig.name}-${nupkgVersion}-delta.nupkg`); if (winstallerConfig.remoteReleases && !winstallerConfig.noDelta && (await fs_extra_1.default.pathExists(deltaPath))) { artifacts.push(deltaPath); } const msiPath = node_path_1.default.resolve(outPath, winstallerConfig.setupMsi || `${appName}Setup.msi`); if (!winstallerConfig.noMsi && (await fs_extra_1.default.pathExists(msiPath))) { artifacts.push(msiPath); } return artifacts; } } exports.default = MakerSquirrel; exports.MakerSquirrel = MakerSquirrel; //# sourceMappingURL=custom.squirrel.maker.js.map