UNPKG

piral-cli

Version:

The standard CLI for creating and building a Piral instance or a Pilet.

36 lines 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; const common_1 = require("../common"); /** * Checks if the used Piral instance is used at its latest version. */ async function default_1(context, options = 'suggest') { if (options !== 'ignore') { const { name, version } = context.apps[0].appPackage; const demanded = (context.devDependencies && context.devDependencies[name]) || ''; const isfixed = demanded.startsWith('git+') || demanded.startsWith('file:'); if (!isfixed) { const npmClient = await (0, common_1.determineNpmClient)(context.root); const isMonorepoRef = await (0, common_1.isMonorepoPackageRef)(name, npmClient); // either we are not in a monorepo or the app shell is not part of the monorepo if (!isMonorepoRef) { const latestVersion = await (0, common_1.findLatestVersion)(name).catch((err) => { context.warning(` The used version of "${name}" could not be determined: ${err}. `); return version; }); if (version !== latestVersion) { const notify = options === 'required' ? context.error : context.warning; notify(` The used version of "${name}" is outdated. Expected: v${latestVersion}. Received: v${version}. `); } } } } } //# sourceMappingURL=pilet-uses-latest-piral.js.map