nx 19.1.0-beta.0 → 19.1.0-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/.eslintrc.json +2 -1
- package/bin/init-local.js +1 -1
- package/package.json +18 -15
- package/schemas/nx-schema.json +1 -1
- package/src/adapter/ngcli-adapter.js +6 -3
- package/src/command-line/format/format.js +47 -25
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +2 -1
- package/src/command-line/init/implementation/angular/standalone-workspace.js +0 -2
- package/src/command-line/init/implementation/react/index.js +1 -0
- package/src/command-line/migrate/migrate.js +16 -6
- package/src/command-line/release/utils/github.js +1 -1
- package/src/command-line/release/utils/shared.js +5 -3
- package/src/command-line/run/executor-utils.js +5 -0
- package/src/config/misc-interfaces.d.ts +2 -1
- package/src/config/workspace-json-project-json.d.ts +1 -0
- package/src/core/graph/main.js +1 -1
- package/src/daemon/server/server.js +1 -1
- package/src/generators/tree.d.ts +0 -1
- package/src/generators/utils/json.js +2 -1
- package/src/plugins/js/index.js +7 -2
- package/src/plugins/js/lock-file/lock-file.js +31 -1
- package/src/plugins/js/lock-file/npm-parser.js +10 -1
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -3
- 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/fileutils.d.ts +0 -1
- package/src/utils/find-matching-projects.js +1 -13
- package/src/utils/json.js +1 -1
- 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 +61 -18
- package/src/utils/plugins/plugin-capabilities.js +24 -1
package/.eslintrc.json
CHANGED
@@ -100,7 +100,8 @@
|
|
100
100
|
"events", // This is coming from @storybook/builder-manager since it uses the browser polyfill
|
101
101
|
"process", // This is coming from @storybook/builder-manager since it uses the browser polyfill
|
102
102
|
"prettier", // This is coming from @storybook/builder-manager since it uses the browser polyfill
|
103
|
-
"util" // This is coming from @storybook/builder-manager since it uses the browser polyfill
|
103
|
+
"util", // This is coming from @storybook/builder-manager since it uses the browser polyfill
|
104
|
+
"js-yaml" // The rule is failing with alias dependencies
|
104
105
|
]
|
105
106
|
}
|
106
107
|
]
|
package/bin/init-local.js
CHANGED
@@ -132,7 +132,7 @@ function handleAngularCLIFallbacks(workspace) {
|
|
132
132
|
else if (process.argv[2] === 'cache') {
|
133
133
|
console.log(`"ng cache" is not natively supported by Nx.
|
134
134
|
To clear the cache, you can delete the ".angular/cache" directory (or the directory configured by "cli.cache.path" in the "nx.json" file).
|
135
|
-
To update the cache configuration, you can directly update the relevant options in your "nx.json" file (https://angular.
|
135
|
+
To update the cache configuration, you can directly update the relevant options in your "nx.json" file (https://angular.dev/reference/configs/workspace-config#cache-options).`);
|
136
136
|
}
|
137
137
|
else {
|
138
138
|
try {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.1.0-beta.
|
3
|
+
"version": "19.1.0-beta.2",
|
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",
|
@@ -35,7 +39,6 @@
|
|
35
39
|
"dependencies": {
|
36
40
|
"@yarnpkg/lockfile": "^1.1.0",
|
37
41
|
"@yarnpkg/parsers": "3.0.0-rc.46",
|
38
|
-
"@zkochan/js-yaml": "0.0.6",
|
39
42
|
"axios": "^1.6.0",
|
40
43
|
"chalk": "^4.1.0",
|
41
44
|
"cli-cursor": "3.1.0",
|
@@ -49,7 +52,7 @@
|
|
49
52
|
"fs-extra": "^11.1.0",
|
50
53
|
"ignore": "^5.0.4",
|
51
54
|
"jest-diff": "^29.4.1",
|
52
|
-
"js-yaml": "
|
55
|
+
"js-yaml": "npm:@zkochan/js-yaml@0.0.7",
|
53
56
|
"jsonc-parser": "3.2.0",
|
54
57
|
"lines-and-columns": "~2.0.3",
|
55
58
|
"minimatch": "9.0.3",
|
@@ -66,7 +69,7 @@
|
|
66
69
|
"yargs-parser": "21.1.1",
|
67
70
|
"node-machine-id": "1.1.12",
|
68
71
|
"ora": "5.3.0",
|
69
|
-
"@nrwl/tao": "19.1.0-beta.
|
72
|
+
"@nrwl/tao": "19.1.0-beta.2"
|
70
73
|
},
|
71
74
|
"peerDependencies": {
|
72
75
|
"@swc-node/register": "^1.8.0",
|
@@ -81,16 +84,16 @@
|
|
81
84
|
}
|
82
85
|
},
|
83
86
|
"optionalDependencies": {
|
84
|
-
"@nx/nx-darwin-x64": "19.1.0-beta.
|
85
|
-
"@nx/nx-darwin-arm64": "19.1.0-beta.
|
86
|
-
"@nx/nx-linux-x64-gnu": "19.1.0-beta.
|
87
|
-
"@nx/nx-linux-x64-musl": "19.1.0-beta.
|
88
|
-
"@nx/nx-win32-x64-msvc": "19.1.0-beta.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "19.1.0-beta.
|
90
|
-
"@nx/nx-linux-arm64-musl": "19.1.0-beta.
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "19.1.0-beta.
|
92
|
-
"@nx/nx-win32-arm64-msvc": "19.1.0-beta.
|
93
|
-
"@nx/nx-freebsd-x64": "19.1.0-beta.
|
87
|
+
"@nx/nx-darwin-x64": "19.1.0-beta.2",
|
88
|
+
"@nx/nx-darwin-arm64": "19.1.0-beta.2",
|
89
|
+
"@nx/nx-linux-x64-gnu": "19.1.0-beta.2",
|
90
|
+
"@nx/nx-linux-x64-musl": "19.1.0-beta.2",
|
91
|
+
"@nx/nx-win32-x64-msvc": "19.1.0-beta.2",
|
92
|
+
"@nx/nx-linux-arm64-gnu": "19.1.0-beta.2",
|
93
|
+
"@nx/nx-linux-arm64-musl": "19.1.0-beta.2",
|
94
|
+
"@nx/nx-linux-arm-gnueabihf": "19.1.0-beta.2",
|
95
|
+
"@nx/nx-win32-arm64-msvc": "19.1.0-beta.2",
|
96
|
+
"@nx/nx-freebsd-x64": "19.1.0-beta.2"
|
94
97
|
},
|
95
98
|
"nx-migrations": {
|
96
99
|
"migrations": "./migrations.json",
|
package/schemas/nx-schema.json
CHANGED
@@ -791,12 +791,10 @@ async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, proj
|
|
791
791
|
const [packageName, builderName] = builderStr.split(':');
|
792
792
|
const { executorsFilePath, executorConfig } = this.readExecutorsJson(packageName, builderName);
|
793
793
|
const builderInfo = this.readExecutor(packageName, builderName);
|
794
|
-
const { builders, executors } = (0, fileutils_1.readJsonFile)(executorsFilePath);
|
795
794
|
return {
|
796
795
|
name: builderStr,
|
797
796
|
builderName,
|
798
|
-
description:
|
799
|
-
executors?.[builderName]?.description,
|
797
|
+
description: executorConfig.description,
|
800
798
|
optionSchema: builderInfo.schema,
|
801
799
|
import: (0, schema_utils_1.resolveImplementation)(executorConfig.implementation, (0, path_1.dirname)(executorsFilePath)),
|
802
800
|
};
|
@@ -813,6 +811,11 @@ async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, proj
|
|
813
811
|
if (!executorConfig) {
|
814
812
|
throw new Error(`Cannot find builder '${builder}' in ${executorsFilePath}.`);
|
815
813
|
}
|
814
|
+
if (typeof executorConfig === 'string') {
|
815
|
+
// Angular CLI can have a builder pointing to another package:builder
|
816
|
+
const [packageName, executorName] = executorConfig.split(':');
|
817
|
+
return this.readExecutorsJson(packageName, executorName);
|
818
|
+
}
|
816
819
|
return { executorsFilePath, executorConfig, isNgCompat: true };
|
817
820
|
}
|
818
821
|
readExecutor(nodeModule, executor) {
|
@@ -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 {
|
@@ -15,9 +15,10 @@ const connect_to_nx_cloud_1 = require("../../../connect/connect-to-nx-cloud");
|
|
15
15
|
// key is major Angular version and value is Nx version to use
|
16
16
|
const nxAngularLegacyVersionMap = {
|
17
17
|
14: '~17.0.0',
|
18
|
+
15: '~19.0.0',
|
18
19
|
};
|
19
20
|
// min major angular version supported in latest Nx
|
20
|
-
const minMajorAngularVersionSupported =
|
21
|
+
const minMajorAngularVersionSupported = 16;
|
21
22
|
// version when the Nx CLI changed from @nrwl/tao & @nrwl/cli to nx
|
22
23
|
const versionWithConsolidatedPackages = '13.9.0';
|
23
24
|
// version when packages were rescoped from @nrwl/* to @nx/*
|
@@ -98,8 +98,6 @@ function createNxJson(repoRoot, angularJson, cacheableOperations, { eslintProjec
|
|
98
98
|
inputs: ['default', '^production'],
|
99
99
|
};
|
100
100
|
}
|
101
|
-
// Angular 15 workspaces still support defaultProject. Support was removed in Angular 16.
|
102
|
-
nxJson.defaultProject = angularJson.defaultProject;
|
103
101
|
(0, fileutils_1.writeJsonFile)((0, path_1.join)(repoRoot, 'nx.json'), nxJson);
|
104
102
|
}
|
105
103
|
function updateProjectOutputs(repoRoot, project) {
|
@@ -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);
|
@@ -377,9 +377,9 @@ const LEGACY_NRWL_PACKAGE_GROUP = [
|
|
377
377
|
];
|
378
378
|
async function normalizeVersionWithTagCheck(pkg, version) {
|
379
379
|
// This doesn't seem like a valid version, lets check if its a tag on the registry.
|
380
|
-
if (version && !(0, semver_1.
|
380
|
+
if (version && !(0, semver_1.parse)(version)) {
|
381
381
|
try {
|
382
|
-
return (0, package_manager_1.
|
382
|
+
return (0, package_manager_1.resolvePackageVersionUsingRegistry)(pkg, version);
|
383
383
|
}
|
384
384
|
catch {
|
385
385
|
// fall through to old logic
|
@@ -634,6 +634,9 @@ async function getPackageMigrationsUsingInstall(packageName, packageVersion) {
|
|
634
634
|
}
|
635
635
|
result = { ...migrations, packageGroup, version: packageJson.version };
|
636
636
|
}
|
637
|
+
catch (e) {
|
638
|
+
logger_1.logger.warn(`Unable to fetch migrations for ${packageName}@${packageVersion}: ${e.message}`);
|
639
|
+
}
|
637
640
|
finally {
|
638
641
|
await cleanup();
|
639
642
|
}
|
@@ -871,7 +874,14 @@ function runInstall() {
|
|
871
874
|
(0, child_process_1.execSync)(pmCommands.install, { stdio: [0, 1, 2] });
|
872
875
|
}
|
873
876
|
async function executeMigrations(root, migrations, isVerbose, shouldCreateCommits, commitPrefix) {
|
874
|
-
|
877
|
+
let initialDeps = getStringifiedPackageJsonDeps(root);
|
878
|
+
const installDepsIfChanged = () => {
|
879
|
+
const currentDeps = getStringifiedPackageJsonDeps(root);
|
880
|
+
if (initialDeps !== currentDeps) {
|
881
|
+
runInstall();
|
882
|
+
}
|
883
|
+
initialDeps = currentDeps;
|
884
|
+
};
|
875
885
|
const migrationsWithNoChanges = [];
|
876
886
|
const sortedMigrations = migrations.sort((a, b) => {
|
877
887
|
// special case for the split configuration migration to run first
|
@@ -912,6 +922,7 @@ async function executeMigrations(root, migrations, isVerbose, shouldCreateCommit
|
|
912
922
|
loggingQueue.forEach((log) => logger_1.logger.info(' ' + log));
|
913
923
|
}
|
914
924
|
if (shouldCreateCommits) {
|
925
|
+
installDepsIfChanged();
|
915
926
|
const commitMessage = `${commitPrefix}${m.name}`;
|
916
927
|
try {
|
917
928
|
const committedSha = commitChanges(commitMessage);
|
@@ -935,9 +946,8 @@ async function executeMigrations(root, migrations, isVerbose, shouldCreateCommit
|
|
935
946
|
throw e;
|
936
947
|
}
|
937
948
|
}
|
938
|
-
|
939
|
-
|
940
|
-
runInstall();
|
949
|
+
if (!shouldCreateCommits) {
|
950
|
+
installDepsIfChanged();
|
941
951
|
}
|
942
952
|
return migrationsWithNoChanges;
|
943
953
|
}
|
@@ -223,7 +223,7 @@ async function resolveGithubToken() {
|
|
223
223
|
const ghCLIPath = (0, path_1.joinPathFragments)(process.env.XDG_CONFIG_HOME || (0, path_1.joinPathFragments)((0, node_os_1.homedir)(), '.config'), 'gh', 'hosts.yml');
|
224
224
|
if ((0, node_fs_1.existsSync)(ghCLIPath)) {
|
225
225
|
const yamlContents = await node_fs_1.promises.readFile(ghCLIPath, 'utf8');
|
226
|
-
const { load } = require('
|
226
|
+
const { load } = require('js-yaml');
|
227
227
|
const ghCLIConfig = load(yamlContents);
|
228
228
|
if (ghCLIConfig['github.com']) {
|
229
229
|
// Web based session (the token is already embedded in the config)
|
@@ -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
|
}
|
@@ -68,6 +68,11 @@ function readExecutorJson(nodeModule, executor, root, projects) {
|
|
68
68
|
if (!executorConfig) {
|
69
69
|
throw new Error(`Cannot find executor '${executor}' in ${executorsFilePath}.`);
|
70
70
|
}
|
71
|
+
if (typeof executorConfig === 'string') {
|
72
|
+
// Angular CLI can have a builder pointing to another package:builder
|
73
|
+
const [packageName, executorName] = executorConfig.split(':');
|
74
|
+
return readExecutorJson(packageName, executorName, root, projects);
|
75
|
+
}
|
71
76
|
const isNgCompat = !executorsJson.executors?.[executor];
|
72
77
|
return { executorsFilePath, executorConfig, isNgCompat };
|
73
78
|
}
|
@@ -25,13 +25,14 @@ export interface GeneratorsJsonEntry {
|
|
25
25
|
'x-use-standalone-layout'?: boolean;
|
26
26
|
}
|
27
27
|
export type OutputCaptureMethod = 'direct-nodejs' | 'pipe';
|
28
|
-
export interface
|
28
|
+
export interface ExecutorJsonEntryConfig {
|
29
29
|
schema: string;
|
30
30
|
implementation: string;
|
31
31
|
batchImplementation?: string;
|
32
32
|
description?: string;
|
33
33
|
hasher?: string;
|
34
34
|
}
|
35
|
+
export type ExecutorsJsonEntry = string | ExecutorJsonEntryConfig;
|
35
36
|
export type Dependencies = 'dependencies' | 'devDependencies';
|
36
37
|
export interface PackageJsonUpdateForPackage {
|
37
38
|
version: string;
|