nx 20.0.0-canary.20241002-1d10a19 → 20.0.0-canary.20241005-75c1da3
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 +12 -2
- package/bin/init-local.js +0 -39
- package/bin/nx.js +3 -13
- package/migrations.json +5 -37
- package/package.json +11 -11
- package/release/changelog-renderer/index.d.ts +60 -38
- package/release/changelog-renderer/index.js +260 -236
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -1
- package/src/command-line/add/add.js +2 -2
- package/src/command-line/affected/affected.js +0 -2
- package/src/command-line/nx-commands.js +31 -10
- package/src/command-line/release/changelog.d.ts +2 -2
- package/src/command-line/release/changelog.js +28 -29
- package/src/command-line/release/index.d.ts +5 -2
- package/src/command-line/release/publish.d.ts +6 -1
- package/src/command-line/release/publish.js +31 -25
- package/src/command-line/release/utils/git.js +2 -2
- package/src/command-line/release/utils/print-changes.js +6 -4
- package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -2
- package/src/command-line/release/utils/resolve-changelog-renderer.js +3 -3
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -3
- package/src/command-line/release/version.d.ts +3 -3
- package/src/command-line/run/run-one.js +0 -2
- package/src/command-line/run/run.js +0 -1
- package/src/command-line/run-many/run-many.js +1 -4
- package/src/command-line/yargs-utils/shared-options.js +2 -2
- package/src/config/misc-interfaces.d.ts +3 -15
- package/src/config/nx-json.d.ts +4 -3
- package/src/config/project-graph.d.ts +0 -2
- package/src/core/graph/main.js +1 -1
- package/src/daemon/client/client.js +1 -3
- package/src/devkit-exports.d.ts +3 -4
- package/src/devkit-exports.js +3 -6
- package/src/executors/utils/convert-nx-executor.js +0 -1
- package/src/generators/utils/nx-json.d.ts +1 -1
- package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
- package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +54 -6
- package/src/nx-cloud/utilities/axios.js +1 -2
- package/src/nx-cloud/utilities/onboarding.js +2 -2
- package/src/nx-cloud/utilities/url-shorten.js +5 -5
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -12
- package/src/project-graph/build-project-graph.js +3 -41
- package/src/project-graph/error-types.d.ts +4 -10
- package/src/project-graph/error-types.js +1 -12
- package/src/project-graph/file-utils.d.ts +2 -2
- package/src/project-graph/file-utils.js +3 -3
- package/src/project-graph/nx-deps-cache.d.ts +0 -1
- package/src/project-graph/nx-deps-cache.js +0 -1
- package/src/project-graph/plugins/internal-api.d.ts +2 -5
- package/src/project-graph/plugins/internal-api.js +0 -1
- package/src/project-graph/plugins/isolation/messaging.d.ts +3 -23
- package/src/project-graph/plugins/isolation/plugin-pool.js +0 -23
- package/src/project-graph/plugins/isolation/plugin-worker.js +0 -19
- package/src/project-graph/plugins/loader.js +2 -3
- package/src/project-graph/plugins/public-api.d.ts +6 -7
- package/src/project-graph/plugins/utils.d.ts +1 -7
- package/src/project-graph/plugins/utils.js +0 -37
- package/src/project-graph/utils/project-configuration-utils.js +1 -1
- package/src/tasks-runner/batch/run-batch.js +0 -1
- package/src/tasks-runner/cache.d.ts +2 -1
- package/src/tasks-runner/cache.js +11 -6
- package/src/tasks-runner/create-task-graph.d.ts +2 -0
- package/src/tasks-runner/create-task-graph.js +39 -5
- package/src/tasks-runner/init-tasks-runner.js +0 -2
- package/src/tasks-runner/run-command.js +15 -2
- package/src/tasks-runner/task-orchestrator.js +1 -1
- package/src/utils/command-line-utils.d.ts +3 -0
- package/src/utils/command-line-utils.js +24 -33
- package/src/utils/git-utils.js +2 -2
- package/src/utils/plugins/plugin-capabilities.js +2 -3
- package/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
- package/src/migrations/update-15-0-0/prefix-outputs.js +0 -49
- package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -97
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -45
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
- package/src/utils/app-root.d.ts +0 -8
- package/src/utils/app-root.js +0 -12
- package/src/utils/nx-plugin.deprecated.d.ts +0 -31
- package/src/utils/nx-plugin.deprecated.js +0 -20
- package/src/utils/workspace-configuration-check.d.ts +0 -1
- package/src/utils/workspace-configuration-check.js +0 -36
@@ -102,25 +102,6 @@ const server = (0, net_1.createServer)((socket) => {
|
|
102
102
|
};
|
103
103
|
}
|
104
104
|
},
|
105
|
-
processProjectGraph: async ({ graph, ctx, tx }) => {
|
106
|
-
try {
|
107
|
-
const result = await plugin.processProjectGraph(graph, ctx);
|
108
|
-
return {
|
109
|
-
type: 'processProjectGraphResult',
|
110
|
-
payload: { graph: result, success: true, tx },
|
111
|
-
};
|
112
|
-
}
|
113
|
-
catch (e) {
|
114
|
-
return {
|
115
|
-
type: 'processProjectGraphResult',
|
116
|
-
payload: {
|
117
|
-
success: false,
|
118
|
-
error: (0, serializable_error_1.createSerializableError)(e),
|
119
|
-
tx,
|
120
|
-
},
|
121
|
-
};
|
122
|
-
}
|
123
|
-
},
|
124
105
|
createMetadata: async ({ graph, context, tx }) => {
|
125
106
|
try {
|
126
107
|
const result = await plugin.createMetadata(graph, context);
|
@@ -20,7 +20,6 @@ const path_1 = require("../../utils/path");
|
|
20
20
|
const logger_1 = require("../../utils/logger");
|
21
21
|
const node_path_1 = require("node:path");
|
22
22
|
const retrieve_workspace_files_1 = require("../utils/retrieve-workspace-files");
|
23
|
-
const utils_1 = require("./utils");
|
24
23
|
const internal_api_1 = require("./internal-api");
|
25
24
|
const error_types_1 = require("../error-types");
|
26
25
|
const path = require("node:path/posix");
|
@@ -197,8 +196,8 @@ async function loadNxPluginAsync(pluginConfiguration, paths, root) {
|
|
197
196
|
await (0, retrieve_workspace_files_1.retrieveProjectConfigurationsWithoutPluginInference)(root);
|
198
197
|
}
|
199
198
|
performance.mark(`Load Nx Plugin: ${moduleName} - start`);
|
200
|
-
|
201
|
-
const plugin =
|
199
|
+
const { pluginPath, name } = getPluginPathAndName(moduleName, paths, projectsWithoutInference, root);
|
200
|
+
const plugin = await importPluginModule(pluginPath);
|
202
201
|
plugin.name ??= name;
|
203
202
|
performance.mark(`Load Nx Plugin: ${moduleName} - end`);
|
204
203
|
performance.measure(`Load Nx Plugin: ${moduleName}`, `Load Nx Plugin: ${moduleName} - start`, `Load Nx Plugin: ${moduleName} - end`);
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { NxPluginV1 } from '../../utils/nx-plugin.deprecated';
|
2
1
|
import { FileMap, ProjectGraph, ProjectGraphExternalNode } from '../../config/project-graph';
|
3
2
|
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
4
3
|
import { NxJsonConfiguration } from '../../config/nx-json';
|
@@ -38,12 +37,12 @@ export interface CreateNodesResult {
|
|
38
37
|
* A pair of file patterns and {@link CreateNodesFunction}
|
39
38
|
*
|
40
39
|
* Nx 19.2+: Both original `CreateNodes` and `CreateNodesV2` are supported. Nx will only invoke `CreateNodesV2` if it is present.
|
41
|
-
* Nx
|
40
|
+
* Nx 21.X : The `CreateNodesV2` will be the only supported API. This typing will still exist, but be identical to `CreateNodesV2`.
|
42
41
|
Nx **will not** invoke the original `plugin.createNodes` callback. This should give plugin authors a window to transition.
|
43
42
|
Plugin authors should update their plugin's `createNodes` function to align with `CreateNodesV2` / the updated `CreateNodes`.
|
44
43
|
The plugin should contain something like: `export createNodes = createNodesV2;` during this period. This will allow the plugin
|
45
44
|
to maintain compatibility with Nx 19.2 and up.
|
46
|
-
* Nx
|
45
|
+
* Nx 22.X : The `CreateNodesV2` typing will be removed, as it has replaced `CreateNodes`.
|
47
46
|
*
|
48
47
|
* @deprecated Use {@link CreateNodesV2} instead. CreateNodesV2 will replace this API. Read more about the transition above.
|
49
48
|
*/
|
@@ -53,7 +52,7 @@ export type CreateNodes<T = unknown> = readonly [
|
|
53
52
|
];
|
54
53
|
/**
|
55
54
|
* A pair of file patterns and {@link CreateNodesFunctionV2}
|
56
|
-
* In Nx
|
55
|
+
* In Nx 21 {@link CreateNodes} will be replaced with this type. In Nx 22, this type will be removed.
|
57
56
|
*/
|
58
57
|
export type CreateNodesV2<T = unknown> = readonly [
|
59
58
|
projectFilePattern: string,
|
@@ -105,14 +104,14 @@ export type NxPluginV2<TOptions = unknown> = {
|
|
105
104
|
* Provides a file pattern and function that retrieves configuration info from
|
106
105
|
* those files. e.g. { '**\/*.csproj': buildProjectsFromCsProjFile }
|
107
106
|
*
|
108
|
-
* @deprecated Use {@link createNodesV2} instead. In Nx
|
107
|
+
* @deprecated Use {@link createNodesV2} instead. In Nx 21 support for calling createNodes with a single file for the first argument will be removed.
|
109
108
|
*/
|
110
109
|
createNodes?: CreateNodes<TOptions>;
|
111
110
|
/**
|
112
111
|
* Provides a file pattern and function that retrieves configuration info from
|
113
112
|
* those files. e.g. { '**\/*.csproj': buildProjectsFromCsProjFiles }
|
114
113
|
*
|
115
|
-
* In Nx
|
114
|
+
* In Nx 21 {@link createNodes} will be replaced with this property. In Nx 22, this property will be removed.
|
116
115
|
*/
|
117
116
|
createNodesV2?: CreateNodesV2<TOptions>;
|
118
117
|
/**
|
@@ -127,4 +126,4 @@ export type NxPluginV2<TOptions = unknown> = {
|
|
127
126
|
/**
|
128
127
|
* A plugin for Nx
|
129
128
|
*/
|
130
|
-
export type NxPlugin =
|
129
|
+
export type NxPlugin = NxPluginV2;
|
@@ -1,8 +1,2 @@
|
|
1
|
-
import
|
2
|
-
import type { LoadedNxPlugin, NormalizedPlugin } from './internal-api';
|
3
|
-
import { CreateNodesContextV2, CreateNodesFunction, CreateNodesResult, type NxPlugin, type NxPluginV2 } from './public-api';
|
4
|
-
export declare function isNxPluginV2(plugin: NxPlugin): plugin is NxPluginV2;
|
5
|
-
export declare function isNxPluginV1(plugin: NxPlugin | LoadedNxPlugin): plugin is NxPluginV1;
|
6
|
-
export declare function normalizeNxPlugin(plugin: NxPlugin): NormalizedPlugin;
|
7
|
-
export type AsyncFn<T extends Function> = T extends (...args: infer A) => infer R ? (...args: A) => Promise<Awaited<R>> : never;
|
1
|
+
import { CreateNodesContextV2, CreateNodesFunction, CreateNodesResult } from './public-api';
|
8
2
|
export declare function createNodesFromFiles<T = unknown>(createNodes: CreateNodesFunction<T>, configFiles: readonly string[], options: T, context: CreateNodesContextV2): Promise<[file: string, value: CreateNodesResult][]>;
|
@@ -1,44 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isNxPluginV2 = isNxPluginV2;
|
4
|
-
exports.isNxPluginV1 = isNxPluginV1;
|
5
|
-
exports.normalizeNxPlugin = normalizeNxPlugin;
|
6
3
|
exports.createNodesFromFiles = createNodesFromFiles;
|
7
|
-
const node_path_1 = require("node:path");
|
8
|
-
const to_project_name_1 = require("../../config/to-project-name");
|
9
|
-
const globs_1 = require("../../utils/globs");
|
10
4
|
const error_types_1 = require("../error-types");
|
11
|
-
function isNxPluginV2(plugin) {
|
12
|
-
return 'createNodes' in plugin || 'createDependencies' in plugin;
|
13
|
-
}
|
14
|
-
function isNxPluginV1(plugin) {
|
15
|
-
return 'processProjectGraph' in plugin || 'projectFilePatterns' in plugin;
|
16
|
-
}
|
17
|
-
function normalizeNxPlugin(plugin) {
|
18
|
-
if (isNxPluginV2(plugin)) {
|
19
|
-
return plugin;
|
20
|
-
}
|
21
|
-
if (isNxPluginV1(plugin) && plugin.projectFilePatterns) {
|
22
|
-
return {
|
23
|
-
...plugin,
|
24
|
-
createNodes: [
|
25
|
-
`*/**/${(0, globs_1.combineGlobPatterns)(plugin.projectFilePatterns)}`,
|
26
|
-
(configFilePath) => {
|
27
|
-
const root = (0, node_path_1.dirname)(configFilePath);
|
28
|
-
return {
|
29
|
-
projects: {
|
30
|
-
[root]: {
|
31
|
-
name: (0, to_project_name_1.toProjectName)(configFilePath),
|
32
|
-
targets: plugin.registerProjectTargets?.(configFilePath),
|
33
|
-
},
|
34
|
-
},
|
35
|
-
};
|
36
|
-
},
|
37
|
-
],
|
38
|
-
};
|
39
|
-
}
|
40
|
-
return plugin;
|
41
|
-
}
|
42
5
|
async function createNodesFromFiles(createNodes, configFiles, options, context) {
|
43
6
|
const results = [];
|
44
7
|
const errors = [];
|
@@ -184,7 +184,7 @@ function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata
|
|
184
184
|
}
|
185
185
|
}
|
186
186
|
else {
|
187
|
-
result[metadataKey] = value;
|
187
|
+
result[metadataKey][key] = value[key];
|
188
188
|
if (sourceMap) {
|
189
189
|
sourceMap[`${baseSourceMapPath}.${metadataKey}`] =
|
190
190
|
sourceInformation;
|
@@ -23,7 +23,6 @@ async function runTasks(executorName, batchTaskGraph, fullTaskGraph) {
|
|
23
23
|
cwd: process.cwd(),
|
24
24
|
projectsConfigurations,
|
25
25
|
nxJsonConfiguration,
|
26
|
-
workspace: { ...projectsConfigurations, ...nxJsonConfiguration },
|
27
26
|
isVerbose: false,
|
28
27
|
projectGraph,
|
29
28
|
taskGraph: fullTaskGraph,
|
@@ -11,7 +11,8 @@ export type TaskWithCachedResult = {
|
|
11
11
|
task: Task;
|
12
12
|
cachedResult: CachedResult;
|
13
13
|
};
|
14
|
-
export declare function
|
14
|
+
export declare function dbCacheEnabled(nxJson?: NxJsonConfiguration): boolean;
|
15
|
+
export declare function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache;
|
15
16
|
export declare class DbCache {
|
16
17
|
private readonly options;
|
17
18
|
private cache;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.Cache = exports.DbCache = void 0;
|
4
|
+
exports.dbCacheEnabled = dbCacheEnabled;
|
4
5
|
exports.getCache = getCache;
|
5
6
|
const workspace_root_1 = require("../utils/workspace-root");
|
6
7
|
const path_1 = require("path");
|
@@ -19,14 +20,18 @@ const update_manager_1 = require("../nx-cloud/update-manager");
|
|
19
20
|
const get_cloud_options_1 = require("../nx-cloud/utilities/get-cloud-options");
|
20
21
|
const is_ci_1 = require("../utils/is-ci");
|
21
22
|
const output_1 = require("../utils/output");
|
22
|
-
function
|
23
|
-
return process.env.NX_DISABLE_DB !== 'true' &&
|
24
|
-
|
23
|
+
function dbCacheEnabled(nxJson = (0, nx_json_1.readNxJson)()) {
|
24
|
+
return (process.env.NX_DISABLE_DB !== 'true' &&
|
25
|
+
nxJson.useLegacyCache !== true &&
|
26
|
+
process.env.NX_DB_CACHE !== 'false');
|
27
|
+
}
|
28
|
+
// Do not change the order of these arguments as this function is used by nx cloud
|
29
|
+
function getCache(options) {
|
30
|
+
const nxJson = (0, nx_json_1.readNxJson)();
|
31
|
+
return dbCacheEnabled(nxJson)
|
25
32
|
? new DbCache({
|
26
33
|
// Remove this in Nx 21
|
27
|
-
nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)(
|
28
|
-
? options.remoteCache
|
29
|
-
: null,
|
34
|
+
nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson) ? options.remoteCache : null,
|
30
35
|
})
|
31
36
|
: new Cache(options);
|
32
37
|
}
|
@@ -18,9 +18,11 @@ export declare class ProcessTasks {
|
|
18
18
|
private processTasksForMultipleProjects;
|
19
19
|
private processTasksForSingleProject;
|
20
20
|
private processTasksForDependencies;
|
21
|
+
private createDummyTask;
|
21
22
|
createTask(id: string, project: ProjectGraphProjectNode, target: string, resolvedConfiguration: string | undefined, overrides: Object): Task;
|
22
23
|
resolveConfiguration(project: ProjectGraphProjectNode, target: string, configuration: string | undefined): string;
|
23
24
|
getId(project: string, target: string, configuration: string | undefined): string;
|
25
|
+
private filterDummyTasks;
|
24
26
|
}
|
25
27
|
export declare function createTaskGraph(projectGraph: ProjectGraph, extraTargetDependencies: TargetDependencies, projectNames: string[], targets: string[], configuration: string | undefined, overrides: Object, excludeTaskDependencies?: boolean): TaskGraph;
|
26
28
|
export declare function mapTargetDefaultsToDependencies(defaults: TargetDefaults | undefined): TargetDependencies;
|
@@ -6,6 +6,7 @@ exports.mapTargetDefaultsToDependencies = mapTargetDefaultsToDependencies;
|
|
6
6
|
const utils_1 = require("./utils");
|
7
7
|
const project_graph_utils_1 = require("../utils/project-graph-utils");
|
8
8
|
const output_1 = require("../utils/output");
|
9
|
+
const DUMMY_TASK_TARGET = '__nx_dummy_task__';
|
9
10
|
class ProcessTasks {
|
10
11
|
constructor(extraTargetDependencies, projectGraph) {
|
11
12
|
this.extraTargetDependencies = extraTargetDependencies;
|
@@ -52,10 +53,11 @@ class ProcessTasks {
|
|
52
53
|
this.dependencies[d] = this.dependencies[d].filter((dd) => !!initialTasks[dd]);
|
53
54
|
}
|
54
55
|
}
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
this.filterDummyTasks();
|
57
|
+
for (const taskId of Object.keys(this.dependencies)) {
|
58
|
+
if (this.dependencies[taskId].length > 0) {
|
59
|
+
this.dependencies[taskId] = [
|
60
|
+
...new Set(this.dependencies[taskId].filter((d) => d !== taskId)).values(),
|
59
61
|
];
|
60
62
|
}
|
61
63
|
}
|
@@ -113,6 +115,9 @@ class ProcessTasks {
|
|
113
115
|
}
|
114
116
|
}
|
115
117
|
processTasksForDependencies(projectUsedToDeriveDependencies, dependencyConfig, configuration, task, taskOverrides, overrides) {
|
118
|
+
if (!this.projectGraph.dependencies.hasOwnProperty(projectUsedToDeriveDependencies)) {
|
119
|
+
return;
|
120
|
+
}
|
116
121
|
for (const dep of this.projectGraph.dependencies[projectUsedToDeriveDependencies]) {
|
117
122
|
const depProject = this.projectGraph.nodes[dep.target];
|
118
123
|
// this is to handle external dependencies
|
@@ -132,10 +137,20 @@ class ProcessTasks {
|
|
132
137
|
}
|
133
138
|
}
|
134
139
|
else {
|
135
|
-
this.
|
140
|
+
const dummyId = this.getId(depProject.name, DUMMY_TASK_TARGET, undefined);
|
141
|
+
this.dependencies[task.id].push(dummyId);
|
142
|
+
this.dependencies[dummyId] = [];
|
143
|
+
const noopTask = this.createDummyTask(dummyId, task);
|
144
|
+
this.processTask(noopTask, depProject.name, configuration, overrides);
|
136
145
|
}
|
137
146
|
}
|
138
147
|
}
|
148
|
+
createDummyTask(id, task) {
|
149
|
+
return {
|
150
|
+
...task,
|
151
|
+
id,
|
152
|
+
};
|
153
|
+
}
|
139
154
|
createTask(id, project, target, resolvedConfiguration, overrides) {
|
140
155
|
if (!project.data.targets[target]) {
|
141
156
|
throw new Error(`Cannot find configuration for task ${project.name}:${target}`);
|
@@ -173,6 +188,25 @@ class ProcessTasks {
|
|
173
188
|
}
|
174
189
|
return id;
|
175
190
|
}
|
191
|
+
filterDummyTasks() {
|
192
|
+
for (const [key, deps] of Object.entries(this.dependencies)) {
|
193
|
+
const normalizedDeps = [];
|
194
|
+
for (const dep of deps) {
|
195
|
+
if (dep.endsWith(DUMMY_TASK_TARGET)) {
|
196
|
+
normalizedDeps.push(...this.dependencies[dep].filter((d) => !d.endsWith(DUMMY_TASK_TARGET)));
|
197
|
+
}
|
198
|
+
else {
|
199
|
+
normalizedDeps.push(dep);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
this.dependencies[key] = normalizedDeps;
|
203
|
+
}
|
204
|
+
for (const key of Object.keys(this.dependencies)) {
|
205
|
+
if (key.endsWith(DUMMY_TASK_TARGET)) {
|
206
|
+
delete this.dependencies[key];
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
176
210
|
}
|
177
211
|
exports.ProcessTasks = ProcessTasks;
|
178
212
|
function createTaskGraph(projectGraph, extraTargetDependencies, projectNames, targets, configuration, overrides, excludeTaskDependencies = false) {
|
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.initTasksRunner = initTasksRunner;
|
4
|
-
const workspace_configuration_check_1 = require("../utils/workspace-configuration-check");
|
5
4
|
const configuration_1 = require("../config/configuration");
|
6
5
|
const project_graph_1 = require("../project-graph/project-graph");
|
7
6
|
const run_command_1 = require("./run-command");
|
@@ -12,7 +11,6 @@ const dotenv_1 = require("../utils/dotenv");
|
|
12
11
|
async function initTasksRunner(nxArgs) {
|
13
12
|
perf_hooks_1.performance.mark('init-local');
|
14
13
|
(0, dotenv_1.loadRootEnvFiles)();
|
15
|
-
(0, workspace_configuration_check_1.workspaceConfigurationCheck)();
|
16
14
|
const nxJson = (0, configuration_1.readNxJson)();
|
17
15
|
if (nxArgs.verbose) {
|
18
16
|
process.env.NX_VERBOSE_LOGGING = 'true';
|
@@ -511,12 +511,21 @@ function loadTasksRunner(modulePath) {
|
|
511
511
|
}
|
512
512
|
function getRunner(nxArgs, nxJson) {
|
513
513
|
let runner = nxArgs.runner;
|
514
|
-
runner = runner
|
514
|
+
runner = runner ?? 'default';
|
515
515
|
if (runner !== 'default' && !nxJson.tasksRunnerOptions?.[runner]) {
|
516
516
|
throw new Error(`Could not find runner configuration for ${runner}`);
|
517
517
|
}
|
518
518
|
const modulePath = getTasksRunnerPath(runner, nxJson);
|
519
519
|
try {
|
520
|
+
if (isCustomRunnerPath(modulePath)) {
|
521
|
+
output_1.output.warn({
|
522
|
+
title: `Custom task runners will no longer be supported in Nx 21.`,
|
523
|
+
bodyLines: [
|
524
|
+
`Use Nx Cloud or the Nx Powerpack caches instead.`,
|
525
|
+
`For more information, see https://nx.dev/features/powerpack/custom-caching`,
|
526
|
+
],
|
527
|
+
});
|
528
|
+
}
|
520
529
|
const tasksRunner = loadTasksRunner(modulePath);
|
521
530
|
return {
|
522
531
|
tasksRunner,
|
@@ -527,6 +536,7 @@ function getRunner(nxArgs, nxJson) {
|
|
527
536
|
throw new Error(`Could not find runner configuration for ${runner}`);
|
528
537
|
}
|
529
538
|
}
|
539
|
+
const defaultTasksRunnerPath = require.resolve('./default-tasks-runner');
|
530
540
|
function getTasksRunnerPath(runner, nxJson) {
|
531
541
|
let modulePath = nxJson.tasksRunnerOptions?.[runner]?.runner;
|
532
542
|
if (modulePath) {
|
@@ -544,7 +554,7 @@ function getTasksRunnerPath(runner, nxJson) {
|
|
544
554
|
process.env.NX_CLOUD_ACCESS_TOKEN ||
|
545
555
|
// Nx Cloud ID specified in nxJson
|
546
556
|
nxJson.nxCloudId;
|
547
|
-
return isCloudRunner ? 'nx-cloud' :
|
557
|
+
return isCloudRunner ? 'nx-cloud' : defaultTasksRunnerPath;
|
548
558
|
}
|
549
559
|
function getRunnerOptions(runner, nxJson, nxArgs, isCloudDefault) {
|
550
560
|
const defaultCacheableOperations = [];
|
@@ -588,3 +598,6 @@ function getRunnerOptions(runner, nxJson, nxArgs, isCloudDefault) {
|
|
588
598
|
}
|
589
599
|
return result;
|
590
600
|
}
|
601
|
+
function isCustomRunnerPath(modulePath) {
|
602
|
+
return !['nx-cloud', '@nrwl/nx-cloud', defaultTasksRunnerPath].includes(modulePath);
|
603
|
+
}
|
@@ -28,7 +28,7 @@ class TaskOrchestrator {
|
|
28
28
|
this.daemon = daemon;
|
29
29
|
this.outputStyle = outputStyle;
|
30
30
|
this.taskDetails = (0, hash_task_1.getTaskDetails)();
|
31
|
-
this.cache = (0, cache_1.getCache)(this.
|
31
|
+
this.cache = (0, cache_1.getCache)(this.options);
|
32
32
|
this.forkedProcessTaskRunner = new forked_process_task_runner_1.ForkedProcessTaskRunner(this.options);
|
33
33
|
this.tasksSchedule = new tasks_schedule_1.TasksSchedule(this.projectGraph, this.taskGraph, this.options);
|
34
34
|
// region internal state
|
@@ -7,6 +7,9 @@ export interface RawNxArgs extends NxArgs {
|
|
7
7
|
export interface NxArgs {
|
8
8
|
targets?: string[];
|
9
9
|
configuration?: string;
|
10
|
+
/**
|
11
|
+
* @deprecated Custom task runners will no longer be supported in Nx 21. Use Nx Cloud or Nx Powerpack instead.
|
12
|
+
*/
|
10
13
|
runner?: string;
|
11
14
|
parallel?: number;
|
12
15
|
untracked?: boolean;
|
@@ -139,41 +139,32 @@ function readParallelFromArgsAndEnv(args) {
|
|
139
139
|
}
|
140
140
|
function normalizeNxArgsRunner(nxArgs, nxJson, options) {
|
141
141
|
if (!nxArgs.runner) {
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
if (options.printWarnings) {
|
148
|
-
if (runnerExists) {
|
149
|
-
output_1.output.note({
|
150
|
-
title: `No explicit --runner argument provided, but found environment variable ${envKey} so using its value: ${output_1.output.bold(`${runner}`)}`,
|
151
|
-
});
|
152
|
-
}
|
153
|
-
else if (nxArgs.verbose ||
|
154
|
-
process.env.NX_VERBOSE_LOGGING === 'true') {
|
155
|
-
output_1.output.warn({
|
156
|
-
title: `Could not find ${output_1.output.bold(`${runner}`)} within \`nx.json\` tasksRunnerOptions.`,
|
157
|
-
bodyLines: [
|
158
|
-
`${output_1.output.bold(`${runner}`)} was set by ${envKey}`,
|
159
|
-
``,
|
160
|
-
`To suppress this message, either:`,
|
161
|
-
` - provide a valid task runner with --runner`,
|
162
|
-
` - ensure NX_TASKS_RUNNER matches a task runner defined in nx.json`,
|
163
|
-
],
|
164
|
-
});
|
165
|
-
}
|
166
|
-
}
|
142
|
+
const envKey = 'NX_TASKS_RUNNER';
|
143
|
+
const runner = process.env[envKey];
|
144
|
+
if (runner) {
|
145
|
+
const runnerExists = nxJson.tasksRunnerOptions?.[runner];
|
146
|
+
if (options.printWarnings) {
|
167
147
|
if (runnerExists) {
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
title: 'NX_RUNNER is deprecated, please use NX_TASKS_RUNNER instead.',
|
172
|
-
});
|
173
|
-
}
|
174
|
-
nxArgs.runner = runner;
|
148
|
+
output_1.output.note({
|
149
|
+
title: `No explicit --runner argument provided, but found environment variable ${envKey} so using its value: ${output_1.output.bold(`${runner}`)}`,
|
150
|
+
});
|
175
151
|
}
|
176
|
-
|
152
|
+
else if (nxArgs.verbose ||
|
153
|
+
process.env.NX_VERBOSE_LOGGING === 'true') {
|
154
|
+
output_1.output.warn({
|
155
|
+
title: `Could not find ${output_1.output.bold(`${runner}`)} within \`nx.json\` tasksRunnerOptions.`,
|
156
|
+
bodyLines: [
|
157
|
+
`${output_1.output.bold(`${runner}`)} was set by ${envKey}`,
|
158
|
+
``,
|
159
|
+
`To suppress this message, either:`,
|
160
|
+
` - provide a valid task runner with --runner`,
|
161
|
+
` - ensure NX_TASKS_RUNNER matches a task runner defined in nx.json`,
|
162
|
+
],
|
163
|
+
});
|
164
|
+
}
|
165
|
+
}
|
166
|
+
if (runnerExists) {
|
167
|
+
nxArgs.runner = runner;
|
177
168
|
}
|
178
169
|
}
|
179
170
|
}
|
package/src/utils/git-utils.js
CHANGED
@@ -8,7 +8,7 @@ exports.commitChanges = commitChanges;
|
|
8
8
|
exports.getLatestCommitSha = getLatestCommitSha;
|
9
9
|
const child_process_1 = require("child_process");
|
10
10
|
const path_1 = require("path");
|
11
|
-
const
|
11
|
+
const logger_1 = require("./logger");
|
12
12
|
function execAsync(command, execOptions) {
|
13
13
|
return new Promise((res, rej) => {
|
14
14
|
(0, child_process_1.exec)(command, execOptions, (err, stdout, stderr) => {
|
@@ -236,7 +236,7 @@ function commitChanges(commitMessage, directory) {
|
|
236
236
|
// We don't want to throw during create-nx-workspace
|
237
237
|
// because maybe there was an error when setting up git
|
238
238
|
// initially.
|
239
|
-
|
239
|
+
logger_1.logger.verbose(`Git may not be set up correctly for this new workspace.
|
240
240
|
${err}`);
|
241
241
|
}
|
242
242
|
else {
|
@@ -20,7 +20,7 @@ function tryGetCollection(packageJsonPath, collectionFile, propName) {
|
|
20
20
|
}
|
21
21
|
async function getPluginCapabilities(workspaceRoot, pluginName, projects, includeRuntimeCapabilities = false) {
|
22
22
|
try {
|
23
|
-
const { json: packageJson, path: packageJsonPath } =
|
23
|
+
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(pluginName, projects, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot));
|
24
24
|
const pluginModule = includeRuntimeCapabilities
|
25
25
|
? await tryGetModule(packageJson, workspaceRoot)
|
26
26
|
: {};
|
@@ -62,8 +62,7 @@ async function tryGetModule(packageJson, workspaceRoot) {
|
|
62
62
|
packageJson['schematics'] ??
|
63
63
|
packageJson['builders']) {
|
64
64
|
const [pluginPromise] = (0, loader_1.loadNxPlugin)(packageJson.name, workspaceRoot);
|
65
|
-
|
66
|
-
return plugin;
|
65
|
+
return await pluginPromise;
|
67
66
|
}
|
68
67
|
else {
|
69
68
|
return {
|
@@ -1,49 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = default_1;
|
4
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
5
|
-
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
6
|
-
const nx_json_1 = require("../../generators/utils/nx-json");
|
7
|
-
const path_1 = require("path");
|
8
|
-
const utils_1 = require("../../tasks-runner/utils");
|
9
|
-
const json_1 = require("../../generators/utils/json");
|
10
|
-
async function default_1(tree) {
|
11
|
-
// If the workspace doesn't have a nx.json, don't make any changes
|
12
|
-
if (!tree.exists('nx.json')) {
|
13
|
-
return;
|
14
|
-
}
|
15
|
-
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
16
|
-
for (const [projectName, project] of (0, project_configuration_1.getProjects)(tree)) {
|
17
|
-
for (const [_, target] of Object.entries(project.targets ?? {})) {
|
18
|
-
if (!target.outputs) {
|
19
|
-
continue;
|
20
|
-
}
|
21
|
-
target.outputs = (0, utils_1.transformLegacyOutputs)(project.root, target.outputs);
|
22
|
-
}
|
23
|
-
try {
|
24
|
-
(0, project_configuration_1.updateProjectConfiguration)(tree, projectName, project);
|
25
|
-
}
|
26
|
-
catch {
|
27
|
-
if (tree.exists((0, path_1.join)(project.root, 'package.json'))) {
|
28
|
-
(0, json_1.updateJson)(tree, (0, path_1.join)(project.root, 'package.json'), (json) => {
|
29
|
-
for (const target of Object.values(json.nx?.targets ?? {})) {
|
30
|
-
if (target.outputs) {
|
31
|
-
target.outputs = (0, utils_1.transformLegacyOutputs)(project.root, target.outputs);
|
32
|
-
}
|
33
|
-
}
|
34
|
-
return json;
|
35
|
-
});
|
36
|
-
}
|
37
|
-
}
|
38
|
-
}
|
39
|
-
if (nxJson.targetDefaults) {
|
40
|
-
for (const [_, target] of Object.entries(nxJson.targetDefaults)) {
|
41
|
-
if (!target.outputs) {
|
42
|
-
continue;
|
43
|
-
}
|
44
|
-
target.outputs = (0, utils_1.transformLegacyOutputs)('{projectRoot}', target.outputs);
|
45
|
-
}
|
46
|
-
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
47
|
-
}
|
48
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
49
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = default_1;
|
4
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
5
|
-
const json_1 = require("../../generators/utils/json");
|
6
|
-
async function default_1(tree) {
|
7
|
-
(0, json_1.updateJson)(tree, 'package.json', (json) => {
|
8
|
-
for (const deps of [json.dependencies, json.devDependencies]) {
|
9
|
-
if (deps) {
|
10
|
-
delete deps['@nrwl/cli'];
|
11
|
-
}
|
12
|
-
}
|
13
|
-
return json;
|
14
|
-
});
|
15
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
16
|
-
}
|