@nx/workspace 16.10.0 → 17.0.0-beta.1
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 +0 -135
- package/package.json +4 -4
- package/src/generators/ci-workflow/ci-workflow.js +2 -1
- package/src/generators/new/files-integrated-repo/__dot__gitignore +2 -0
- package/src/generators/new/files-package-based-repo/__dot__gitignore +2 -0
- package/src/generators/new/files-root-app/__dot__gitignore +2 -0
- package/src/generators/new/generate-workspace-files.js +13 -13
- package/src/utils/testing-utils.d.ts +0 -9
- package/src/utils/testing-utils.js +1 -55
- package/testing.d.ts +1 -1
- package/testing.js +1 -3
- package/src/migrations/update-12-5-0/add-target-dependencies.d.ts +0 -3
- package/src/migrations/update-12-5-0/add-target-dependencies.js +0 -36
- package/src/migrations/update-13-0-0/config-locations/config-locations.d.ts +0 -2
- package/src/migrations/update-13-0-0/config-locations/config-locations.js +0 -30
- package/src/migrations/update-13-0-0/set-default-base-if-not-set.d.ts +0 -3
- package/src/migrations/update-13-0-0/set-default-base-if-not-set.js +0 -24
- package/src/migrations/update-13-10-0/update-decorate-cli.d.ts +0 -3
- package/src/migrations/update-13-10-0/update-decorate-cli.js +0 -12
- package/src/migrations/update-13-10-0/update-tasks-runner.d.ts +0 -3
- package/src/migrations/update-13-10-0/update-tasks-runner.js +0 -15
- package/src/migrations/update-13-2-0/set-parallel-default.d.ts +0 -3
- package/src/migrations/update-13-2-0/set-parallel-default.js +0 -22
- package/src/migrations/update-13-3-0/update-tsc-executor-location.d.ts +0 -3
- package/src/migrations/update-13-3-0/update-tsc-executor-location.js +0 -27
- package/src/migrations/update-13-6-0/remove-old-task-runner-options.d.ts +0 -3
- package/src/migrations/update-13-6-0/remove-old-task-runner-options.js +0 -15
- package/src/migrations/update-13-9-0/replace-tao-with-nx.d.ts +0 -3
- package/src/migrations/update-13-9-0/replace-tao-with-nx.js +0 -26
- package/src/migrations/update-13-9-0/update-decorate-cli.d.ts +0 -3
- package/src/migrations/update-13-9-0/update-decorate-cli.js +0 -11
- package/src/migrations/update-14-0-0/change-npm-script-executor.d.ts +0 -3
- package/src/migrations/update-14-0-0/change-npm-script-executor.js +0 -16
- package/src/migrations/update-14-0-0/change-nx-json-presets.d.ts +0 -3
- package/src/migrations/update-14-0-0/change-nx-json-presets.js +0 -20
- package/src/migrations/update-14-2-0/enable-source-analysis.d.ts +0 -3
- package/src/migrations/update-14-2-0/enable-source-analysis.js +0 -23
- package/src/migrations/update-14-8-0/change-run-commands-executor.d.ts +0 -3
- package/src/migrations/update-14-8-0/change-run-commands-executor.js +0 -16
package/migrations.json
CHANGED
|
@@ -1,83 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generators": {
|
|
3
|
-
"add-target-dependencies": {
|
|
4
|
-
"version": "12.5.0-beta.1",
|
|
5
|
-
"description": "Rename the workspace-schematic script into workspace-generator script",
|
|
6
|
-
"factory": "./src/migrations/update-12-5-0/add-target-dependencies",
|
|
7
|
-
"cli": "nx"
|
|
8
|
-
},
|
|
9
|
-
"set-default-base-if-not-set": {
|
|
10
|
-
"version": "13.0.0-beta.1",
|
|
11
|
-
"description": "Add default base to nx.json if its not currently set",
|
|
12
|
-
"factory": "./src/migrations/update-13-0-0/set-default-base-if-not-set",
|
|
13
|
-
"cli": "nx"
|
|
14
|
-
},
|
|
15
|
-
"13-0-0-config-locations": {
|
|
16
|
-
"version": "13.0.0-beta.4",
|
|
17
|
-
"description": "Move global settings into nx.json, and project specific settings into workspace.json",
|
|
18
|
-
"cli": "nx",
|
|
19
|
-
"implementation": "./src/migrations/update-13-0-0/config-locations/config-locations"
|
|
20
|
-
},
|
|
21
|
-
"set-parallel-default": {
|
|
22
|
-
"version": "13.2.0",
|
|
23
|
-
"description": "Set --parallel=1 for existing repos to preserve the existing behavior",
|
|
24
|
-
"cli": "nx",
|
|
25
|
-
"implementation": "./src/migrations/update-13-2-0/set-parallel-default"
|
|
26
|
-
},
|
|
27
|
-
"13-3-0-tsc-location": {
|
|
28
|
-
"version": "13.3.0-beta.0",
|
|
29
|
-
"description": "@nrwl/workspace:tsc is now @nrwl/js:tsc",
|
|
30
|
-
"cli": "nx",
|
|
31
|
-
"implementation": "./src/migrations/update-13-3-0/update-tsc-executor-location"
|
|
32
|
-
},
|
|
33
|
-
"13-6-0-remove-old-task-runner-options": {
|
|
34
|
-
"version": "13.6.0-beta.0",
|
|
35
|
-
"description": "Remove old options that are no longer used",
|
|
36
|
-
"cli": "nx",
|
|
37
|
-
"implementation": "./src/migrations/update-13-6-0/remove-old-task-runner-options"
|
|
38
|
-
},
|
|
39
|
-
"13-9-0-replace-tao-with-nx": {
|
|
40
|
-
"version": "13.9.0-beta.0",
|
|
41
|
-
"description": "Replace @nrwl/tao with nx",
|
|
42
|
-
"cli": "nx",
|
|
43
|
-
"implementation": "./src/migrations/update-13-9-0/replace-tao-with-nx"
|
|
44
|
-
},
|
|
45
|
-
"13-10-0-update-decorate-cli": {
|
|
46
|
-
"version": "13.10.0-beta.0",
|
|
47
|
-
"description": "Update the decorate-angular-cli script to require nx instead of @nrwl/cli",
|
|
48
|
-
"cli": "nx",
|
|
49
|
-
"implementation": "./src/migrations/update-13-10-0/update-decorate-cli"
|
|
50
|
-
},
|
|
51
|
-
"13-10-0-update-tasks-runner": {
|
|
52
|
-
"version": "13.10.0-beta.0",
|
|
53
|
-
"description": "Update the tasks runner property to import it from the nx package instead of @nrwl/workspace",
|
|
54
|
-
"cli": "nx",
|
|
55
|
-
"implementation": "./src/migrations/update-13-10-0/update-tasks-runner"
|
|
56
|
-
},
|
|
57
|
-
"14-0-0-change-nx-json-presets": {
|
|
58
|
-
"version": "14.0.0-beta.0",
|
|
59
|
-
"description": "Changes the presets in nx.json to come from the nx package",
|
|
60
|
-
"cli": "nx",
|
|
61
|
-
"implementation": "./src/migrations/update-14-0-0/change-nx-json-presets"
|
|
62
|
-
},
|
|
63
|
-
"14-0-0-change-npm-script-executor": {
|
|
64
|
-
"version": "14.0.0-beta.0",
|
|
65
|
-
"description": "Migrates from @nrwl/workspace:run-script to nx:run-script",
|
|
66
|
-
"cli": "nx",
|
|
67
|
-
"implementation": "./src/migrations/update-14-0-0/change-npm-script-executor"
|
|
68
|
-
},
|
|
69
|
-
"14-2-0-enable-source-analysis": {
|
|
70
|
-
"version": "14.2.0",
|
|
71
|
-
"description": "Explicitly enable sourceAnalysis for all workspaces extending from npm.json or core.json (this was default behavior prior to 14.2)",
|
|
72
|
-
"cli": "nx",
|
|
73
|
-
"implementation": "./src/migrations/update-14-2-0/enable-source-analysis"
|
|
74
|
-
},
|
|
75
|
-
"14-8-0-change-run-commands-executor": {
|
|
76
|
-
"version": "14.8.0-beta.0",
|
|
77
|
-
"description": "Migrates from @nrwl/workspace:run-commands to nx:run-commands",
|
|
78
|
-
"cli": "nx",
|
|
79
|
-
"implementation": "./src/migrations/update-14-8-0/change-run-commands-executor"
|
|
80
|
-
},
|
|
81
3
|
"15-7-0-split-configuration-into-project-json-files": {
|
|
82
4
|
"version": "15.7.0-beta.0",
|
|
83
5
|
"description": "Split global configuration files (e.g., workspace.json) into individual project.json files.",
|
|
@@ -104,63 +26,6 @@
|
|
|
104
26
|
}
|
|
105
27
|
},
|
|
106
28
|
"packageJsonUpdates": {
|
|
107
|
-
"12.5.0": {
|
|
108
|
-
"version": "12.5.0",
|
|
109
|
-
"packages": {
|
|
110
|
-
"prettier": {
|
|
111
|
-
"version": "^2.3.1",
|
|
112
|
-
"alwaysAddToPackageJson": false
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"12.6.0": {
|
|
117
|
-
"version": "12.6.0-beta.8",
|
|
118
|
-
"packages": {
|
|
119
|
-
"typescript": {
|
|
120
|
-
"version": "~4.3.5"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
"12.7.0": {
|
|
125
|
-
"version": "12.7.0-beta.0",
|
|
126
|
-
"packages": {
|
|
127
|
-
"dotenv": {
|
|
128
|
-
"version": "~10.0.0"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
"13.5.0": {
|
|
133
|
-
"version": "13.5.0",
|
|
134
|
-
"packages": {
|
|
135
|
-
"prettier": {
|
|
136
|
-
"version": "^2.5.1",
|
|
137
|
-
"alwaysAddToPackageJson": false
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
"14.2.0": {
|
|
142
|
-
"version": "14.2.0-beta.4",
|
|
143
|
-
"packages": {
|
|
144
|
-
"typescript": {
|
|
145
|
-
"version": "~4.7.2",
|
|
146
|
-
"alwaysAddToPackageJson": false
|
|
147
|
-
},
|
|
148
|
-
"prettier": {
|
|
149
|
-
"version": "^2.6.2",
|
|
150
|
-
"alwaysAddToPackageJson": false
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
"14.8.0": {
|
|
155
|
-
"version": "14.8.0-beta.0",
|
|
156
|
-
"x-prompt": "Do you want to update to TypeScript v4.8?",
|
|
157
|
-
"packages": {
|
|
158
|
-
"typescript": {
|
|
159
|
-
"version": "~4.8.2",
|
|
160
|
-
"alwaysAddToPackageJson": false
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
29
|
"15.8.0": {
|
|
165
30
|
"version": "15.8.0-beta.2",
|
|
166
31
|
"x-prompt": "Do you want to update to TypeScript v4.9?",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/workspace",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
|
|
6
6
|
"repository": {
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@nx/devkit": "
|
|
64
|
+
"@nx/devkit": "17.0.0-beta.1",
|
|
65
65
|
"chalk": "^4.1.0",
|
|
66
66
|
"enquirer": "~2.3.6",
|
|
67
67
|
"ignore": "^5.0.4",
|
|
68
68
|
"rxjs": "^7.8.0",
|
|
69
69
|
"tslib": "^2.3.0",
|
|
70
70
|
"yargs-parser": "21.1.1",
|
|
71
|
-
"nx": "
|
|
72
|
-
"@nrwl/workspace": "
|
|
71
|
+
"nx": "17.0.0-beta.1",
|
|
72
|
+
"@nrwl/workspace": "17.0.0-beta.1"
|
|
73
73
|
},
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
@@ -8,7 +8,8 @@ async function ciWorkflowGenerator(host, schema) {
|
|
|
8
8
|
const ci = schema.ci;
|
|
9
9
|
const options = normalizeOptions(schema);
|
|
10
10
|
const nxJson = (0, devkit_1.readJson)(host, 'nx.json');
|
|
11
|
-
const nxCloudUsed =
|
|
11
|
+
const nxCloudUsed = nxJson.nxCloudAccessToken ??
|
|
12
|
+
Object.values(nxJson.tasksRunnerOptions ?? {}).find((r) => r.runner == '@nrwl/nx-cloud' || r.runner == 'nx-cloud');
|
|
12
13
|
if (!nxCloudUsed) {
|
|
13
14
|
throw new Error('This workspace is not connected to Nx Cloud.');
|
|
14
15
|
}
|
|
@@ -38,8 +38,6 @@ function setPresetProperty(tree, options) {
|
|
|
38
38
|
(0, devkit_1.updateJson)(tree, (0, path_1.join)(options.directory, 'nx.json'), (json) => {
|
|
39
39
|
if (options.preset === presets_1.Preset.NPM) {
|
|
40
40
|
addPropertyWithStableKeys(json, 'extends', 'nx/presets/npm.json');
|
|
41
|
-
delete json.implicitDependencies;
|
|
42
|
-
delete json.targetDefaults;
|
|
43
41
|
}
|
|
44
42
|
return json;
|
|
45
43
|
});
|
|
@@ -50,18 +48,20 @@ function createNxJson(tree, { directory, defaultBase, preset }) {
|
|
|
50
48
|
affected: {
|
|
51
49
|
defaultBase,
|
|
52
50
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
targetDefaults: {
|
|
52
|
+
build: {
|
|
53
|
+
cache: true,
|
|
54
|
+
dependsOn: ['^build'],
|
|
55
|
+
},
|
|
56
|
+
lint: {
|
|
57
|
+
cache: true,
|
|
58
|
+
},
|
|
59
|
+
test: {
|
|
60
|
+
cache: true,
|
|
61
|
+
},
|
|
62
|
+
e2e: {
|
|
63
|
+
cache: true,
|
|
59
64
|
},
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
nxJson.targetDefaults = {
|
|
63
|
-
build: {
|
|
64
|
-
dependsOn: ['^build'],
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
if (defaultBase === 'main') {
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import type { Tree } from '@angular-devkit/schematics';
|
|
2
1
|
import { Architect, BuilderContext, Target } from '@angular-devkit/architect';
|
|
3
2
|
import { TestingArchitectHost } from '@angular-devkit/architect/testing';
|
|
4
3
|
import { json, JsonObject } from '@angular-devkit/core';
|
|
5
4
|
import { ScheduleOptions } from '@angular-devkit/architect/src/api';
|
|
6
5
|
import { LoggerApi, LogLevel } from '@angular-devkit/core/src/logger';
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. Use tree.read(filePath, 'utf-8') instead.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getFileContent(tree: Tree, path: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. Tests for Generators can use 'createTreeWithEmptyWorkspace()' from @nx/devkit/testing.
|
|
13
|
-
*/
|
|
14
|
-
export declare function createEmptyWorkspace(tree: Tree): Tree;
|
|
15
6
|
declare class NoopLogger implements LoggerApi {
|
|
16
7
|
private _log;
|
|
17
8
|
createChild(name: string): any;
|
|
@@ -1,60 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MockBuilderContext =
|
|
4
|
-
const core_1 = require("@angular-devkit/core/src/workspace/core");
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. Use tree.read(filePath, 'utf-8') instead.
|
|
7
|
-
*/
|
|
8
|
-
function getFileContent(tree, path) {
|
|
9
|
-
const fileEntry = tree.get(path);
|
|
10
|
-
if (!fileEntry) {
|
|
11
|
-
throw new Error(`The file (${path}) does not exist.`);
|
|
12
|
-
}
|
|
13
|
-
return fileEntry.content.toString();
|
|
14
|
-
}
|
|
15
|
-
exports.getFileContent = getFileContent;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated This will be removed in v17. Prefer writing Nx Generators with @nx/devkit. Tests for Generators can use 'createTreeWithEmptyWorkspace()' from @nx/devkit/testing.
|
|
18
|
-
*/
|
|
19
|
-
function createEmptyWorkspace(tree) {
|
|
20
|
-
(0, core_1._test_addWorkspaceFile)('workspace.json', core_1.WorkspaceFormat.JSON);
|
|
21
|
-
tree.create('/workspace.json', JSON.stringify({ version: 1, projects: {}, newProjectRoot: '' }));
|
|
22
|
-
tree.create('/package.json', JSON.stringify({
|
|
23
|
-
name: 'test-name',
|
|
24
|
-
dependencies: {},
|
|
25
|
-
devDependencies: {},
|
|
26
|
-
}));
|
|
27
|
-
tree.create('/nx.json', JSON.stringify({
|
|
28
|
-
npmScope: 'proj',
|
|
29
|
-
projects: {},
|
|
30
|
-
affected: {
|
|
31
|
-
defaultBase: 'main',
|
|
32
|
-
},
|
|
33
|
-
tasksRunnerOptions: {
|
|
34
|
-
default: {
|
|
35
|
-
runner: 'nx/tasks-runners/default',
|
|
36
|
-
options: {
|
|
37
|
-
cacheableOperations: ['build', 'lint', 'test', 'e2e'],
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
}));
|
|
42
|
-
tree.create('/tsconfig.base.json', JSON.stringify({ compilerOptions: { paths: {} } }));
|
|
43
|
-
tree.create('/tslint.json', JSON.stringify({
|
|
44
|
-
rules: {
|
|
45
|
-
'nx-enforce-module-boundaries': [
|
|
46
|
-
true,
|
|
47
|
-
{
|
|
48
|
-
npmScope: '<%= npmScope %>',
|
|
49
|
-
lazyLoad: [],
|
|
50
|
-
allow: [],
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
}));
|
|
55
|
-
return tree;
|
|
56
|
-
}
|
|
57
|
-
exports.createEmptyWorkspace = createEmptyWorkspace;
|
|
3
|
+
exports.MockBuilderContext = void 0;
|
|
58
4
|
class NoopLogger {
|
|
59
5
|
constructor() {
|
|
60
6
|
this._log = '';
|
package/testing.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { MockBuilderContext } from './src/utils/testing-utils';
|
package/testing.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MockBuilderContext =
|
|
3
|
+
exports.MockBuilderContext = void 0;
|
|
4
4
|
var testing_utils_1 = require("./src/utils/testing-utils");
|
|
5
|
-
Object.defineProperty(exports, "createEmptyWorkspace", { enumerable: true, get: function () { return testing_utils_1.createEmptyWorkspace; } });
|
|
6
|
-
Object.defineProperty(exports, "getFileContent", { enumerable: true, get: function () { return testing_utils_1.getFileContent; } });
|
|
7
5
|
Object.defineProperty(exports, "MockBuilderContext", { enumerable: true, get: function () { return testing_utils_1.MockBuilderContext; } });
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setTargetDependencies = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const output_1 = require("../../utilities/output");
|
|
6
|
-
async function setTargetDependencies(host) {
|
|
7
|
-
const config = (0, devkit_1.readNxJson)(host);
|
|
8
|
-
const strictlyOrderedTargets = config.tasksRunnerOptions?.['default']?.options
|
|
9
|
-
?.strictlyOrderedTargets || ['build'];
|
|
10
|
-
delete config.tasksRunnerOptions?.['default']?.options
|
|
11
|
-
?.strictlyOrderedTargets;
|
|
12
|
-
config.targetDependencies = config.targetDependencies ?? {};
|
|
13
|
-
const updatedStrictlyOrderedTargets = [];
|
|
14
|
-
strictlyOrderedTargets.forEach((target) => {
|
|
15
|
-
if (!config.targetDependencies[target]) {
|
|
16
|
-
config.targetDependencies[target] = [
|
|
17
|
-
{ target, projects: 'dependencies' },
|
|
18
|
-
];
|
|
19
|
-
updatedStrictlyOrderedTargets.push(target);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
(0, devkit_1.updateNxJson)(host, config);
|
|
23
|
-
if (updatedStrictlyOrderedTargets.length > 0) {
|
|
24
|
-
output_1.output.note({
|
|
25
|
-
title: 'Target dependencies have been updated in nx.json',
|
|
26
|
-
bodyLines: [
|
|
27
|
-
`Nx has deprecated strictlyOrderedTargets in favour of targetDependencies.`,
|
|
28
|
-
`Based on your configuration the migration has configured targetDependencies for the following targets: ${updatedStrictlyOrderedTargets.join(', ')}.`,
|
|
29
|
-
`Read more here: https://nx.dev/reference/project-configuration`,
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
await (0, devkit_1.formatFiles)(host);
|
|
34
|
-
}
|
|
35
|
-
exports.setTargetDependencies = setTargetDependencies;
|
|
36
|
-
exports.default = setTargetDependencies;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const devkit_1 = require("@nx/devkit");
|
|
4
|
-
async function update(tree) {
|
|
5
|
-
const nxJson = (0, devkit_1.readJson)(tree, 'nx.json');
|
|
6
|
-
// updateProjectConfiguration automatically saves the project opts into workspace/project.json
|
|
7
|
-
if (nxJson.projects) {
|
|
8
|
-
Object.entries(nxJson.projects).forEach(([p, nxJsonConfiguration]) => {
|
|
9
|
-
const configuration = (0, devkit_1.readProjectConfiguration)(tree, p);
|
|
10
|
-
configuration.tags ??= nxJsonConfiguration.tags;
|
|
11
|
-
configuration.implicitDependencies ??=
|
|
12
|
-
nxJsonConfiguration.implicitDependencies;
|
|
13
|
-
(0, devkit_1.updateProjectConfiguration)(tree, p, configuration);
|
|
14
|
-
});
|
|
15
|
-
delete nxJson.projects;
|
|
16
|
-
}
|
|
17
|
-
(0, devkit_1.writeJson)(tree, 'nx.json', nxJson);
|
|
18
|
-
movePropertiesAreInNewLocations(tree); // move config options to new spots.
|
|
19
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
20
|
-
}
|
|
21
|
-
exports.default = update;
|
|
22
|
-
/**
|
|
23
|
-
* `updateWorkspaceConfiguration` already handles
|
|
24
|
-
* placing properties in their new locations, so
|
|
25
|
-
* reading + updating it ensures that props are placed
|
|
26
|
-
* correctly.
|
|
27
|
-
*/
|
|
28
|
-
function movePropertiesAreInNewLocations(tree) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setDefaultBaseIfNotSet = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const output_1 = require("../../utilities/output");
|
|
6
|
-
async function setDefaultBaseIfNotSet(host) {
|
|
7
|
-
const config = (0, devkit_1.readNxJson)(host);
|
|
8
|
-
if (!config.affected?.defaultBase) {
|
|
9
|
-
config.affected ??= {};
|
|
10
|
-
config.affected.defaultBase ??= 'master';
|
|
11
|
-
output_1.output.note({
|
|
12
|
-
title: 'Default Base has been set in nx.json',
|
|
13
|
-
bodyLines: [
|
|
14
|
-
`Nx is moving to "main" as the default branch.`,
|
|
15
|
-
`To avoid your current defaults changing, defaultBase has been set to "master" in nx.json`,
|
|
16
|
-
`Read more here: https://nx.dev/using-nx/affected`,
|
|
17
|
-
],
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
(0, devkit_1.updateNxJson)(host, config);
|
|
21
|
-
await (0, devkit_1.formatFiles)(host);
|
|
22
|
-
}
|
|
23
|
-
exports.setDefaultBaseIfNotSet = setDefaultBaseIfNotSet;
|
|
24
|
-
exports.default = setDefaultBaseIfNotSet;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateDecorateAngularCLI = void 0;
|
|
4
|
-
function updateDecorateAngularCLI(host) {
|
|
5
|
-
const decorate = host.read('decorate-angular-cli.js')?.toString();
|
|
6
|
-
if (decorate) {
|
|
7
|
-
host.write('decorate-angular-cli.js', decorate.replace('@nrwl/cli/lib/decorate-cli', 'nx/src/adapter/decorate-cli'));
|
|
8
|
-
host.write('decorate-angular-cli.js', decorate.replace('nx/src/cli/decorate-cli', 'nx/src/adapter/decorate-cli'));
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.updateDecorateAngularCLI = updateDecorateAngularCLI;
|
|
12
|
-
exports.default = updateDecorateAngularCLI;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateTasksRunner = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function updateTasksRunner(host) {
|
|
6
|
-
const config = (0, devkit_1.readNxJson)(host);
|
|
7
|
-
if (config?.tasksRunnerOptions?.['default'] &&
|
|
8
|
-
config?.tasksRunnerOptions['default'].runner ==
|
|
9
|
-
'@nrwl/workspace/tasks-runners/default') {
|
|
10
|
-
config.tasksRunnerOptions['default'].runner = 'nx/tasks-runners/default';
|
|
11
|
-
}
|
|
12
|
-
(0, devkit_1.updateNxJson)(host, config);
|
|
13
|
-
}
|
|
14
|
-
exports.updateTasksRunner = updateTasksRunner;
|
|
15
|
-
exports.default = updateTasksRunner;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setParallelDefault = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function setParallelDefault(host) {
|
|
6
|
-
const config = (0, devkit_1.readNxJson)(host);
|
|
7
|
-
const defaultTaskRunnerOptions = config.tasksRunnerOptions?.['default']?.options;
|
|
8
|
-
if (defaultTaskRunnerOptions) {
|
|
9
|
-
if (defaultTaskRunnerOptions.parallel) {
|
|
10
|
-
defaultTaskRunnerOptions.parallel =
|
|
11
|
-
defaultTaskRunnerOptions.maxParallel || 3;
|
|
12
|
-
delete defaultTaskRunnerOptions.maxParallel;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
defaultTaskRunnerOptions.parallel = 1;
|
|
16
|
-
}
|
|
17
|
-
(0, devkit_1.updateNxJson)(host, config);
|
|
18
|
-
}
|
|
19
|
-
await (0, devkit_1.formatFiles)(host);
|
|
20
|
-
}
|
|
21
|
-
exports.setParallelDefault = setParallelDefault;
|
|
22
|
-
exports.default = setParallelDefault;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateTscExecutorLocation = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const versions_1 = require("../../utils/versions");
|
|
6
|
-
async function updateTscExecutorLocation(host) {
|
|
7
|
-
const projects = (0, devkit_1.getProjects)(host);
|
|
8
|
-
let used = false;
|
|
9
|
-
for (const [project, projectConfig] of projects.entries()) {
|
|
10
|
-
for (const [target, targetConfig] of Object.entries(projectConfig.targets || {})) {
|
|
11
|
-
if (targetConfig.executor === '@nrwl/workspace:tsc') {
|
|
12
|
-
projectConfig.targets[target].executor = '@nrwl/js:tsc';
|
|
13
|
-
(0, devkit_1.updateProjectConfiguration)(host, project, projectConfig);
|
|
14
|
-
used = true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (used) {
|
|
19
|
-
(0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
20
|
-
'@nrwl/js': versions_1.nxVersion,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
await (0, devkit_1.formatFiles)(host);
|
|
24
|
-
return () => (0, devkit_1.installPackagesTask)(host);
|
|
25
|
-
}
|
|
26
|
-
exports.updateTscExecutorLocation = updateTscExecutorLocation;
|
|
27
|
-
exports.default = updateTscExecutorLocation;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeOldTaskRunnerOptions = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function removeOldTaskRunnerOptions(host) {
|
|
6
|
-
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
7
|
-
const options = nxJson.tasksRunnerOptions?.['default']?.options;
|
|
8
|
-
if (options) {
|
|
9
|
-
delete options.scan;
|
|
10
|
-
delete options.analytics;
|
|
11
|
-
(0, devkit_1.updateNxJson)(host, nxJson);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.removeOldTaskRunnerOptions = removeOldTaskRunnerOptions;
|
|
15
|
-
exports.default = removeOldTaskRunnerOptions;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replaceTaoWithNx = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function replaceTaoWithNx(host) {
|
|
6
|
-
(0, devkit_1.updateJson)(host, 'package.json', (json) => {
|
|
7
|
-
if (json.dependencies?.['@nrwl/workspace']) {
|
|
8
|
-
json.dependencies['nx'] = json.dependencies['@nrwl/workspace'];
|
|
9
|
-
}
|
|
10
|
-
else if (json.devDependencies?.['@nrwl/workspace']) {
|
|
11
|
-
json.devDependencies['nx'] = json.devDependencies['@nrwl/workspace'];
|
|
12
|
-
}
|
|
13
|
-
removeTao(json.dependencies);
|
|
14
|
-
removeTao(json.devDependencies);
|
|
15
|
-
return json;
|
|
16
|
-
});
|
|
17
|
-
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
18
|
-
devkit_1.logger.info(`Please run ${pmc.install} to ensure the correct version of Nx is installed.`);
|
|
19
|
-
}
|
|
20
|
-
exports.replaceTaoWithNx = replaceTaoWithNx;
|
|
21
|
-
function removeTao(json) {
|
|
22
|
-
if (!json)
|
|
23
|
-
return;
|
|
24
|
-
json['@nrwl/tao'] = undefined;
|
|
25
|
-
}
|
|
26
|
-
exports.default = replaceTaoWithNx;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateDecorateAngularCLI = void 0;
|
|
4
|
-
function updateDecorateAngularCLI(host) {
|
|
5
|
-
const decorate = host.read('decorate-angular-cli.js')?.toString();
|
|
6
|
-
if (decorate) {
|
|
7
|
-
host.write('decorate-angular-cli.js', decorate.replace('@nrwl/cli/lib/decorate-cli', 'nx/src/cli/decorate-cli'));
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.updateDecorateAngularCLI = updateDecorateAngularCLI;
|
|
11
|
-
exports.default = updateDecorateAngularCLI;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.changeNpmScriptExecutor = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
-
async function changeNpmScriptExecutor(tree) {
|
|
7
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/workspace:run-script', (currentValue, project, target) => {
|
|
8
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
|
-
const targetConfig = projectConfig.targets[target];
|
|
10
|
-
targetConfig.executor = 'nx:run-script';
|
|
11
|
-
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfig);
|
|
12
|
-
});
|
|
13
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
14
|
-
}
|
|
15
|
-
exports.changeNpmScriptExecutor = changeNpmScriptExecutor;
|
|
16
|
-
exports.default = changeNpmScriptExecutor;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.changeNxJsonPresets = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function changeNxJsonPresets(tree) {
|
|
6
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
-
const replacements = {
|
|
8
|
-
'@nrwl/workspace/presets/npm.json': 'nx/presets/npm.json',
|
|
9
|
-
'@nrwl/workspace/presets/core.json': 'nx/presets/core.json',
|
|
10
|
-
};
|
|
11
|
-
if (nxJson.extends && replacements[nxJson.extends]) {
|
|
12
|
-
(0, devkit_1.updateNxJson)(tree, {
|
|
13
|
-
...nxJson,
|
|
14
|
-
extends: replacements[nxJson.extends],
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
18
|
-
}
|
|
19
|
-
exports.changeNxJsonPresets = changeNxJsonPresets;
|
|
20
|
-
exports.default = changeNxJsonPresets;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enableSourceAnalysis = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
async function enableSourceAnalysis(tree) {
|
|
6
|
-
(0, devkit_1.updateJson)(tree, 'nx.json', (config) => {
|
|
7
|
-
if (config.extends === 'nx/presets/core.json' ||
|
|
8
|
-
config.extends === 'nx/presets/npm.json') {
|
|
9
|
-
const explicitlyDisabled = config.pluginsConfig &&
|
|
10
|
-
config.pluginsConfig['@nrwl/js'] &&
|
|
11
|
-
config.pluginsConfig['@nrwl/js'].analyzeSourceFiles === false;
|
|
12
|
-
if (!explicitlyDisabled) {
|
|
13
|
-
config.pluginsConfig ||= {};
|
|
14
|
-
config.pluginsConfig['@nrwl/js'] ||= {};
|
|
15
|
-
config.pluginsConfig['@nrwl/js'].analyzeSourceFiles = true;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return config;
|
|
19
|
-
});
|
|
20
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
21
|
-
}
|
|
22
|
-
exports.enableSourceAnalysis = enableSourceAnalysis;
|
|
23
|
-
exports.default = enableSourceAnalysis;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.changeRunCommandsExecutor = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
|
-
async function changeRunCommandsExecutor(tree) {
|
|
7
|
-
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/workspace:run-commands', (currentValue, project, target) => {
|
|
8
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
|
-
const targetConfig = projectConfig.targets[target];
|
|
10
|
-
targetConfig.executor = 'nx:run-commands';
|
|
11
|
-
(0, devkit_1.updateProjectConfiguration)(tree, project, projectConfig);
|
|
12
|
-
});
|
|
13
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
14
|
-
}
|
|
15
|
-
exports.changeRunCommandsExecutor = changeRunCommandsExecutor;
|
|
16
|
-
exports.default = changeRunCommandsExecutor;
|