UNPKG

720 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.checkAndCleanWithSemver = void 0;
4const semver_1 = require("semver");
5function checkAndCleanWithSemver(pkgName, version) {
6 let newVersion = version;
7 if ((0, semver_1.valid)(newVersion)) {
8 return newVersion;
9 }
10 if (version.startsWith('~') || version.startsWith('^')) {
11 newVersion = version.substring(1);
12 }
13 if (!(0, semver_1.valid)(newVersion)) {
14 throw new Error(`The package.json lists a version of ${pkgName} that Nx is unable to validate - (${version})`);
15 }
16 return newVersion;
17}
18exports.checkAndCleanWithSemver = checkAndCleanWithSemver;
19//# sourceMappingURL=version-utils.js.map
\No newline at end of file