nx 19.1.0-canary.20240521-1255603 → 19.1.0-canary.20240523-261b0ff
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 +17 -13
- package/schemas/nx-schema.json +1 -1
- package/src/command-line/format/format.js +47 -25
- package/src/command-line/init/implementation/react/index.js +1 -0
- package/src/command-line/migrate/migrate.js +11 -4
- package/src/command-line/release/utils/shared.js +5 -3
- package/src/config/workspace-json-project-json.d.ts +1 -0
- package/src/core/graph/main.js +1 -1
- package/src/plugins/js/index.js +7 -2
- package/src/plugins/js/lock-file/lock-file.js +31 -1
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +31 -0
- package/src/plugins/target-defaults/target-defaults-plugin.js +9 -0
- package/src/utils/ab-testing.js +5 -0
- package/src/utils/package-json.d.ts +1 -1
- package/src/utils/package-json.js +8 -2
- package/src/utils/package-manager.d.ts +3 -3
- package/src/utils/package-manager.js +47 -13
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.1.0-canary.
|
3
|
+
"version": "19.1.0-canary.20240523-261b0ff",
|
4
4
|
"private": false,
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
6
6
|
"repository": {
|
@@ -20,7 +20,11 @@
|
|
20
20
|
"Nest",
|
21
21
|
"Jest",
|
22
22
|
"Cypress",
|
23
|
-
"CLI"
|
23
|
+
"CLI",
|
24
|
+
"Testing",
|
25
|
+
"Front-end",
|
26
|
+
"Backend",
|
27
|
+
"Mobile"
|
24
28
|
],
|
25
29
|
"bin": {
|
26
30
|
"nx": "./bin/nx.js",
|
@@ -65,7 +69,7 @@
|
|
65
69
|
"yargs-parser": "21.1.1",
|
66
70
|
"node-machine-id": "1.1.12",
|
67
71
|
"ora": "5.3.0",
|
68
|
-
"@nrwl/tao": "19.1.0-canary.
|
72
|
+
"@nrwl/tao": "19.1.0-canary.20240523-261b0ff"
|
69
73
|
},
|
70
74
|
"peerDependencies": {
|
71
75
|
"@swc-node/register": "^1.8.0",
|
@@ -80,16 +84,16 @@
|
|
80
84
|
}
|
81
85
|
},
|
82
86
|
"optionalDependencies": {
|
83
|
-
"@nx/nx-darwin-x64": "19.1.0-canary.
|
84
|
-
"@nx/nx-darwin-arm64": "19.1.0-canary.
|
85
|
-
"@nx/nx-linux-x64-gnu": "19.1.0-canary.
|
86
|
-
"@nx/nx-linux-x64-musl": "19.1.0-canary.
|
87
|
-
"@nx/nx-win32-x64-msvc": "19.1.0-canary.
|
88
|
-
"@nx/nx-linux-arm64-gnu": "19.1.0-canary.
|
89
|
-
"@nx/nx-linux-arm64-musl": "19.1.0-canary.
|
90
|
-
"@nx/nx-linux-arm-gnueabihf": "19.1.0-canary.
|
91
|
-
"@nx/nx-win32-arm64-msvc": "19.1.0-canary.
|
92
|
-
"@nx/nx-freebsd-x64": "19.1.0-canary.
|
87
|
+
"@nx/nx-darwin-x64": "19.1.0-canary.20240523-261b0ff",
|
88
|
+
"@nx/nx-darwin-arm64": "19.1.0-canary.20240523-261b0ff",
|
89
|
+
"@nx/nx-linux-x64-gnu": "19.1.0-canary.20240523-261b0ff",
|
90
|
+
"@nx/nx-linux-x64-musl": "19.1.0-canary.20240523-261b0ff",
|
91
|
+
"@nx/nx-win32-x64-msvc": "19.1.0-canary.20240523-261b0ff",
|
92
|
+
"@nx/nx-linux-arm64-gnu": "19.1.0-canary.20240523-261b0ff",
|
93
|
+
"@nx/nx-linux-arm64-musl": "19.1.0-canary.20240523-261b0ff",
|
94
|
+
"@nx/nx-linux-arm-gnueabihf": "19.1.0-canary.20240523-261b0ff",
|
95
|
+
"@nx/nx-win32-arm64-msvc": "19.1.0-canary.20240523-261b0ff",
|
96
|
+
"@nx/nx-freebsd-x64": "19.1.0-canary.20240523-261b0ff"
|
93
97
|
},
|
94
98
|
"nx-migrations": {
|
95
99
|
"migrations": "./migrations.json",
|
package/schemas/nx-schema.json
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.format = void 0;
|
4
|
-
const
|
5
|
-
const path = require("path");
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
5
|
+
const path = require("node:path");
|
6
|
+
const file_utils_1 = require("../../project-graph/file-utils");
|
6
7
|
const command_line_utils_1 = require("../../utils/command-line-utils");
|
7
|
-
const ignore_1 = require("../../utils/ignore");
|
8
8
|
const fileutils_1 = require("../../utils/fileutils");
|
9
|
-
const
|
9
|
+
const ignore_1 = require("../../utils/ignore");
|
10
10
|
const prettier = require("prettier");
|
11
|
-
const
|
12
|
-
const package_json_1 = require("../../utils/package-json");
|
11
|
+
const configuration_1 = require("../../config/configuration");
|
13
12
|
const typescript_1 = require("../../plugins/js/utils/typescript");
|
14
|
-
const project_graph_1 = require("../../project-graph/project-graph");
|
15
13
|
const affected_project_graph_1 = require("../../project-graph/affected/affected-project-graph");
|
16
|
-
const
|
17
|
-
const chunkify_1 = require("../../utils/chunkify");
|
14
|
+
const project_graph_1 = require("../../project-graph/project-graph");
|
18
15
|
const all_file_data_1 = require("../../utils/all-file-data");
|
19
|
-
const
|
16
|
+
const chunkify_1 = require("../../utils/chunkify");
|
17
|
+
const object_sort_1 = require("../../utils/object-sort");
|
20
18
|
const output_1 = require("../../utils/output");
|
19
|
+
const package_json_1 = require("../../utils/package-json");
|
20
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
21
21
|
const PRETTIER_PATH = getPrettierPath();
|
22
22
|
async function format(command, args) {
|
23
23
|
const { nxArgs } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', { printWarnings: false }, (0, configuration_1.readNxJson)());
|
@@ -33,12 +33,31 @@ async function format(command, args) {
|
|
33
33
|
addRootConfigFiles(chunkList, nxArgs);
|
34
34
|
chunkList.forEach((chunk) => write(chunk));
|
35
35
|
break;
|
36
|
-
case 'check':
|
37
|
-
const
|
38
|
-
|
36
|
+
case 'check': {
|
37
|
+
const filesWithDifferentFormatting = [];
|
38
|
+
for (const chunk of chunkList) {
|
39
|
+
const files = await check(chunk);
|
40
|
+
filesWithDifferentFormatting.push(...files);
|
41
|
+
}
|
42
|
+
if (filesWithDifferentFormatting.length > 0) {
|
43
|
+
if (nxArgs.verbose) {
|
44
|
+
output_1.output.error({
|
45
|
+
title: 'The following files are not formatted correctly based on your Prettier configuration',
|
46
|
+
bodyLines: [
|
47
|
+
'- Run "nx format:write" and commit the resulting diff to fix these files.',
|
48
|
+
'- Please note, Prettier does not support a native way to diff the output of its check logic (https://github.com/prettier/prettier/issues/6885).',
|
49
|
+
'',
|
50
|
+
...filesWithDifferentFormatting,
|
51
|
+
],
|
52
|
+
});
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
console.log(filesWithDifferentFormatting.join('\n'));
|
56
|
+
}
|
39
57
|
process.exit(1);
|
40
58
|
}
|
41
59
|
break;
|
60
|
+
}
|
42
61
|
}
|
43
62
|
}
|
44
63
|
exports.format = format;
|
@@ -113,29 +132,32 @@ function write(patterns) {
|
|
113
132
|
result[pattern.includes('.swcrc') ? 0 : 1].push(pattern);
|
114
133
|
return result;
|
115
134
|
}, [[], []]);
|
116
|
-
(0,
|
135
|
+
(0, node_child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${regularPatterns.join(' ')}`, {
|
117
136
|
stdio: [0, 1, 2],
|
118
137
|
});
|
119
138
|
if (swcrcPatterns.length > 0) {
|
120
|
-
(0,
|
139
|
+
(0, node_child_process_1.execSync)(`node "${PRETTIER_PATH}" --write --list-different ${swcrcPatterns.join(' ')} --parser json`, {
|
121
140
|
stdio: [0, 1, 2],
|
122
141
|
});
|
123
142
|
}
|
124
143
|
}
|
125
144
|
}
|
126
|
-
function check(patterns) {
|
145
|
+
async function check(patterns) {
|
127
146
|
if (patterns.length === 0) {
|
128
|
-
return
|
147
|
+
return [];
|
129
148
|
}
|
130
|
-
|
131
|
-
(0,
|
132
|
-
|
149
|
+
return new Promise((resolve) => {
|
150
|
+
(0, node_child_process_1.exec)(`node "${PRETTIER_PATH}" --list-different ${patterns.join(' ')}`, { encoding: 'utf-8' }, (error, stdout) => {
|
151
|
+
if (error) {
|
152
|
+
// The command failed so there are files with different formatting. Prettier writes them to stdout, newline separated.
|
153
|
+
resolve(stdout.trim().split('\n'));
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
// The command succeeded so there are no files with different formatting
|
157
|
+
resolve([]);
|
158
|
+
}
|
133
159
|
});
|
134
|
-
|
135
|
-
}
|
136
|
-
catch {
|
137
|
-
return false;
|
138
|
-
}
|
160
|
+
});
|
139
161
|
}
|
140
162
|
function sortTsConfig() {
|
141
163
|
try {
|
@@ -155,6 +155,7 @@ function moveFilesToTempWorkspace(options) {
|
|
155
155
|
options.packageManager === 'yarn' ? 'yarn.lock' : null,
|
156
156
|
options.packageManager === 'pnpm' ? 'pnpm-lock.yaml' : null,
|
157
157
|
options.packageManager === 'npm' ? 'package-lock.json' : null,
|
158
|
+
options.packageManager === 'bun' ? 'bun.lockb' : null,
|
158
159
|
];
|
159
160
|
const optionalCraFiles = ['README.md'];
|
160
161
|
const filesToMove = [...requiredCraFiles, ...optionalCraFiles].filter(Boolean);
|
@@ -874,7 +874,14 @@ function runInstall() {
|
|
874
874
|
(0, child_process_1.execSync)(pmCommands.install, { stdio: [0, 1, 2] });
|
875
875
|
}
|
876
876
|
async function executeMigrations(root, migrations, isVerbose, shouldCreateCommits, commitPrefix) {
|
877
|
-
|
877
|
+
let initialDeps = getStringifiedPackageJsonDeps(root);
|
878
|
+
const installDepsIfChanged = () => {
|
879
|
+
const currentDeps = getStringifiedPackageJsonDeps(root);
|
880
|
+
if (initialDeps !== currentDeps) {
|
881
|
+
runInstall();
|
882
|
+
}
|
883
|
+
initialDeps = currentDeps;
|
884
|
+
};
|
878
885
|
const migrationsWithNoChanges = [];
|
879
886
|
const sortedMigrations = migrations.sort((a, b) => {
|
880
887
|
// special case for the split configuration migration to run first
|
@@ -915,6 +922,7 @@ async function executeMigrations(root, migrations, isVerbose, shouldCreateCommit
|
|
915
922
|
loggingQueue.forEach((log) => logger_1.logger.info(' ' + log));
|
916
923
|
}
|
917
924
|
if (shouldCreateCommits) {
|
925
|
+
installDepsIfChanged();
|
918
926
|
const commitMessage = `${commitPrefix}${m.name}`;
|
919
927
|
try {
|
920
928
|
const committedSha = commitChanges(commitMessage);
|
@@ -938,9 +946,8 @@ async function executeMigrations(root, migrations, isVerbose, shouldCreateCommit
|
|
938
946
|
throw e;
|
939
947
|
}
|
940
948
|
}
|
941
|
-
|
942
|
-
|
943
|
-
runInstall();
|
949
|
+
if (!shouldCreateCommits) {
|
950
|
+
installDepsIfChanged();
|
944
951
|
}
|
945
952
|
return migrationsWithNoChanges;
|
946
953
|
}
|
@@ -162,9 +162,11 @@ function createGitTagValues(releaseGroups, releaseGroupToFilteredProjects, versi
|
|
162
162
|
}
|
163
163
|
// For fixed groups we want one tag for the overall group
|
164
164
|
const projectVersionData = versionData[releaseGroupProjectNames[0]]; // all at the same version, so we can just pick the first one
|
165
|
-
|
166
|
-
|
167
|
-
|
165
|
+
if (projectVersionData.newVersion !== null) {
|
166
|
+
tags.push((0, utils_1.interpolate)(releaseGroup.releaseTagPattern, {
|
167
|
+
version: projectVersionData.newVersion,
|
168
|
+
}));
|
169
|
+
}
|
168
170
|
}
|
169
171
|
return tags;
|
170
172
|
}
|