UNPKG

@pnpm/cli-utils

Version:
30 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.packageIsInstallable = packageIsInstallable; const cli_meta_1 = require("@pnpm/cli-meta"); const logger_1 = require("@pnpm/logger"); const package_is_installable_1 = require("@pnpm/package-is-installable"); function packageIsInstallable(pkgPath, pkg, opts) { const currentPnpmVersion = cli_meta_1.packageManager.name === 'pnpm' ? cli_meta_1.packageManager.version : undefined; const err = (0, package_is_installable_1.checkPackage)(pkgPath, pkg, { nodeVersion: opts.nodeVersion, pnpmVersion: currentPnpmVersion, supportedArchitectures: opts.supportedArchitectures ?? { os: ['current'], cpu: ['current'], libc: ['current'], }, }); if (err === null) return; if ((err instanceof package_is_installable_1.UnsupportedEngineError && err.wanted.pnpm) ?? opts.engineStrict) throw err; logger_1.logger.warn({ message: `Unsupported ${err instanceof package_is_installable_1.UnsupportedEngineError ? 'engine' : 'platform'}: wanted: ${JSON.stringify(err.wanted)} (current: ${JSON.stringify(err.current)})`, prefix: pkgPath, }); } //# sourceMappingURL=packageIsInstallable.js.map