nx 17.0.0-beta.1 → 17.0.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/migrations.json +6 -0
- package/package.json +12 -12
- package/src/command-line/affected/print-affected.js +1 -1
- package/src/command-line/examples.js +0 -1
- package/src/command-line/generate/command-object.d.ts +0 -4
- package/src/command-line/generate/command-object.js +1 -16
- package/src/command-line/generate/generate.d.ts +0 -7
- package/src/command-line/generate/generate.js +1 -28
- package/src/command-line/nx-commands.js +0 -1
- package/src/config/task-graph.d.ts +4 -0
- package/src/devkit-internals.d.ts +1 -0
- package/src/devkit-internals.js +4 -1
- package/src/hasher/task-hasher.js +1 -1
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +2 -0
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +62 -0
- package/src/tasks-runner/create-task-graph.js +3 -1
- package/src/tasks-runner/init-tasks-runner.js +7 -0
- package/src/tasks-runner/task-orchestrator.js +3 -3
- package/src/tasks-runner/utils.d.ts +4 -5
- package/src/tasks-runner/utils.js +9 -20
- package/src/utils/params.js +1 -1
package/migrations.json
CHANGED
|
@@ -65,6 +65,12 @@
|
|
|
65
65
|
"version": "17.0.0-beta.1",
|
|
66
66
|
"description": "Updates the default cache directory to .nx/cache",
|
|
67
67
|
"implementation": "./src/migrations/update-17-0-0/move-cache-directory"
|
|
68
|
+
},
|
|
69
|
+
"17.0.0-use-minimal-config-for-tasks-runner-options": {
|
|
70
|
+
"cli": "nx",
|
|
71
|
+
"version": "17.0.0-beta.2",
|
|
72
|
+
"description": "Use minimal config for tasksRunnerOptions",
|
|
73
|
+
"implementation": "./src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options"
|
|
68
74
|
}
|
|
69
75
|
}
|
|
70
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "17.0.0-beta.
|
|
3
|
+
"version": "17.0.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": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"yargs": "^17.6.2",
|
|
68
68
|
"yargs-parser": "21.1.1",
|
|
69
69
|
"node-machine-id": "1.1.12",
|
|
70
|
-
"@nrwl/tao": "17.0.0-beta.
|
|
70
|
+
"@nrwl/tao": "17.0.0-beta.2"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"@swc-node/register": "^1.6.7",
|
|
@@ -82,16 +82,16 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"optionalDependencies": {
|
|
85
|
-
"@nx/nx-darwin-x64": "17.0.0-beta.
|
|
86
|
-
"@nx/nx-darwin-arm64": "17.0.0-beta.
|
|
87
|
-
"@nx/nx-linux-x64-gnu": "17.0.0-beta.
|
|
88
|
-
"@nx/nx-linux-x64-musl": "17.0.0-beta.
|
|
89
|
-
"@nx/nx-win32-x64-msvc": "17.0.0-beta.
|
|
90
|
-
"@nx/nx-linux-arm64-gnu": "17.0.0-beta.
|
|
91
|
-
"@nx/nx-linux-arm64-musl": "17.0.0-beta.
|
|
92
|
-
"@nx/nx-linux-arm-gnueabihf": "17.0.0-beta.
|
|
93
|
-
"@nx/nx-win32-arm64-msvc": "17.0.0-beta.
|
|
94
|
-
"@nx/nx-freebsd-x64": "17.0.0-beta.
|
|
85
|
+
"@nx/nx-darwin-x64": "17.0.0-beta.2",
|
|
86
|
+
"@nx/nx-darwin-arm64": "17.0.0-beta.2",
|
|
87
|
+
"@nx/nx-linux-x64-gnu": "17.0.0-beta.2",
|
|
88
|
+
"@nx/nx-linux-x64-musl": "17.0.0-beta.2",
|
|
89
|
+
"@nx/nx-win32-x64-msvc": "17.0.0-beta.2",
|
|
90
|
+
"@nx/nx-linux-arm64-gnu": "17.0.0-beta.2",
|
|
91
|
+
"@nx/nx-linux-arm64-musl": "17.0.0-beta.2",
|
|
92
|
+
"@nx/nx-linux-arm-gnueabihf": "17.0.0-beta.2",
|
|
93
|
+
"@nx/nx-win32-arm64-msvc": "17.0.0-beta.2",
|
|
94
|
+
"@nx/nx-freebsd-x64": "17.0.0-beta.2"
|
|
95
95
|
},
|
|
96
96
|
"nx-migrations": {
|
|
97
97
|
"migrations": "./migrations.json",
|
|
@@ -47,7 +47,7 @@ async function createTasks(affectedProjectsWithTargetAndConfig, projectGraph, nx
|
|
|
47
47
|
target: task.target,
|
|
48
48
|
hash: task.hash,
|
|
49
49
|
command: (0, utils_1.getCommandAsString)(execCommand, task),
|
|
50
|
-
outputs:
|
|
50
|
+
outputs: task.outputs,
|
|
51
51
|
}));
|
|
52
52
|
}
|
|
53
53
|
function serializeProjectGraph(projectGraph) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.yargsGenerateCommand = void 0;
|
|
4
4
|
const path_1 = require("../../utils/path");
|
|
5
|
-
const documentation_1 = require("../yargs-utils/documentation");
|
|
6
5
|
exports.yargsGenerateCommand = {
|
|
7
6
|
command: 'generate <generator> [_..]',
|
|
8
7
|
describe: 'Generate or update source code (e.g., nx generate @nx/js:lib mylib).',
|
|
@@ -14,20 +13,6 @@ exports.yargsGenerateCommand = {
|
|
|
14
13
|
process.exit(await (await Promise.resolve().then(() => require('./generate'))).generate((0, path_1.getCwd)(), args));
|
|
15
14
|
},
|
|
16
15
|
};
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated(v17): Remove `workspace-generator in v17. Use local plugins.
|
|
19
|
-
*/
|
|
20
|
-
exports.yargsWorkspaceGeneratorCommand = {
|
|
21
|
-
command: 'workspace-generator [generator]',
|
|
22
|
-
describe: 'Runs a workspace generator from the tools/generators directory',
|
|
23
|
-
deprecated: 'Use a local plugin instead. See: https://nx.dev/deprecated/workspace-generators',
|
|
24
|
-
aliases: ['workspace-schematic [schematic]'],
|
|
25
|
-
builder: async (yargs) => (0, documentation_1.linkToNxDevAndExamples)(withGenerateOptions(yargs), 'workspace-generator'),
|
|
26
|
-
handler: async (args) => {
|
|
27
|
-
await (await Promise.resolve().then(() => require('./generate'))).workspaceGenerators(args);
|
|
28
|
-
process.exit(0);
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
16
|
function withGenerateOptions(yargs) {
|
|
32
17
|
const generatorWillShowHelp = process.argv[3] && !process.argv[3].startsWith('-');
|
|
33
18
|
const res = yargs
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FileChange } from '../../generators/tree';
|
|
2
2
|
import { Options, Schema } from '../../utils/params';
|
|
3
|
-
import type { Arguments } from 'yargs';
|
|
4
3
|
export interface GenerateOptions {
|
|
5
4
|
collectionName: string;
|
|
6
5
|
generatorName: string;
|
|
@@ -20,9 +19,3 @@ export declare function printGenHelp(opts: GenerateOptions, schema: Schema, norm
|
|
|
20
19
|
export declare function generate(cwd: string, args: {
|
|
21
20
|
[k: string]: any;
|
|
22
21
|
}): Promise<any>;
|
|
23
|
-
/**
|
|
24
|
-
* Wraps `workspace-generator` to invoke `generate`.
|
|
25
|
-
*
|
|
26
|
-
* @deprecated(v17): Remove `workspace-generator in v17. Use local plugins.
|
|
27
|
-
*/
|
|
28
|
-
export declare function workspaceGenerators(args: Arguments): Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.generate = exports.printGenHelp = exports.parseGeneratorString = exports.printChanges = void 0;
|
|
4
4
|
const chalk = require("chalk");
|
|
5
5
|
const enquirer_1 = require("enquirer");
|
|
6
6
|
const path_1 = require("path");
|
|
@@ -14,7 +14,6 @@ const print_help_1 = require("../../utils/print-help");
|
|
|
14
14
|
const workspace_root_1 = require("../../utils/workspace-root");
|
|
15
15
|
const calculate_default_project_name_1 = require("../../config/calculate-default-project-name");
|
|
16
16
|
const installed_plugins_1 = require("../../utils/plugins/installed-plugins");
|
|
17
|
-
const output_1 = require("../../utils/output");
|
|
18
17
|
const generator_utils_1 = require("./generator-utils");
|
|
19
18
|
function printChanges(fileChanges) {
|
|
20
19
|
fileChanges.forEach((f) => {
|
|
@@ -272,29 +271,3 @@ async function generate(cwd, args) {
|
|
|
272
271
|
});
|
|
273
272
|
}
|
|
274
273
|
exports.generate = generate;
|
|
275
|
-
/**
|
|
276
|
-
* Wraps `workspace-generator` to invoke `generate`.
|
|
277
|
-
*
|
|
278
|
-
* @deprecated(v17): Remove `workspace-generator in v17. Use local plugins.
|
|
279
|
-
*/
|
|
280
|
-
async function workspaceGenerators(args) {
|
|
281
|
-
const generator = process.argv.slice(3);
|
|
282
|
-
output_1.output.warn({
|
|
283
|
-
title: `Workspace Generators are no longer supported`,
|
|
284
|
-
bodyLines: [
|
|
285
|
-
'Instead, Nx now supports executing generators or executors from ',
|
|
286
|
-
'local plugins. To run a generator from a local plugin, ',
|
|
287
|
-
'use `nx generate` like you would with any other generator.',
|
|
288
|
-
'',
|
|
289
|
-
'For more information, see: https://nx.dev/deprecated/workspace-generators',
|
|
290
|
-
],
|
|
291
|
-
});
|
|
292
|
-
const nxJson = (0, configuration_1.readNxJson)();
|
|
293
|
-
const collection = nxJson.npmScope
|
|
294
|
-
? `@${nxJson.npmScope}/workspace-plugin`
|
|
295
|
-
: 'workspace-plugin';
|
|
296
|
-
args._ = args._.slice(1);
|
|
297
|
-
args.generator = `${collection}:${generator}`;
|
|
298
|
-
return generate(process.cwd(), args);
|
|
299
|
-
}
|
|
300
|
-
exports.workspaceGenerators = workspaceGenerators;
|
|
@@ -67,7 +67,6 @@ exports.commandsObject = yargs
|
|
|
67
67
|
.command(command_object_16.yargsShowCommand)
|
|
68
68
|
.command(command_object_2.yargsViewLogsCommand)
|
|
69
69
|
.command(command_object_17.yargsWatchCommand)
|
|
70
|
-
.command(command_object_7.yargsWorkspaceGeneratorCommand)
|
|
71
70
|
.command(command_object_18.yargsWorkspaceLintCommand)
|
|
72
71
|
.scriptName('nx')
|
|
73
72
|
.help()
|
|
@@ -14,3 +14,4 @@ export { sortObjectByKeys } from './utils/object-sort';
|
|
|
14
14
|
export { stripIndent } from './utils/logger';
|
|
15
15
|
export { readModulePackageJson } from './utils/package-json';
|
|
16
16
|
export { splitByColons } from './utils/split-target';
|
|
17
|
+
export { createProjectRootMappingsFromProjectConfigurations, findProjectForPath, } from './project-graph/utils/find-project-for-path';
|
package/src/devkit-internals.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.splitByColons = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
|
|
3
|
+
exports.findProjectForPath = exports.createProjectRootMappingsFromProjectConfigurations = exports.splitByColons = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Note to developers: STOP! These exports are available via requireNx in @nx/devkit.
|
|
6
6
|
*
|
|
@@ -28,3 +28,6 @@ var package_json_1 = require("./utils/package-json");
|
|
|
28
28
|
Object.defineProperty(exports, "readModulePackageJson", { enumerable: true, get: function () { return package_json_1.readModulePackageJson; } });
|
|
29
29
|
var split_target_2 = require("./utils/split-target");
|
|
30
30
|
Object.defineProperty(exports, "splitByColons", { enumerable: true, get: function () { return split_target_2.splitByColons; } });
|
|
31
|
+
var find_project_for_path_1 = require("./project-graph/utils/find-project-for-path");
|
|
32
|
+
Object.defineProperty(exports, "createProjectRootMappingsFromProjectConfigurations", { enumerable: true, get: function () { return find_project_for_path_1.createProjectRootMappingsFromProjectConfigurations; } });
|
|
33
|
+
Object.defineProperty(exports, "findProjectForPath", { enumerable: true, get: function () { return find_project_for_path_1.findProjectForPath; } });
|
|
@@ -195,7 +195,7 @@ class TaskHasherImpl {
|
|
|
195
195
|
const partialHashes = [];
|
|
196
196
|
for (const d of taskGraph.dependencies[task.id]) {
|
|
197
197
|
const childTask = taskGraph.tasks[d];
|
|
198
|
-
const outputs = (0, utils_1.getOutputsForTargetAndConfiguration)(childTask, this.projectGraph.nodes[childTask.target.project]);
|
|
198
|
+
const outputs = (0, utils_1.getOutputsForTargetAndConfiguration)(childTask.target, childTask.overrides, this.projectGraph.nodes[childTask.target.project]);
|
|
199
199
|
const { getFilesForOutputs } = require('../native');
|
|
200
200
|
const outputFiles = getFilesForOutputs(workspace_root_1.workspaceRoot, outputs);
|
|
201
201
|
const filteredFiles = outputFiles.filter((p) => p === dependentTasksOutputFiles ||
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const json_1 = require("../../generators/utils/json");
|
|
4
|
+
async function migrate(tree) {
|
|
5
|
+
if (!tree.exists('nx.json')) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
(0, json_1.updateJson)(tree, 'nx.json', (nxJson) => {
|
|
9
|
+
// Already migrated
|
|
10
|
+
if (!nxJson.tasksRunnerOptions?.default) {
|
|
11
|
+
return nxJson;
|
|
12
|
+
}
|
|
13
|
+
const { runner, options } = nxJson.tasksRunnerOptions.default;
|
|
14
|
+
// This property shouldn't ever be part of tasks runner options.
|
|
15
|
+
if (options.useDaemonProcess !== undefined) {
|
|
16
|
+
nxJson.useDaemonProcess = options.useDaemonProcess;
|
|
17
|
+
delete options.useDaemonProcess;
|
|
18
|
+
}
|
|
19
|
+
// Remaining keys may be specific to a given runner, so leave them alone if there are multiple runners.
|
|
20
|
+
if (Object.keys(nxJson.tasksRunnerOptions ?? {}).length > 1) {
|
|
21
|
+
return nxJson;
|
|
22
|
+
}
|
|
23
|
+
// These options can only be moved for nx-cloud.
|
|
24
|
+
if (runner === 'nx-cloud' || runner === '@nrwl/nx-cloud') {
|
|
25
|
+
nxJson.nxCloudAccessToken = options.accessToken;
|
|
26
|
+
delete options.accessToken;
|
|
27
|
+
if (options.url) {
|
|
28
|
+
nxJson.nxCloudUrl = options.url;
|
|
29
|
+
delete options.url;
|
|
30
|
+
}
|
|
31
|
+
if (options.encryptionKey) {
|
|
32
|
+
nxJson.nxCloudEncryptionKey = options.encryptionKey;
|
|
33
|
+
delete options.encryptionKey;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// These options should be safe to move for all tasks runners:
|
|
37
|
+
if (options.parallel !== undefined) {
|
|
38
|
+
nxJson.parallel = options.parallel;
|
|
39
|
+
delete options.parallel;
|
|
40
|
+
}
|
|
41
|
+
if (options.cacheDirectory !== undefined) {
|
|
42
|
+
nxJson.cacheDirectory = options.cacheDirectory;
|
|
43
|
+
delete options.cacheDirectory;
|
|
44
|
+
}
|
|
45
|
+
if (Array.isArray(options.cacheableOperations)) {
|
|
46
|
+
nxJson.targetDefaults ??= {};
|
|
47
|
+
for (const target of options.cacheableOperations) {
|
|
48
|
+
nxJson.targetDefaults[target] ??= {};
|
|
49
|
+
nxJson.targetDefaults[target].cache ??= true;
|
|
50
|
+
}
|
|
51
|
+
delete options.cacheableOperations;
|
|
52
|
+
}
|
|
53
|
+
if (['nx-cloud', '@nrwl/nx-cloud', 'nx/tasks-runners/default'].includes(runner)) {
|
|
54
|
+
delete nxJson.tasksRunnerOptions.default.runner;
|
|
55
|
+
if (Object.values(options).length === 0) {
|
|
56
|
+
delete nxJson.tasksRunnerOptions;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return nxJson;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
exports.default = migrate;
|
|
@@ -163,11 +163,13 @@ class ProcessTasks {
|
|
|
163
163
|
target,
|
|
164
164
|
configuration: resolvedConfiguration,
|
|
165
165
|
};
|
|
166
|
+
const interpolatedOverrides = interpolateOverrides(overrides, project.name, project.data);
|
|
166
167
|
return {
|
|
167
168
|
id,
|
|
168
169
|
target: qualifiedTarget,
|
|
169
170
|
projectRoot: project.data.root,
|
|
170
|
-
overrides:
|
|
171
|
+
overrides: interpolatedOverrides,
|
|
172
|
+
outputs: (0, utils_1.getOutputs)(this.projectGraph.nodes, qualifiedTarget, interpolatedOverrides),
|
|
171
173
|
// TODO(v18): Remove cast here after typing is moved back onto TargetConfiguration
|
|
172
174
|
cache: project.data.targets[target].cache,
|
|
173
175
|
};
|
|
@@ -7,6 +7,7 @@ const project_graph_1 = require("../project-graph/project-graph");
|
|
|
7
7
|
const run_command_1 = require("./run-command");
|
|
8
8
|
const invoke_runner_terminal_output_life_cycle_1 = require("./life-cycles/invoke-runner-terminal-output-life-cycle");
|
|
9
9
|
const perf_hooks_1 = require("perf_hooks");
|
|
10
|
+
const utils_1 = require("./utils");
|
|
10
11
|
async function initTasksRunner(nxArgs) {
|
|
11
12
|
perf_hooks_1.performance.mark('init-local');
|
|
12
13
|
(0, workspace_configuration_check_1.workspaceConfigurationCheck)();
|
|
@@ -18,6 +19,12 @@ async function initTasksRunner(nxArgs) {
|
|
|
18
19
|
return {
|
|
19
20
|
invoke: async (opts) => {
|
|
20
21
|
perf_hooks_1.performance.mark('code-loading:end');
|
|
22
|
+
// TODO: This polyfills the outputs if someone doesn't pass a task with outputs. Remove this in Nx 18
|
|
23
|
+
opts.tasks.forEach((t) => {
|
|
24
|
+
if (!t.outputs) {
|
|
25
|
+
t.outputs = (0, utils_1.getOutputs)(projectGraph.nodes, t.target, t.overrides);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
21
28
|
const lifeCycle = new invoke_runner_terminal_output_life_cycle_1.InvokeRunnerTerminalOutputLifeCycle(opts.tasks);
|
|
22
29
|
const taskGraph = {
|
|
23
30
|
roots: opts.tasks.map((task) => task.id),
|
|
@@ -81,7 +81,7 @@ class TaskOrchestrator {
|
|
|
81
81
|
const cachedResult = await this.cache.get(task);
|
|
82
82
|
if (!cachedResult || cachedResult.code !== 0)
|
|
83
83
|
return null;
|
|
84
|
-
const outputs =
|
|
84
|
+
const outputs = task.outputs;
|
|
85
85
|
const shouldCopyOutputsFromCache = !!outputs.length &&
|
|
86
86
|
(await this.shouldCopyOutputsFromCache(outputs, task.hash));
|
|
87
87
|
if (shouldCopyOutputsFromCache) {
|
|
@@ -232,7 +232,7 @@ class TaskOrchestrator {
|
|
|
232
232
|
result.status === 'success'
|
|
233
233
|
? 0
|
|
234
234
|
: 1,
|
|
235
|
-
outputs:
|
|
235
|
+
outputs: result.task.outputs,
|
|
236
236
|
}))
|
|
237
237
|
.filter(({ task, code }) => this.shouldCacheTaskResult(task, code))
|
|
238
238
|
.filter(({ terminalOutput, outputs }) => terminalOutput || outputs)
|
|
@@ -325,7 +325,7 @@ class TaskOrchestrator {
|
|
|
325
325
|
}
|
|
326
326
|
async recordOutputsHash(task) {
|
|
327
327
|
if (this.daemon?.enabled()) {
|
|
328
|
-
return this.daemon.recordOutputsHash(
|
|
328
|
+
return this.daemon.recordOutputsHash(task.outputs, task.hash);
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
}
|
|
@@ -8,7 +8,7 @@ export declare function getDependencyConfigs({ project, target }: {
|
|
|
8
8
|
target: string;
|
|
9
9
|
}, defaultDependencyConfigs: Record<string, (TargetDependencyConfig | string)[]>, projectGraph: ProjectGraph): TargetDependencyConfig[] | undefined;
|
|
10
10
|
export declare function expandDependencyConfigSyntaxSugar(dependencyConfigString: string, graph: ProjectGraph): TargetDependencyConfig;
|
|
11
|
-
export declare function getOutputs(p: Record<string, ProjectGraphProjectNode>,
|
|
11
|
+
export declare function getOutputs(p: Record<string, ProjectGraphProjectNode>, target: Task['target'], overrides: Task['overrides']): string[];
|
|
12
12
|
declare class InvalidOutputsError extends Error {
|
|
13
13
|
outputs: string[];
|
|
14
14
|
invalidOutputs: Set<string>;
|
|
@@ -18,11 +18,10 @@ declare class InvalidOutputsError extends Error {
|
|
|
18
18
|
export declare function validateOutputs(outputs: string[]): void;
|
|
19
19
|
export declare function transformLegacyOutputs(projectRoot: string, error: InvalidOutputsError): string[];
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @param task target + overrides
|
|
23
|
-
* @param node ProjectGraphProjectNode object that the task runs against
|
|
21
|
+
* @deprecated Pass the target and overrides instead. This will be removed in v18.
|
|
24
22
|
*/
|
|
25
|
-
export declare function getOutputsForTargetAndConfiguration(task:
|
|
23
|
+
export declare function getOutputsForTargetAndConfiguration(task: Task, node: ProjectGraphProjectNode): string[];
|
|
24
|
+
export declare function getOutputsForTargetAndConfiguration(target: Task['target'] | Task, overrides: Task['overrides'] | ProjectGraphProjectNode, node: ProjectGraphProjectNode): string[];
|
|
26
25
|
export declare function interpolate(template: string, data: any): string;
|
|
27
26
|
export declare function getExecutorNameForTask(task: Task, projectGraph: ProjectGraph): Promise<string>;
|
|
28
27
|
export declare function getExecutorForTask(task: Task, projectGraph: ProjectGraph): Promise<import("../config/misc-interfaces").ExecutorConfig & {
|
|
@@ -62,8 +62,8 @@ function expandDependencyConfigSyntaxSugar(dependencyConfigString, graph) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
exports.expandDependencyConfigSyntaxSugar = expandDependencyConfigSyntaxSugar;
|
|
65
|
-
function getOutputs(p,
|
|
66
|
-
return getOutputsForTargetAndConfiguration(
|
|
65
|
+
function getOutputs(p, target, overrides) {
|
|
66
|
+
return getOutputsForTargetAndConfiguration(target, overrides, p[target.project]);
|
|
67
67
|
}
|
|
68
68
|
exports.getOutputs = getOutputs;
|
|
69
69
|
class InvalidOutputsError extends Error {
|
|
@@ -104,31 +104,20 @@ function transformLegacyOutputs(projectRoot, error) {
|
|
|
104
104
|
exports.transformLegacyOutputs = transformLegacyOutputs;
|
|
105
105
|
/**
|
|
106
106
|
* Returns the list of outputs that will be cached.
|
|
107
|
-
* @param task target + overrides
|
|
108
|
-
* @param node ProjectGraphProjectNode object that the task runs against
|
|
109
107
|
*/
|
|
110
|
-
function getOutputsForTargetAndConfiguration(
|
|
111
|
-
const
|
|
108
|
+
function getOutputsForTargetAndConfiguration(taskTargetOrTask, overridesOrNode, node) {
|
|
109
|
+
const taskTarget = 'id' in taskTargetOrTask ? taskTargetOrTask.target : taskTargetOrTask;
|
|
110
|
+
const overrides = 'id' in taskTargetOrTask ? taskTargetOrTask.overrides : overridesOrNode;
|
|
111
|
+
node = 'id' in taskTargetOrTask ? overridesOrNode : node;
|
|
112
|
+
const { target, configuration } = taskTarget;
|
|
112
113
|
const targetConfiguration = node.data.targets[target];
|
|
113
114
|
const options = {
|
|
114
115
|
...targetConfiguration.options,
|
|
115
116
|
...targetConfiguration?.configurations?.[configuration],
|
|
116
|
-
...
|
|
117
|
+
...overrides,
|
|
117
118
|
};
|
|
118
119
|
if (targetConfiguration?.outputs) {
|
|
119
|
-
|
|
120
|
-
validateOutputs(targetConfiguration.outputs);
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
if (error instanceof InvalidOutputsError) {
|
|
124
|
-
// TODO(@FrozenPandaz): In v17, throw this error and do not transform.
|
|
125
|
-
console.warn(error.message);
|
|
126
|
-
targetConfiguration.outputs = transformLegacyOutputs(node.data.root, error);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
throw error;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
120
|
+
validateOutputs(targetConfiguration.outputs);
|
|
132
121
|
return targetConfiguration.outputs
|
|
133
122
|
.map((output) => {
|
|
134
123
|
return interpolate(output, {
|
package/src/utils/params.js
CHANGED
|
@@ -426,11 +426,11 @@ async function combineOptionsForGenerator(commandLineOpts, collectionName, gener
|
|
|
426
426
|
? getGeneratorDefaults(defaultProjectName, projectsConfigurations, nxJsonConfiguration, collectionName, generatorName)
|
|
427
427
|
: {};
|
|
428
428
|
let combined = convertAliases(coerceTypesInOptions({ ...generatorDefaults, ...commandLineOpts }, schema), schema, false);
|
|
429
|
+
warnDeprecations(combined, schema);
|
|
429
430
|
convertSmartDefaultsIntoNamedParams(combined, schema, defaultProjectName, relativeCwd);
|
|
430
431
|
if (isInteractive && isTTY()) {
|
|
431
432
|
combined = await promptForValues(combined, schema, projectsConfigurations);
|
|
432
433
|
}
|
|
433
|
-
warnDeprecations(combined, schema);
|
|
434
434
|
setDefaults(combined, schema);
|
|
435
435
|
validateOptsAgainstSchema(combined, schema);
|
|
436
436
|
applyVerbosity(combined, schema, isVerbose);
|