@nx/js 21.6.1-beta.0 → 21.6.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/spec/src/release/utils/semver.spec.d.ts +2 -0
- package/spec/src/release/utils/semver.spec.d.ts.map +1 -0
- package/src/release/utils/semver.d.ts +3 -0
- package/src/release/utils/semver.d.ts.map +1 -0
- package/src/release/utils/semver.js +14 -0
- package/src/release/version-actions.d.ts.map +1 -1
- package/src/release/version-actions.js +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "21.6.1-beta.
|
|
3
|
+
"version": "21.6.1-beta.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.23.2",
|
|
40
40
|
"@babel/preset-typescript": "^7.22.5",
|
|
41
41
|
"@babel/runtime": "^7.22.6",
|
|
42
|
-
"@nx/devkit": "21.6.1-beta.
|
|
43
|
-
"@nx/workspace": "21.6.1-beta.
|
|
42
|
+
"@nx/devkit": "21.6.1-beta.2",
|
|
43
|
+
"@nx/workspace": "21.6.1-beta.2",
|
|
44
44
|
"@zkochan/js-yaml": "0.0.7",
|
|
45
45
|
"babel-plugin-const-enum": "^1.0.1",
|
|
46
46
|
"babel-plugin-macros": "^3.1.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"tslib": "^2.3.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"nx": "21.6.1-beta.
|
|
66
|
+
"nx": "21.6.1-beta.2"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"verdaccio": "^6.0.5"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semver.spec.d.ts","sourceRoot":"","sources":["../../../../../../../packages/js/src/release/utils/semver.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semver.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/release/utils/semver.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,WAIzC;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAGvE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValidRange = isValidRange;
|
|
4
|
+
exports.isMatchingDependencyRange = isMatchingDependencyRange;
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
function isValidRange(range) {
|
|
7
|
+
// valid() will return null if a range (including ~,^,*) is used
|
|
8
|
+
// Check that it is null, and therefore a range
|
|
9
|
+
return !(0, semver_1.valid)(range) && (0, semver_1.validRange)(range) !== null;
|
|
10
|
+
}
|
|
11
|
+
function isMatchingDependencyRange(version, range) {
|
|
12
|
+
const coercedVersion = (0, semver_1.coerce)(version, { includePrerelease: true })?.version;
|
|
13
|
+
return isValidRange(range) && (0, semver_1.satisfies)(coercedVersion, range);
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-actions.d.ts","sourceRoot":"","sources":["../../../../../packages/js/src/release/version-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAEZ,IAAI,EAGL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"version-actions.d.ts","sourceRoot":"","sources":["../../../../../packages/js/src/release/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9
|
const update_lock_file_1 = require("./utils/update-lock-file");
|
|
10
10
|
const chalk = require("chalk");
|
|
11
|
+
const semver_1 = require("./utils/semver");
|
|
11
12
|
const afterAllProjectsVersioned = async (cwd, { rootVersionActionsOptions, ...opts }) => {
|
|
12
13
|
return {
|
|
13
14
|
changedFiles: await (0, update_lock_file_1.updateLockFile)(cwd, {
|
|
@@ -136,6 +137,13 @@ class JsVersionActions extends release_1.VersionActions {
|
|
|
136
137
|
'peerDependencies',
|
|
137
138
|
'optionalDependencies',
|
|
138
139
|
];
|
|
140
|
+
// TODO(v22): Flip this to all by default
|
|
141
|
+
const preserveMatchingDependencyRanges = this.finalConfigForProject.preserveMatchingDependencyRanges === true
|
|
142
|
+
? dependencyTypes
|
|
143
|
+
: this.finalConfigForProject.preserveMatchingDependencyRanges ===
|
|
144
|
+
false
|
|
145
|
+
? []
|
|
146
|
+
: this.finalConfigForProject.preserveMatchingDependencyRanges || [];
|
|
139
147
|
for (const depType of dependencyTypes) {
|
|
140
148
|
if (json[depType]) {
|
|
141
149
|
for (const [dep, version] of Object.entries(dependenciesToUpdate)) {
|
|
@@ -153,6 +161,18 @@ class JsVersionActions extends release_1.VersionActions {
|
|
|
153
161
|
numDependenciesToUpdate--;
|
|
154
162
|
continue;
|
|
155
163
|
}
|
|
164
|
+
else if (preserveMatchingDependencyRanges.includes(depType) &&
|
|
165
|
+
!this.isLocalDependencyProtocol(currentVersion)) {
|
|
166
|
+
// If the dependency is specified using a range, do some additional processing to determine whether to update the version
|
|
167
|
+
if ((0, semver_1.isValidRange)(currentVersion) &&
|
|
168
|
+
!(0, semver_1.isMatchingDependencyRange)(version, currentVersion)) {
|
|
169
|
+
throw new Error(`"preserveMatchingDependencyRanges" is enabled for "${depType}" and the new version "${version}" is outside the current range for "${packageName}" in manifest "${manifestToUpdate.manifestPath}". Please update the range before releasing.`);
|
|
170
|
+
}
|
|
171
|
+
else if ((0, semver_1.isValidRange)(currentVersion)) {
|
|
172
|
+
// it is a range, but it is valid
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
156
176
|
json[depType][packageName] = version;
|
|
157
177
|
}
|
|
158
178
|
}
|