UNPKG

@pact-foundation/pact-cli

Version:
42 lines 1.87 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBinaryEntry = exports.createConfig = exports.PACT_STANDALONE_VERSION = void 0; const chalk_1 = __importDefault(require("chalk")); exports.PACT_STANDALONE_VERSION = '2.5.2'; function makeError(msg) { return new Error(chalk_1.default.red(`Error while locating pact binary: ${msg}`)); } function createConfig() { return { binaries: [ ['win32', 'x64', 'windows', 'x64', 'zip'], ['darwin', 'arm64', 'osx', 'arm64', 'tar.gz'], ['darwin', 'x64', 'osx', 'x86_64', 'tar.gz'], ['linux', 'arm64', 'linux', 'arm64', 'tar.gz'], ['linux', 'x64', 'linux', 'x64', 'tar.gz'], ].map(([platform, arch, downloadPlatform, downloadArch, extension]) => { const binary = `pact-${exports.PACT_STANDALONE_VERSION}-${downloadPlatform}-${downloadArch}.${extension}`; return { platform, arch, binary, binaryChecksum: `${binary}.checksum`, folderName: `${platform === 'win32' ? 'windows' : platform}-${arch}-${exports.PACT_STANDALONE_VERSION}`, }; }), }; } exports.createConfig = createConfig; const CONFIG = createConfig(); function getBinaryEntry(platform = process.platform, arch = process.arch) { const found = CONFIG.binaries.find((value) => value.platform === platform && (value.arch ? value.arch === arch : true)); if (found === undefined) { throw makeError(`Cannot find binary for platform '${platform}' with architecture '${arch}'.`); } return found; } exports.getBinaryEntry = getBinaryEntry; //# sourceMappingURL=install.js.map