nx 20.0.0-beta.5 → 20.0.0-beta.7
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.json +12 -2
- package/migrations.json +0 -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/command-line/add/add.js +2 -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/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/yargs-utils/shared-options.js +2 -2
- package/src/config/nx-json.d.ts +2 -1
- package/src/config/workspace-json-project-json.d.ts +14 -0
- package/src/core/graph/main.js +1 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- 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/project-graph/file-utils.d.ts +2 -2
- package/src/project-graph/file-utils.js +2 -2
- package/src/tasks-runner/cache.d.ts +2 -1
- package/src/tasks-runner/cache.js +10 -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/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/git-utils.js +2 -2
- 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
Binary file
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createApiAxiosInstance = createApiAxiosInstance;
|
4
4
|
const path_1 = require("path");
|
5
5
|
const environment_1 = require("./environment");
|
6
|
-
const axios = require('axios');
|
7
6
|
function createApiAxiosInstance(options) {
|
8
7
|
let axiosConfigBuilder = (axiosConfig) => axiosConfig;
|
9
8
|
const baseUrl = process.env.NX_CLOUD_API || options.url || 'https://cloud.nx.app';
|
@@ -17,7 +16,7 @@ function createApiAxiosInstance(options) {
|
|
17
16
|
const { nxCloudProxyConfig } = require((0, path_1.join)(process.cwd(), options.customProxyConfigPath));
|
18
17
|
axiosConfigBuilder = nxCloudProxyConfig ?? axiosConfigBuilder;
|
19
18
|
}
|
20
|
-
return axios.create(axiosConfigBuilder({
|
19
|
+
return require('axios').create(axiosConfigBuilder({
|
21
20
|
baseURL: baseUrl,
|
22
21
|
timeout: environment_1.NX_CLOUD_NO_TIMEOUTS ? environment_1.UNLIMITED_TIMEOUT : 10000,
|
23
22
|
headers: { authorization: accessToken },
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNxCloudOnboardingURLForWelcomeApp = createNxCloudOnboardingURLForWelcomeApp;
|
4
4
|
exports.getNxCloudAppOnBoardingUrl = getNxCloudAppOnBoardingUrl;
|
5
5
|
exports.readNxCloudToken = readNxCloudToken;
|
6
|
-
const devkit_exports_1 = require("../../devkit-exports");
|
7
6
|
const is_workspace_claimed_1 = require("./is-workspace-claimed");
|
8
7
|
const url_shorten_1 = require("./url-shorten");
|
9
8
|
const run_command_1 = require("../../tasks-runner/run-command");
|
9
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
10
10
|
async function createNxCloudOnboardingURLForWelcomeApp(tree, token) {
|
11
11
|
token = token || readNxCloudToken(tree);
|
12
12
|
if (!token) {
|
@@ -22,7 +22,7 @@ async function getNxCloudAppOnBoardingUrl(token) {
|
|
22
22
|
return onboardingUrl;
|
23
23
|
}
|
24
24
|
function readNxCloudToken(tree) {
|
25
|
-
const nxJson = (0,
|
25
|
+
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
26
26
|
const { accessToken, nxCloudId } = (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);
|
27
27
|
return accessToken || nxCloudId;
|
28
28
|
}
|
@@ -7,7 +7,7 @@ exports.getNxCloudVersion = getNxCloudVersion;
|
|
7
7
|
exports.removeVersionModifier = removeVersionModifier;
|
8
8
|
exports.versionIsValid = versionIsValid;
|
9
9
|
exports.compareCleanCloudVersions = compareCleanCloudVersions;
|
10
|
-
const
|
10
|
+
const logger_1 = require("../../utils/logger");
|
11
11
|
const git_utils_1 = require("../../utils/git-utils");
|
12
12
|
const get_cloud_options_1 = require("./get-cloud-options");
|
13
13
|
/**
|
@@ -27,7 +27,7 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
|
|
27
27
|
}
|
28
28
|
}
|
29
29
|
catch (e) {
|
30
|
-
|
30
|
+
logger_1.logger.verbose(`Failed to get Nx Cloud version.
|
31
31
|
${e}`);
|
32
32
|
return apiUrl;
|
33
33
|
}
|
@@ -46,7 +46,7 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
|
|
46
46
|
return `${apiUrl}/connect/${response.data}`;
|
47
47
|
}
|
48
48
|
catch (e) {
|
49
|
-
|
49
|
+
logger_1.logger.verbose(`Failed to shorten Nx Cloud URL.
|
50
50
|
${e}`);
|
51
51
|
return getURLifShortenFailed(usesGithub, githubSlug === 'github' ? null : githubSlug, apiUrl, source, accessToken);
|
52
52
|
}
|
@@ -96,7 +96,7 @@ async function getInstallationSupportsGitHub(apiUrl) {
|
|
96
96
|
}
|
97
97
|
catch (e) {
|
98
98
|
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
99
|
-
|
99
|
+
logger_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
|
100
100
|
${e}`);
|
101
101
|
}
|
102
102
|
return false;
|
@@ -116,7 +116,7 @@ async function getNxCloudVersion(apiUrl) {
|
|
116
116
|
return version;
|
117
117
|
}
|
118
118
|
catch (e) {
|
119
|
-
|
119
|
+
logger_1.logger.verbose(`Failed to get version of Nx Cloud.
|
120
120
|
${e}`);
|
121
121
|
return null;
|
122
122
|
}
|
@@ -18,8 +18,8 @@ export declare function isDeletedFileChange(change: Change): change is DeletedFi
|
|
18
18
|
export declare function calculateFileChanges(files: string[], allWorkspaceFiles: FileData[], nxArgs?: NxArgs, readFileAtRevision?: (f: string, r: void | string) => string, ignore?: ReturnType<typeof ignore>): FileChange[];
|
19
19
|
export declare const TEN_MEGABYTES: number;
|
20
20
|
/**
|
21
|
-
* TODO(
|
22
|
-
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in
|
21
|
+
* TODO(v21): Remove this function
|
22
|
+
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v21.
|
23
23
|
*/
|
24
24
|
export declare function readWorkspaceConfig(opts: {
|
25
25
|
format: 'angularCli' | 'nx';
|
@@ -101,8 +101,8 @@ function defaultReadFileAtRevision(file, revision) {
|
|
101
101
|
}
|
102
102
|
}
|
103
103
|
/**
|
104
|
-
* TODO(
|
105
|
-
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in
|
104
|
+
* TODO(v21): Remove this function
|
105
|
+
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v21.
|
106
106
|
*/
|
107
107
|
function readWorkspaceConfig(opts) {
|
108
108
|
let configuration = null;
|
@@ -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,17 @@ 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
|
-
(nxJson.enableDbCache === true || process.env.NX_DB_CACHE === 'true')
|
23
|
+
function dbCacheEnabled(nxJson = (0, nx_json_1.readNxJson)()) {
|
24
|
+
return (process.env.NX_DISABLE_DB !== 'true' &&
|
25
|
+
(nxJson.enableDbCache === true || process.env.NX_DB_CACHE === 'true'));
|
26
|
+
}
|
27
|
+
// Do not change the order of these arguments as this function is used by nx cloud
|
28
|
+
function getCache(options) {
|
29
|
+
const nxJson = (0, nx_json_1.readNxJson)();
|
30
|
+
return dbCacheEnabled(nxJson)
|
25
31
|
? new DbCache({
|
26
32
|
// Remove this in Nx 21
|
27
|
-
nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)(
|
28
|
-
? options.remoteCache
|
29
|
-
: null,
|
33
|
+
nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson) ? options.remoteCache : null,
|
30
34
|
})
|
31
35
|
: new Cache(options);
|
32
36
|
}
|
@@ -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) {
|
@@ -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;
|
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 {
|
@@ -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
|
-
}
|
@@ -1,97 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = default_1;
|
4
|
-
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
5
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
6
|
-
async function default_1(tree) {
|
7
|
-
updateDependsOnAndInputsInsideNxJson(tree);
|
8
|
-
const projectsConfigurations = (0, project_configuration_1.getProjects)(tree);
|
9
|
-
for (const [projectName, projectConfiguration] of projectsConfigurations) {
|
10
|
-
let projectChanged = false;
|
11
|
-
for (const [targetName, targetConfiguration] of Object.entries(projectConfiguration.targets ?? {})) {
|
12
|
-
for (const dependency of targetConfiguration.dependsOn ?? []) {
|
13
|
-
if (typeof dependency !== 'string') {
|
14
|
-
if (dependency.projects === 'self' ||
|
15
|
-
dependency.projects === '{self}') {
|
16
|
-
delete dependency.projects;
|
17
|
-
projectChanged = true;
|
18
|
-
}
|
19
|
-
else if (dependency.projects === 'dependencies' ||
|
20
|
-
dependency.projects === '{dependencies}') {
|
21
|
-
delete dependency.projects;
|
22
|
-
dependency.dependencies = true;
|
23
|
-
projectChanged = true;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
for (let i = 0; i < targetConfiguration.inputs?.length ?? 0; i++) {
|
28
|
-
const input = targetConfiguration.inputs[i];
|
29
|
-
if (typeof input !== 'string') {
|
30
|
-
if ('projects' in input &&
|
31
|
-
(input.projects === 'self' || input.projects === '{self}')) {
|
32
|
-
delete input.projects;
|
33
|
-
projectChanged = true;
|
34
|
-
}
|
35
|
-
else if ('projects' in input &&
|
36
|
-
(input.projects === 'dependencies' ||
|
37
|
-
input.projects === '{dependencies}')) {
|
38
|
-
delete input.projects;
|
39
|
-
targetConfiguration.inputs[i] = {
|
40
|
-
...input,
|
41
|
-
dependencies: true,
|
42
|
-
};
|
43
|
-
projectChanged = true;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}
|
48
|
-
if (projectChanged) {
|
49
|
-
(0, project_configuration_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
|
50
|
-
}
|
51
|
-
}
|
52
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
53
|
-
}
|
54
|
-
function updateDependsOnAndInputsInsideNxJson(tree) {
|
55
|
-
const nxJson = (0, project_configuration_1.readNxJson)(tree);
|
56
|
-
let nxJsonChanged = false;
|
57
|
-
for (const [target, defaults] of Object.entries(nxJson?.targetDefaults ?? {})) {
|
58
|
-
for (const dependency of defaults.dependsOn ?? []) {
|
59
|
-
if (typeof dependency !== 'string') {
|
60
|
-
if (dependency.projects === 'self' ||
|
61
|
-
dependency.projects === '{self}') {
|
62
|
-
delete dependency.projects;
|
63
|
-
nxJsonChanged = true;
|
64
|
-
}
|
65
|
-
else if (dependency.projects === 'dependencies' ||
|
66
|
-
dependency.projects === '{dependencies}') {
|
67
|
-
delete dependency.projects;
|
68
|
-
dependency.dependencies = true;
|
69
|
-
nxJsonChanged = true;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
73
|
-
for (let i = 0; i < defaults.inputs?.length ?? 0; i++) {
|
74
|
-
const input = defaults.inputs[i];
|
75
|
-
if (typeof input !== 'string') {
|
76
|
-
if ('projects' in input &&
|
77
|
-
(input.projects === 'self' || input.projects === '{self}')) {
|
78
|
-
delete input.projects;
|
79
|
-
nxJsonChanged = true;
|
80
|
-
}
|
81
|
-
else if ('projects' in input &&
|
82
|
-
(input.projects === 'dependencies' ||
|
83
|
-
input.projects === '{dependencies}')) {
|
84
|
-
delete input.projects;
|
85
|
-
defaults.inputs[i] = {
|
86
|
-
...input,
|
87
|
-
dependencies: true,
|
88
|
-
};
|
89
|
-
nxJsonChanged = true;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
}
|
93
|
-
}
|
94
|
-
if (nxJsonChanged) {
|
95
|
-
(0, project_configuration_1.updateNxJson)(tree, nxJson);
|
96
|
-
}
|
97
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = default_1;
|
4
|
-
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
5
|
-
const json_1 = require("../../generators/utils/json");
|
6
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
7
|
-
async function default_1(tree) {
|
8
|
-
(0, json_1.updateJson)(tree, 'package.json', (json) => {
|
9
|
-
if (json.dependencies && json.dependencies['@nrwl/nx-cloud']) {
|
10
|
-
json.dependencies['nx-cloud'] = json.dependencies['@nrwl/nx-cloud'];
|
11
|
-
delete json.dependencies['@nrwl/nx-cloud'];
|
12
|
-
}
|
13
|
-
if (json.devDependencies && json.devDependencies['@nrwl/nx-cloud']) {
|
14
|
-
json.devDependencies['nx-cloud'] = json.devDependencies['@nrwl/nx-cloud'];
|
15
|
-
delete json.devDependencies['@nrwl/nx-cloud'];
|
16
|
-
}
|
17
|
-
return json;
|
18
|
-
});
|
19
|
-
const nxJson = (0, project_configuration_1.readNxJson)(tree);
|
20
|
-
if (!nxJson)
|
21
|
-
return;
|
22
|
-
for (let opts of Object.values(nxJson.tasksRunnerOptions ?? {})) {
|
23
|
-
if (opts.runner === '@nrwl/nx-cloud') {
|
24
|
-
opts.runner = 'nx-cloud';
|
25
|
-
}
|
26
|
-
}
|
27
|
-
(0, project_configuration_1.updateNxJson)(tree, nxJson);
|
28
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
29
|
-
}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = removeRunCommandsOutputPath;
|
4
|
-
const path_1 = require("../../utils/path");
|
5
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
6
|
-
const json_1 = require("../../generators/utils/json");
|
7
|
-
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
8
|
-
async function removeRunCommandsOutputPath(tree) {
|
9
|
-
for (const [project, configuration] of (0, project_configuration_1.getProjects)(tree).entries()) {
|
10
|
-
const targets = configuration.targets ?? {};
|
11
|
-
let changed = false;
|
12
|
-
for (const [, target] of Object.entries(targets)) {
|
13
|
-
changed ||= updateTargetBlock(target);
|
14
|
-
}
|
15
|
-
if (changed) {
|
16
|
-
(0, project_configuration_1.updateProjectConfiguration)(tree, project, configuration);
|
17
|
-
}
|
18
|
-
}
|
19
|
-
if (tree.exists('nx.json')) {
|
20
|
-
(0, json_1.updateJson)(tree, 'nx.json', (json) => {
|
21
|
-
for (const [, target] of Object.entries(json.targetDefaults ?? {})) {
|
22
|
-
updateTargetBlock(target);
|
23
|
-
}
|
24
|
-
return json;
|
25
|
-
});
|
26
|
-
}
|
27
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
28
|
-
}
|
29
|
-
function updateTargetBlock(target) {
|
30
|
-
let changed = false;
|
31
|
-
if (target.executor === 'nx:run-commands' && target.options?.outputPath) {
|
32
|
-
changed = true;
|
33
|
-
const outputs = new Set(target.outputs ?? []);
|
34
|
-
outputs.delete('{options.outputPath}');
|
35
|
-
const newOutputs = Array.isArray(target.options.outputPath)
|
36
|
-
? target.options.outputPath.map((p) => (0, path_1.joinPathFragments)('{workspaceRoot}', p))
|
37
|
-
: [(0, path_1.joinPathFragments)('{workspaceRoot}', target.options.outputPath)];
|
38
|
-
for (const outputPath of newOutputs) {
|
39
|
-
outputs.add(outputPath);
|
40
|
-
}
|
41
|
-
delete target.options.outputPath;
|
42
|
-
target.outputs = Array.from(outputs);
|
43
|
-
}
|
44
|
-
return changed;
|
45
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { Tree } from '../../generators/tree';
|
2
|
-
/**
|
3
|
-
* This function escapes dollar sign in env variables
|
4
|
-
* It will go through:
|
5
|
-
* - '.env', '.local.env', '.env.local'
|
6
|
-
* - .env.[target-name], .[target-name].env
|
7
|
-
* - .env.[target-name].[configuration-name], .[target-name].[configuration-name].env
|
8
|
-
* - .env.[configuration-name], .[configuration-name].env
|
9
|
-
* at each project root and workspace root
|
10
|
-
* @param tree
|
11
|
-
*/
|
12
|
-
export default function escapeDollarSignEnvVariables(tree: Tree): void;
|