1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.checkAndCleanWithSemver = void 0;
|
4 | const semver_1 = require("semver");
|
5 | function 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 | }
|
18 | exports.checkAndCleanWithSemver = checkAndCleanWithSemver;
|
19 |
|
\ | No newline at end of file |