nx 19.1.0-canary.20240516-d581cef → 19.1.0-canary.20240518-3523720
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 +12 -12
- package/src/command-line/migrate/migrate.js +5 -2
- package/src/core/graph/main.js +1 -1
- package/src/daemon/server/server.js +1 -1
- package/src/generators/utils/json.js +2 -1
- package/src/utils/find-matching-projects.js +1 -13
- package/src/utils/json.js +1 -1
- package/src/utils/package-manager.js +14 -5
@@ -198,7 +198,7 @@ const handleWorkspaceChanges = async (err, changeEvents) => {
|
|
198
198
|
});
|
199
199
|
return;
|
200
200
|
}
|
201
|
-
if (err
|
201
|
+
if (err) {
|
202
202
|
let error = typeof err === 'string' ? new Error(err) : err;
|
203
203
|
logger_1.serverLogger.watcherLog('Unexpected workspace watcher error', error.message);
|
204
204
|
console.error(error);
|
@@ -30,7 +30,8 @@ exports.readJson = readJson;
|
|
30
30
|
* @param options Optional JSON Serialize Options
|
31
31
|
*/
|
32
32
|
function writeJson(tree, path, value, options) {
|
33
|
-
|
33
|
+
const serialized = (0, json_1.serializeJson)(value, options);
|
34
|
+
tree.write(path, `${serialized}\n`);
|
34
35
|
}
|
35
36
|
exports.writeJson = writeJson;
|
36
37
|
/**
|
@@ -22,15 +22,6 @@ function findMatchingProjects(patterns = [], projects) {
|
|
22
22
|
}
|
23
23
|
const projectNames = Object.keys(projects);
|
24
24
|
const matchedProjects = new Set();
|
25
|
-
// If the first pattern is an exclude pattern,
|
26
|
-
// we add a wildcard pattern at the first to select
|
27
|
-
// all projects, except the ones that match the exclude pattern.
|
28
|
-
// e.g. ['!tag:someTag', 'project2'] will match all projects except
|
29
|
-
// the ones with the tag 'someTag', and also match the project 'project2',
|
30
|
-
// regardless of its tags.
|
31
|
-
if (isExcludePattern(patterns[0])) {
|
32
|
-
patterns.unshift('*');
|
33
|
-
}
|
34
25
|
for (const stringPattern of patterns) {
|
35
26
|
if (!stringPattern.length) {
|
36
27
|
continue;
|
@@ -148,11 +139,8 @@ function addMatchingProjectsByTag(projectNames, projects, pattern, matchedProjec
|
|
148
139
|
}
|
149
140
|
}
|
150
141
|
}
|
151
|
-
function isExcludePattern(pattern) {
|
152
|
-
return pattern.startsWith('!');
|
153
|
-
}
|
154
142
|
function parseStringPattern(pattern, projects) {
|
155
|
-
const isExclude =
|
143
|
+
const isExclude = pattern.startsWith('!');
|
156
144
|
// Support for things like: `!{type}:value`
|
157
145
|
if (isExclude) {
|
158
146
|
pattern = pattern.substring(1);
|
package/src/utils/json.js
CHANGED
@@ -57,6 +57,6 @@ function formatParseError(input, parseError) {
|
|
57
57
|
* @returns the formatted JSON representation of the object
|
58
58
|
*/
|
59
59
|
function serializeJson(input, options) {
|
60
|
-
return JSON.stringify(input, null, options?.spaces ?? 2)
|
60
|
+
return JSON.stringify(input, null, options?.spaces ?? 2);
|
61
61
|
}
|
62
62
|
exports.serializeJson = serializeJson;
|
@@ -254,11 +254,20 @@ async function resolvePackageVersionUsingRegistry(packageName, version) {
|
|
254
254
|
if (!result) {
|
255
255
|
throw new Error(`Unable to resolve version ${packageName}@${version}.`);
|
256
256
|
}
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
257
|
+
const lines = result.split('\n');
|
258
|
+
if (lines.length === 1) {
|
259
|
+
return lines[0];
|
260
|
+
}
|
261
|
+
/**
|
262
|
+
* The output contains multiple lines ordered by release date, so the last
|
263
|
+
* version might not be the last one in the list. We need to sort it. Each
|
264
|
+
* line looks like:
|
265
|
+
*
|
266
|
+
* <package>@<version> '<version>'
|
267
|
+
*/
|
268
|
+
const resolvedVersion = lines
|
269
|
+
.map((line) => line.split(' ')[1])
|
270
|
+
.sort()
|
262
271
|
.pop()
|
263
272
|
.replace(/'/g, '');
|
264
273
|
return resolvedVersion;
|