nx 24.1.0-beta.0 → 24.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/dist/bin/init-local.js +2 -4
- package/dist/bin/nx-cloud.js +2 -1
- package/dist/bin/nx.js +12 -14
- package/dist/bin/run-executor.js +5 -0
- package/dist/src/adapter/compat.d.ts +1 -1
- package/dist/src/adapter/compat.js +1 -0
- package/dist/src/command-line/completion/scripts/bash.sh +9 -2
- package/dist/src/command-line/completion/scripts/fish.fish +10 -2
- package/dist/src/command-line/completion/scripts/zsh.zsh +8 -2
- package/dist/src/command-line/completion/scripts.js +18 -8
- package/dist/src/command-line/conformance/command-object.d.ts +3 -0
- package/dist/src/command-line/conformance/command-object.js +66 -0
- package/dist/src/command-line/generate/generate.js +2 -4
- package/dist/src/command-line/generate/generator-utils.d.ts +1 -0
- package/dist/src/command-line/generate/generator-utils.js +9 -0
- package/dist/src/command-line/import/import.js +26 -2
- package/dist/src/command-line/import/utils/ai-output.d.ts +9 -1
- package/dist/src/command-line/import/utils/ai-output.js +20 -1
- package/dist/src/command-line/nx-commands.d.ts +1 -1
- package/dist/src/command-line/nx-commands.js +82 -132
- package/dist/src/command-line/release/command-object.d.ts +1 -0
- package/dist/src/command-line/release/command-object.js +4 -0
- package/dist/src/command-line/release/release.js +6 -4
- package/dist/src/command-line/release/utils/repository-git-tags.js +3 -3
- package/dist/src/command-line/release/utils/resolve-nx-json-error-message.js +2 -24
- package/dist/src/command-line/report/report.js +1 -1
- package/dist/src/command-line/reset/reset.js +51 -2
- package/dist/src/config/nx-json.d.ts +117 -0
- package/dist/src/config/workspace-json-project-json.d.ts +6 -7
- package/dist/src/daemon/client/daemon-environment.js +15 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +13 -20
- package/dist/src/devkit-exports.d.ts +1 -1
- package/dist/src/devkit-internals.d.ts +14 -7
- package/dist/src/devkit-internals.js +29 -4
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +1 -1
- package/dist/src/executors/run-commands/run-commands.impl.js +35 -13
- package/dist/src/generators/utils/glob.js +3 -3
- package/dist/src/hasher/hash-task.d.ts +3 -1
- package/dist/src/hasher/hash-task.js +3 -2
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.d.ts +4 -0
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.js +117 -0
- package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.md +38 -0
- package/dist/src/native/index.d.ts +6 -8
- package/dist/src/native/index.js +18 -0
- package/dist/src/native/native-bindings.js +1 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/native/transform-objects.d.ts +2 -0
- package/dist/src/native/transform-objects.js +15 -0
- package/dist/src/plugins/js/index.js +24 -9
- package/dist/src/plugins/js/lock-file/bun-parser.d.ts +75 -4
- package/dist/src/plugins/js/lock-file/bun-parser.js +976 -142
- package/dist/src/plugins/js/lock-file/lock-file-names.d.ts +6 -0
- package/dist/src/plugins/js/lock-file/lock-file-names.js +16 -0
- package/dist/src/plugins/js/lock-file/lock-file.d.ts +33 -14
- package/dist/src/plugins/js/lock-file/lock-file.js +213 -74
- package/dist/src/plugins/js/lock-file/npm-parser.d.ts +1 -0
- package/dist/src/plugins/js/lock-file/npm-parser.js +66 -2
- package/dist/src/plugins/js/lock-file/pnpm-parser.d.ts +5 -1
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +107 -54
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +52 -10
- package/dist/src/plugins/js/lock-file/pruned-output.js +132 -66
- package/dist/src/plugins/js/lock-file/utils/local-path-hashes.d.ts +27 -0
- package/dist/src/plugins/js/lock-file/utils/local-path-hashes.js +155 -0
- package/dist/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
- package/dist/src/plugins/js/lock-file/utils/package-json.js +2 -1
- package/dist/src/plugins/js/package-json/create-package-json.d.ts +1 -0
- package/dist/src/plugins/js/package-json/create-package-json.js +197 -8
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +50 -2
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.d.ts +1 -1
- package/dist/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +2 -2
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +16 -9
- package/dist/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +17 -28
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +52 -1
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +336 -28
- package/dist/src/plugins/js/utils/register.js +13 -6
- package/dist/src/project-graph/build-project-graph.js +5 -2
- package/dist/src/project-graph/error-types.d.ts +2 -2
- package/dist/src/project-graph/error-types.js +2 -2
- package/dist/src/project-graph/nx-deps-cache.d.ts +3 -2
- package/dist/src/project-graph/nx-deps-cache.js +8 -2
- package/dist/src/project-graph/utils/project-graph-paths.d.ts +8 -0
- package/dist/src/project-graph/utils/project-graph-paths.js +170 -0
- package/dist/src/tasks-runner/batch/run-batch.js +3 -13
- package/dist/src/tasks-runner/cache.js +19 -18
- package/dist/src/tasks-runner/init-tasks-runner.js +23 -17
- package/dist/src/tasks-runner/run-command.js +6 -3
- package/dist/src/tasks-runner/task-orchestrator.d.ts +1 -0
- package/dist/src/tasks-runner/task-orchestrator.js +29 -4
- package/dist/src/tasks-runner/tasks-schedule.js +1 -1
- package/dist/src/tasks-runner/utils.d.ts +2 -1
- package/dist/src/tasks-runner/utils.js +2 -1
- package/dist/src/utils/child-process.js +2 -1
- package/dist/src/utils/find-matching-projects.js +7 -9
- package/dist/src/utils/find-workspace-root.js +2 -4
- package/dist/src/utils/git-utils.d.ts +5 -0
- package/dist/src/utils/git-utils.js +23 -1
- package/dist/src/utils/handle-import.js +14 -2
- package/dist/src/utils/installation-directory.d.ts +16 -0
- package/dist/src/utils/installation-directory.js +96 -2
- package/dist/src/utils/json.d.ts +7 -0
- package/dist/src/utils/json.js +32 -0
- package/dist/src/utils/nx-key.js +11 -8
- package/dist/src/utils/output.d.ts +5 -0
- package/dist/src/utils/output.js +11 -4
- package/dist/src/utils/owned-private-dir.d.ts +10 -0
- package/dist/src/utils/owned-private-dir.js +28 -0
- package/dist/src/utils/package-json.d.ts +7 -0
- package/dist/src/utils/package-json.js +9 -0
- package/dist/src/utils/require-nx-key.js +6 -4
- package/dist/src/utils/workspace-root.d.ts +12 -0
- package/dist/src/utils/workspace-root.js +56 -7
- package/migrations.json +6 -0
- package/package.json +15 -12
- package/schemas/nx-schema.json +75 -9
- package/schemas/project-schema.json +5 -0
|
@@ -5,44 +5,44 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
6
6
|
const yargs = tslib_1.__importStar(require("yargs"));
|
|
7
7
|
const analytics_1 = require("../analytics");
|
|
8
|
-
const output_1 = require("../utils/output");
|
|
9
8
|
const command_object_1 = require("./add/command-object");
|
|
10
|
-
const command_object_2 = require("./
|
|
11
|
-
const command_object_3 = require("./
|
|
12
|
-
const command_object_4 = require("./
|
|
9
|
+
const command_object_2 = require("./conformance/command-object");
|
|
10
|
+
const command_object_3 = require("./affected/command-object");
|
|
11
|
+
const command_object_4 = require("./configure-ai-agents/command-object");
|
|
12
|
+
const command_object_5 = require("./daemon/command-object");
|
|
13
13
|
const command_objects_1 = require("./deprecated/command-objects");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
14
|
+
const command_object_6 = require("./exec/command-object");
|
|
15
|
+
const command_object_7 = require("./format/command-object");
|
|
16
|
+
const command_object_8 = require("./generate/command-object");
|
|
17
|
+
const command_object_9 = require("./graph/command-object");
|
|
18
|
+
const command_object_10 = require("./import/command-object");
|
|
19
|
+
const command_object_11 = require("./init/command-object");
|
|
20
|
+
const command_object_12 = require("./list/command-object");
|
|
21
|
+
const command_object_13 = require("./mcp/command-object");
|
|
22
|
+
const command_object_14 = require("./migrate/command-object");
|
|
23
|
+
const command_object_15 = require("./new/command-object");
|
|
24
|
+
const command_object_16 = require("./nx-cloud/apply-locally/command-object");
|
|
25
|
+
const command_object_17 = require("./nx-cloud/complete-run/command-object");
|
|
26
|
+
const command_object_18 = require("./nx-cloud/connect/command-object");
|
|
27
|
+
const command_object_19 = require("./nx-cloud/download-cloud-client/command-object");
|
|
28
|
+
const command_object_20 = require("./nx-cloud/fix-ci/command-object");
|
|
29
|
+
const command_object_21 = require("./nx-cloud/login/command-object");
|
|
30
|
+
const command_object_22 = require("./nx-cloud/logout/command-object");
|
|
31
|
+
const command_object_23 = require("./nx-cloud/record/command-object");
|
|
32
|
+
const command_object_24 = require("./nx-cloud/start-agent/command-object");
|
|
33
|
+
const command_object_25 = require("./nx-cloud/start-ci-run/command-object");
|
|
34
|
+
const command_object_26 = require("./nx-cloud/start-nx-agents/command-object");
|
|
35
|
+
const command_object_27 = require("./register/command-object");
|
|
36
|
+
const command_object_28 = require("./release/command-object");
|
|
37
|
+
const command_object_29 = require("./repair/command-object");
|
|
38
|
+
const command_object_30 = require("./report/command-object");
|
|
39
|
+
const command_object_31 = require("./reset/command-object");
|
|
40
|
+
const command_object_32 = require("./run-many/command-object");
|
|
41
|
+
const command_object_33 = require("./run/command-object");
|
|
42
|
+
const command_object_34 = require("./show/command-object");
|
|
43
|
+
const command_object_35 = require("./sync/command-object");
|
|
44
|
+
const command_object_36 = require("./watch/command-object");
|
|
45
|
+
const command_object_37 = require("./completion/command-object");
|
|
46
46
|
const trigger_1 = require("./completion/trigger");
|
|
47
47
|
// Ensure that the output takes up the available width of the terminal.
|
|
48
48
|
yargs.wrap(yargs.terminalWidth());
|
|
@@ -60,55 +60,55 @@ exports.commandsObject = yargs
|
|
|
60
60
|
.parserConfiguration(exports.parserConfiguration)
|
|
61
61
|
.usage(pc.bold('Smart Monorepos · Fast Builds'))
|
|
62
62
|
.demandCommand(1, '')
|
|
63
|
-
.command(
|
|
63
|
+
.command(command_object_27.yargsRegisterCommand)
|
|
64
64
|
.command(command_object_1.yargsAddCommand)
|
|
65
|
-
.command(
|
|
66
|
-
.command(
|
|
67
|
-
.command(
|
|
68
|
-
.command(
|
|
69
|
-
.command(
|
|
70
|
-
.command(
|
|
65
|
+
.command(command_object_4.yargsConfigureAiAgentsCommand)
|
|
66
|
+
.command(command_object_3.yargsAffectedBuildCommand)
|
|
67
|
+
.command(command_object_3.yargsAffectedCommand)
|
|
68
|
+
.command(command_object_3.yargsAffectedE2ECommand)
|
|
69
|
+
.command(command_object_3.yargsAffectedLintCommand)
|
|
70
|
+
.command(command_object_3.yargsAffectedTestCommand)
|
|
71
71
|
.command(command_objects_1.yargsAffectedGraphCommand)
|
|
72
|
-
.command(
|
|
73
|
-
.command(
|
|
74
|
-
.command(
|
|
75
|
-
.command(
|
|
76
|
-
.command(
|
|
77
|
-
.command(
|
|
78
|
-
.command(
|
|
79
|
-
.command(
|
|
80
|
-
.command(
|
|
81
|
-
.command(
|
|
82
|
-
.command(
|
|
83
|
-
.command(
|
|
84
|
-
.command(
|
|
72
|
+
.command(command_object_18.yargsConnectCommand)
|
|
73
|
+
.command(command_object_5.yargsDaemonCommand)
|
|
74
|
+
.command(command_object_9.yargsGraphCommand)
|
|
75
|
+
.command(command_object_6.yargsExecCommand)
|
|
76
|
+
.command(command_object_7.yargsFormatCheckCommand)
|
|
77
|
+
.command(command_object_7.yargsFormatWriteCommand)
|
|
78
|
+
.command(command_object_8.yargsGenerateCommand)
|
|
79
|
+
.command(command_object_10.yargsImportCommand)
|
|
80
|
+
.command(command_object_11.yargsInitCommand)
|
|
81
|
+
.command(command_object_14.yargsInternalMigrateCommand)
|
|
82
|
+
.command(command_object_12.yargsListCommand)
|
|
83
|
+
.command(command_object_14.yargsMigrateCommand)
|
|
84
|
+
.command(command_object_15.yargsNewCommand)
|
|
85
85
|
.command(command_objects_1.yargsPrintAffectedCommand)
|
|
86
|
-
.command(
|
|
87
|
-
.command(
|
|
88
|
-
.command(
|
|
89
|
-
.command(
|
|
90
|
-
.command(
|
|
91
|
-
.command(
|
|
92
|
-
.command(
|
|
93
|
-
.command(
|
|
94
|
-
.command(
|
|
95
|
-
.command(
|
|
96
|
-
.command(
|
|
97
|
-
.command(
|
|
98
|
-
.command(
|
|
99
|
-
.command(
|
|
100
|
-
.command(
|
|
101
|
-
.command(
|
|
102
|
-
.command(
|
|
103
|
-
.command(
|
|
104
|
-
.command(
|
|
105
|
-
.command(
|
|
106
|
-
.command(
|
|
107
|
-
.command(
|
|
108
|
-
.command(
|
|
109
|
-
.command(
|
|
110
|
-
.command(resolveConformanceCommandObject())
|
|
111
|
-
.command(
|
|
86
|
+
.command(command_object_28.yargsReleaseCommand)
|
|
87
|
+
.command(command_object_29.yargsRepairCommand)
|
|
88
|
+
.command(command_object_30.yargsReportCommand)
|
|
89
|
+
.command(command_object_31.yargsResetCommand)
|
|
90
|
+
.command(command_object_33.yargsRunCommand)
|
|
91
|
+
.command(command_object_32.yargsRunManyCommand)
|
|
92
|
+
.command(command_object_34.yargsShowCommand)
|
|
93
|
+
.command(command_object_35.yargsSyncCommand)
|
|
94
|
+
.command(command_object_35.yargsSyncCheckCommand)
|
|
95
|
+
.command(command_object_18.yargsViewLogsCommand)
|
|
96
|
+
.command(command_object_36.yargsWatchCommand)
|
|
97
|
+
.command(command_object_33.yargsNxInfixCommand)
|
|
98
|
+
.command(command_object_21.yargsLoginCommand)
|
|
99
|
+
.command(command_object_22.yargsLogoutCommand)
|
|
100
|
+
.command(command_object_23.yargsRecordCommand)
|
|
101
|
+
.command(command_object_25.yargsStartCiRunCommand)
|
|
102
|
+
.command(command_object_26.yargsStartNxAgentsCommand)
|
|
103
|
+
.command(command_object_24.yargsStartAgentCommand)
|
|
104
|
+
.command(command_object_17.yargsStopAllAgentsCommand)
|
|
105
|
+
.command(command_object_20.yargsFixCiCommand)
|
|
106
|
+
.command(command_object_16.yargsApplyLocallyCommand)
|
|
107
|
+
.command(command_object_19.yargsDownloadCloudClientCommand)
|
|
108
|
+
.command(command_object_13.yargsMcpCommand)
|
|
109
|
+
.command(command_object_37.yargsCompletionCommand)
|
|
110
|
+
.command((0, command_object_2.resolveConformanceCommandObject)('conformance'))
|
|
111
|
+
.command((0, command_object_2.resolveConformanceCommandObject)('conformance:check'))
|
|
112
112
|
.scriptName('nx')
|
|
113
113
|
.middleware((args) => {
|
|
114
114
|
// Skip analytics during shell completion (defensive — bin/nx.ts exits
|
|
@@ -133,53 +133,3 @@ exports.commandsObject = yargs
|
|
|
133
133
|
// so that it shows up in help. The default yargs implementation of --version is not
|
|
134
134
|
// hit, as the implementation in nx.ts is hit first and calls process.exit(0).
|
|
135
135
|
.version();
|
|
136
|
-
function createMissingConformanceCommand(command) {
|
|
137
|
-
return {
|
|
138
|
-
command,
|
|
139
|
-
// Hide from --help output in the common case of not having the plugin installed
|
|
140
|
-
describe: false,
|
|
141
|
-
handler: () => {
|
|
142
|
-
output_1.output.error({
|
|
143
|
-
title: `${command} is not available`,
|
|
144
|
-
bodyLines: [
|
|
145
|
-
`In order to use the \`nx ${command}\` command you must have an active Nx key and the \`@nx/conformance\` plugin installed.`,
|
|
146
|
-
'',
|
|
147
|
-
'To learn more, visit https://nx.dev/nx-enterprise/powerpack/conformance',
|
|
148
|
-
],
|
|
149
|
-
});
|
|
150
|
-
process.exit(1);
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
function resolveConformanceCommandObject() {
|
|
155
|
-
try {
|
|
156
|
-
const { yargsConformanceCommand } = (() => {
|
|
157
|
-
try {
|
|
158
|
-
return require('@nx/powerpack-conformance');
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return require('@nx/conformance');
|
|
162
|
-
}
|
|
163
|
-
})();
|
|
164
|
-
return yargsConformanceCommand;
|
|
165
|
-
}
|
|
166
|
-
catch {
|
|
167
|
-
return createMissingConformanceCommand('conformance');
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function resolveConformanceCheckCommandObject() {
|
|
171
|
-
try {
|
|
172
|
-
const { yargsConformanceCheckCommand } = (() => {
|
|
173
|
-
try {
|
|
174
|
-
return require('@nx/powerpack-conformance');
|
|
175
|
-
}
|
|
176
|
-
catch {
|
|
177
|
-
return require('@nx/conformance');
|
|
178
|
-
}
|
|
179
|
-
})();
|
|
180
|
-
return yargsConformanceCheckCommand;
|
|
181
|
-
}
|
|
182
|
-
catch {
|
|
183
|
-
return createMissingConformanceCommand('conformance:check');
|
|
184
|
-
}
|
|
185
|
-
}
|
|
@@ -90,6 +90,10 @@ const releaseCommand = {
|
|
|
90
90
|
.option('skip-publish', {
|
|
91
91
|
type: 'boolean',
|
|
92
92
|
description: 'Skip publishing by automatically answering no to the confirmation prompt for publishing.',
|
|
93
|
+
})
|
|
94
|
+
.option('git-push', {
|
|
95
|
+
describe: 'Whether or not to automatically push the changes made by this command to the remote git repository.',
|
|
96
|
+
type: 'boolean',
|
|
93
97
|
})
|
|
94
98
|
.option('otp', {
|
|
95
99
|
type: 'number',
|
|
@@ -74,12 +74,14 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
|
|
|
74
74
|
const shouldCommit = userProvidedReleaseConfig.git?.commit ?? true;
|
|
75
75
|
const shouldStage = (shouldCommit || userProvidedReleaseConfig.git?.stageChanges) ?? false;
|
|
76
76
|
const shouldTag = userProvidedReleaseConfig.git?.tag ?? true;
|
|
77
|
+
const shouldPushFromGitConfig = args.gitPush ?? nxReleaseConfig.git.push;
|
|
77
78
|
const shouldCreateWorkspaceRemoteRelease = shouldCreateRemoteRelease(nxReleaseConfig.changelog.workspaceChangelog);
|
|
78
79
|
const { workspaceVersion, projectsVersionData, releaseGraph, } = await releaseVersion({
|
|
79
80
|
...args,
|
|
80
81
|
stageChanges: shouldStage,
|
|
81
82
|
gitCommit: false,
|
|
82
83
|
gitTag: false,
|
|
84
|
+
gitPush: false,
|
|
83
85
|
deleteVersionPlans: false,
|
|
84
86
|
});
|
|
85
87
|
// Suppress the filter log for the changelog command as it would have already been printed by the version command
|
|
@@ -185,10 +187,10 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
|
|
|
185
187
|
}
|
|
186
188
|
}
|
|
187
189
|
let hasPushedChanges = false;
|
|
188
|
-
//
|
|
189
|
-
const shouldPush =
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
// Push the release commit and tags when git push is enabled, or when a remote release needs them on the remote.
|
|
191
|
+
const shouldPush = shouldPushFromGitConfig ||
|
|
192
|
+
shouldCreateWorkspaceRemoteRelease ||
|
|
193
|
+
releaseGraph.releaseGroups.some((group) => shouldCreateRemoteRelease(group.changelog));
|
|
192
194
|
if (shouldPush) {
|
|
193
195
|
output_1.output.logSingleLine(`Pushing to git remote "origin"`);
|
|
194
196
|
await (0, git_1.gitPush)({
|
|
@@ -110,11 +110,11 @@ async function _RepoGitTags_alwaysCheckAllBranches(checkAllBranchesWhen) {
|
|
|
110
110
|
// Check if any glob pattern matches next
|
|
111
111
|
if (!alwaysCheckAllBranches) {
|
|
112
112
|
alwaysCheckAllBranches = checkAllBranchesWhen.some((pattern) => {
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
113
|
+
const matcher = new minimatch_1.Minimatch(pattern, { dot: true });
|
|
114
|
+
if (matcher.set.length === 0) {
|
|
115
115
|
return false;
|
|
116
116
|
}
|
|
117
|
-
return
|
|
117
|
+
return matcher.match(currentBranch);
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -4,6 +4,7 @@ exports.resolveNxJsonConfigErrorMessage = resolveNxJsonConfigErrorMessage;
|
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const handle_import_1 = require("../../../utils/handle-import");
|
|
7
|
+
const json_1 = require("../../../utils/json");
|
|
7
8
|
const path_1 = require("../../../utils/path");
|
|
8
9
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
|
9
10
|
async function resolveNxJsonConfigErrorMessage(propPath) {
|
|
@@ -22,32 +23,9 @@ async function getJsonConfigLinesForErrorMessage(rawConfig, jsonPath) {
|
|
|
22
23
|
const jsonParser = await (0, handle_import_1.handleImport)('jsonc-parser');
|
|
23
24
|
const rootNode = jsonParser.parseTree(rawConfig);
|
|
24
25
|
const node = jsonParser.findNodeAtLocation(rootNode, jsonPath);
|
|
25
|
-
return computeJsonLineNumbers(rawConfig, node?.offset, node?.length);
|
|
26
|
+
return (0, json_1.computeJsonLineNumbers)(rawConfig, node?.offset, node?.length);
|
|
26
27
|
}
|
|
27
28
|
catch {
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
function computeJsonLineNumbers(inputText, startOffset, characterCount) {
|
|
32
|
-
let lines = inputText.split('\n');
|
|
33
|
-
let totalChars = 0;
|
|
34
|
-
let startLine = 0;
|
|
35
|
-
let endLine = 0;
|
|
36
|
-
for (let i = 0; i < lines.length; i++) {
|
|
37
|
-
totalChars += lines[i].length + 1; // +1 for '\n' character
|
|
38
|
-
if (!startLine && totalChars >= startOffset) {
|
|
39
|
-
startLine = i + 1; // +1 because arrays are 0-based
|
|
40
|
-
}
|
|
41
|
-
if (totalChars >= startOffset + characterCount) {
|
|
42
|
-
endLine = i + 1; // +1 because arrays are 0-based
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (!startLine) {
|
|
47
|
-
throw new Error('Start offset exceeds the text length');
|
|
48
|
-
}
|
|
49
|
-
if (!endLine) {
|
|
50
|
-
throw new Error('Character count exceeds the text length after start offset');
|
|
51
|
-
}
|
|
52
|
-
return { startLine, endLine };
|
|
53
|
-
}
|
|
@@ -394,7 +394,7 @@ function findMisalignedPackagesForPackage(base) {
|
|
|
394
394
|
}
|
|
395
395
|
function findInstalledPowerpackPlugins() {
|
|
396
396
|
const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
|
|
397
|
-
return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*|@nx/(.+)-cache|@nx/
|
|
397
|
+
return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*|@nx/(.+)-cache|@nx/enterprise*').test(dep.name));
|
|
398
398
|
}
|
|
399
399
|
function findInstalledCommunityPlugins() {
|
|
400
400
|
const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resetHandler = resetHandler;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
5
6
|
const client_1 = require("../../daemon/client/client");
|
|
6
7
|
const tmp_dir_1 = require("../../daemon/tmp-dir");
|
|
7
8
|
const cache_directory_1 = require("../../utils/cache-directory");
|
|
@@ -141,14 +142,62 @@ function removeInstalledNxCloudClient() {
|
|
|
141
142
|
}
|
|
142
143
|
function cleanupCacheEntries() {
|
|
143
144
|
return incrementalBackoff(INCREMENTAL_BACKOFF_FIRST_DELAY, INCREMENTAL_BACKOFF_MAX_DURATION, () => {
|
|
144
|
-
(
|
|
145
|
+
removeNxOwnedCacheEntries(cache_directory_1.cacheDir);
|
|
145
146
|
// `cacheDir` is the shared directory whenever sharing is available, so
|
|
146
147
|
// this is the checkout's own `.nx/cache`: still there from before the
|
|
147
148
|
// move, and still what a later run falls back to if `~/.nx` stops being
|
|
148
149
|
// reachable. Reset means both.
|
|
149
|
-
|
|
150
|
+
const checkoutCache = (0, cache_directory_1.cacheDirectoryForWorkspace)(workspace_root_1.workspaceRoot);
|
|
151
|
+
if (checkoutCache !== cache_directory_1.cacheDir) {
|
|
152
|
+
removeNxOwnedCacheEntries(checkoutCache);
|
|
153
|
+
}
|
|
150
154
|
});
|
|
151
155
|
}
|
|
156
|
+
// xxh3-64 task hashes are decimal (`hasher.rs`). Older hashes and
|
|
157
|
+
// `<hash>.tar.zst` archives are hex. The DB names its files `{id}-v{schema}.db`.
|
|
158
|
+
const TASK_HASH = /^(?:\d{1,20}|[0-9a-fA-F]{16,64})$/;
|
|
159
|
+
const NX_DATABASE_FILE = /^.+-v\d+\.(?:db(?:-wal|-shm|-journal)?|lock)$/;
|
|
160
|
+
function isNxOwnedCacheEntry(name, isDirectory, isSymbolicLink) {
|
|
161
|
+
if (name === 'terminalOutputs' ||
|
|
162
|
+
name === 'batchOutputs' ||
|
|
163
|
+
name === 'run.json' ||
|
|
164
|
+
name.startsWith('.nx-write-probe-')) {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
if (TASK_HASH.test(name)) {
|
|
168
|
+
// A hash is a directory of outputs. A regular file with the same name
|
|
169
|
+
// belongs to whoever put it there; a symlink is removed as the link only.
|
|
170
|
+
return isDirectory || isSymbolicLink;
|
|
171
|
+
}
|
|
172
|
+
if (hasHashPrefix(name, '.commit') || hasHashPrefix(name, '.tar.zst')) {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
return NX_DATABASE_FILE.test(name);
|
|
176
|
+
}
|
|
177
|
+
function hasHashPrefix(name, suffix) {
|
|
178
|
+
return name.endsWith(suffix) && TASK_HASH.test(name.slice(0, -suffix.length));
|
|
179
|
+
}
|
|
180
|
+
function removeNxOwnedCacheEntries(dir) {
|
|
181
|
+
let stat;
|
|
182
|
+
try {
|
|
183
|
+
// `lstat` so a symlink is left in place instead of deleting through it.
|
|
184
|
+
stat = (0, node_fs_1.lstatSync)(dir);
|
|
185
|
+
}
|
|
186
|
+
catch (e) {
|
|
187
|
+
if (e?.code === 'ENOENT') {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
throw e;
|
|
191
|
+
}
|
|
192
|
+
if (!stat.isDirectory()) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
for (const entry of (0, node_fs_1.readdirSync)(dir, { withFileTypes: true })) {
|
|
196
|
+
if (isNxOwnedCacheEntry(entry.name, entry.isDirectory(), entry.isSymbolicLink())) {
|
|
197
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(dir, entry.name), { recursive: true, force: true });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
152
201
|
/** Skips the no-op when the two resolve to one directory. */
|
|
153
202
|
function removeIfDistinct(dir, from) {
|
|
154
203
|
if (dir !== from) {
|
|
@@ -688,6 +688,115 @@ export interface NxReleaseConfiguration {
|
|
|
688
688
|
*/
|
|
689
689
|
versionPlans?: NxReleaseVersionPlansConfiguration | boolean;
|
|
690
690
|
}
|
|
691
|
+
/**
|
|
692
|
+
* Configuration for the `nx conformance` command, provided by `@nx/conformance`.
|
|
693
|
+
*/
|
|
694
|
+
export interface NxConformanceConfiguration {
|
|
695
|
+
/**
|
|
696
|
+
* Optional path to write the conformance results to, defaults to "dist/conformance-result.json".
|
|
697
|
+
* Set to false to disable writing the conformance results to a file.
|
|
698
|
+
*/
|
|
699
|
+
outputPath?: string | false;
|
|
700
|
+
rules: {
|
|
701
|
+
/**
|
|
702
|
+
* Relative path to a local rule implementation, node_module path or nx-cloud rule ID for Nx Cloud Enterprise.
|
|
703
|
+
*/
|
|
704
|
+
rule: string;
|
|
705
|
+
/**
|
|
706
|
+
* Rule specific configuration options.
|
|
707
|
+
*/
|
|
708
|
+
options?: Record<string, unknown>;
|
|
709
|
+
/**
|
|
710
|
+
* The projects array allows users to opt in or out of violations for specific projects being reported by the current rule.
|
|
711
|
+
* The array can contain any valid matchers for findMatchingProjects(), by default the implied value is ["*"].
|
|
712
|
+
*
|
|
713
|
+
* We additionally provide an object syntax for projects which allows users to provide by a matcher string and an
|
|
714
|
+
* explanation to communicate to their colleagues why a particular project or projects was included or excluded from
|
|
715
|
+
* consideration from the rule.
|
|
716
|
+
*
|
|
717
|
+
* The explanation currently does nothing to affect any functionality.
|
|
718
|
+
*/
|
|
719
|
+
projects?: Array<string | {
|
|
720
|
+
matcher: string;
|
|
721
|
+
explanation: string;
|
|
722
|
+
}>;
|
|
723
|
+
/**
|
|
724
|
+
* Optional explanation field for users to be able to communicate to their colleague why a particular rule is
|
|
725
|
+
* enabled and important to the workspace in question.
|
|
726
|
+
*
|
|
727
|
+
* Currently does nothing to affect any functionality.
|
|
728
|
+
*/
|
|
729
|
+
explanation?: string;
|
|
730
|
+
/**
|
|
731
|
+
* Override the default status of the rule, which is "enforced".
|
|
732
|
+
*
|
|
733
|
+
* If set to "evaluated", the rule will be reported as normal, but not enforced (will exit with code 0).
|
|
734
|
+
* If set to "disabled", the rule will not be evaluated at all.
|
|
735
|
+
*/
|
|
736
|
+
status?: 'enforced' | 'evaluated' | 'disabled';
|
|
737
|
+
}[];
|
|
738
|
+
}
|
|
739
|
+
type NxOwnersPatternBase = {
|
|
740
|
+
/**
|
|
741
|
+
* Owner IDs for the matched files, or `false` to mark them as having no owners
|
|
742
|
+
* (e.g. files managed by a bot user).
|
|
743
|
+
*/
|
|
744
|
+
owners: string[] | false;
|
|
745
|
+
description?: string;
|
|
746
|
+
/**
|
|
747
|
+
* Whether the root `owners.prefix` applies to this pattern. Defaults to `true`.
|
|
748
|
+
*/
|
|
749
|
+
applyPrefix?: boolean;
|
|
750
|
+
/**
|
|
751
|
+
* Prefix for this pattern's owners, taking precedence over the root `owners.prefix`.
|
|
752
|
+
*/
|
|
753
|
+
prefix?: string;
|
|
754
|
+
};
|
|
755
|
+
type NxOwnersPattern = NxOwnersPatternBase & NxOwnersPatternTarget;
|
|
756
|
+
type NxOwnersSectionPattern = Omit<NxOwnersPatternBase, 'owners'> & Partial<Pick<NxOwnersPatternBase, 'owners'>> & NxOwnersPatternTarget;
|
|
757
|
+
/**
|
|
758
|
+
* When both `projects` and `files` are provided, file patterns are evaluated relative to each
|
|
759
|
+
* matched project root instead of the workspace root.
|
|
760
|
+
*/
|
|
761
|
+
type NxOwnersPatternTarget = {
|
|
762
|
+
files: string[];
|
|
763
|
+
} | {
|
|
764
|
+
projects: string[];
|
|
765
|
+
} | {
|
|
766
|
+
projects: string[];
|
|
767
|
+
files: string[];
|
|
768
|
+
};
|
|
769
|
+
/**
|
|
770
|
+
* Configuration for CODEOWNERS generation, provided by `@nx/owners`.
|
|
771
|
+
*/
|
|
772
|
+
export interface NxOwnersConfiguration {
|
|
773
|
+
/**
|
|
774
|
+
* Defaults to `github`.
|
|
775
|
+
*/
|
|
776
|
+
format?: 'github' | 'gitlab' | 'bitbucket';
|
|
777
|
+
/**
|
|
778
|
+
* Defaults to the format's conventional location, e.g. `.github/CODEOWNERS`.
|
|
779
|
+
*/
|
|
780
|
+
outputPath?: string;
|
|
781
|
+
/**
|
|
782
|
+
* Prefix applied to owner strings, e.g. `@org`.
|
|
783
|
+
*/
|
|
784
|
+
prefix?: string;
|
|
785
|
+
patterns?: NxOwnersPattern[];
|
|
786
|
+
/**
|
|
787
|
+
* GitLab only. Groups patterns with approval requirements.
|
|
788
|
+
*/
|
|
789
|
+
sections?: {
|
|
790
|
+
name: string;
|
|
791
|
+
/**
|
|
792
|
+
* A pattern without `owners` uses the section's `defaultOwners`.
|
|
793
|
+
*/
|
|
794
|
+
patterns: NxOwnersSectionPattern[];
|
|
795
|
+
defaultOwners?: string[];
|
|
796
|
+
numberOfRequiredApprovals?: number;
|
|
797
|
+
optional?: boolean;
|
|
798
|
+
}[];
|
|
799
|
+
}
|
|
691
800
|
export interface NxSyncConfiguration {
|
|
692
801
|
/**
|
|
693
802
|
* List of workspace-wide sync generators to be run (not attached to targets).
|
|
@@ -935,6 +1044,14 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
|
|
|
935
1044
|
* Configuration for the `nx migrate` command.
|
|
936
1045
|
*/
|
|
937
1046
|
migrate?: NxMigrateConfiguration;
|
|
1047
|
+
/**
|
|
1048
|
+
* Configuration for the `nx conformance` command.
|
|
1049
|
+
*/
|
|
1050
|
+
conformance?: NxConformanceConfiguration;
|
|
1051
|
+
/**
|
|
1052
|
+
* Configuration for CODEOWNERS generation. Set to `true` to enable it with defaults.
|
|
1053
|
+
*/
|
|
1054
|
+
owners?: NxOwnersConfiguration | boolean;
|
|
938
1055
|
/**
|
|
939
1056
|
* Sets the maximum size of the local cache. Accepts a number followed by a unit (e.g. 100MB). Accepted units are B, KB, MB, and GB.
|
|
940
1057
|
*/
|
|
@@ -371,13 +371,12 @@ export interface TargetConfiguration<T = any> {
|
|
|
371
371
|
*/
|
|
372
372
|
syncGenerators?: string[];
|
|
373
373
|
/**
|
|
374
|
-
* Spread token used when merging
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
* last-write-wins semantics with {@link https://nx.dev/reference/project-configuration#spread-token}.
|
|
374
|
+
* Spread token used when merging with a compatible base (inferred) target.
|
|
375
|
+
* Keys before it defer to the base value; keys after it win. In project
|
|
376
|
+
* configuration, a target with a different executor, command or script
|
|
377
|
+
* replaces the base regardless. `options`, `configurations`, `ultracache`
|
|
378
|
+
* and `metadata` merge by their own rules wherever the token sits.
|
|
379
|
+
* See {@link https://nx.dev/reference/project-configuration#spread-token}.
|
|
381
380
|
*/
|
|
382
381
|
'...'?: true;
|
|
383
382
|
}
|
|
@@ -100,6 +100,8 @@ const DAEMON_ENV_VARS_EXCLUSIONS = new Set([
|
|
|
100
100
|
'COPILOT_AGENT_SESSION_ID',
|
|
101
101
|
'COPILOT_CLI_BINARY_VERSION',
|
|
102
102
|
'CLAUDE_PID',
|
|
103
|
+
// Editors / IDEs
|
|
104
|
+
'NX_CONSOLE',
|
|
103
105
|
// Shell mechanics
|
|
104
106
|
'_',
|
|
105
107
|
'SHLVL',
|
|
@@ -172,6 +174,17 @@ const DAEMON_ENV_VARS_EXCLUSIONS = new Set([
|
|
|
172
174
|
// macOS internals
|
|
173
175
|
'__CF_USER_TEXT_ENCODING',
|
|
174
176
|
'__CFBundleIdentifier',
|
|
177
|
+
// Set by git per invocation when Nx runs from a hook. Exact entries rather
|
|
178
|
+
// than a GIT_ prefix, which would also swallow GIT_DIR.
|
|
179
|
+
'GIT_INDEX_FILE',
|
|
180
|
+
'GIT_PREFIX',
|
|
181
|
+
'GIT_REFLOG_ACTION',
|
|
182
|
+
'GIT_AUTHOR_NAME',
|
|
183
|
+
'GIT_AUTHOR_EMAIL',
|
|
184
|
+
'GIT_AUTHOR_DATE',
|
|
185
|
+
'GIT_COMMITTER_NAME',
|
|
186
|
+
'GIT_COMMITTER_EMAIL',
|
|
187
|
+
'GIT_COMMITTER_DATE',
|
|
175
188
|
]);
|
|
176
189
|
/**
|
|
177
190
|
* Env var prefixes that should never be sent to the daemon.
|
|
@@ -191,6 +204,8 @@ const DAEMON_ENV_PREFIX_EXCLUSIONS = [
|
|
|
191
204
|
// Package managers (process-scoped)
|
|
192
205
|
'npm_',
|
|
193
206
|
'pnpm_',
|
|
207
|
+
'PNPM_',
|
|
208
|
+
'COREPACK_',
|
|
194
209
|
// Nx Cloud runner/agent vars (per-worker values like NX_CLOUD_WORKER_ID
|
|
195
210
|
// and NX_CLOUD_EXECUTION_ID diverge between distributed-execution workers
|
|
196
211
|
// and cannot affect the project graph; without this every worker that
|