@nx/workspace 22.7.0-beta.0 → 22.7.0-beta.10
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/assets.json +36 -0
- package/executors.json +8 -8
- package/generators.json +61 -61
- package/migrations.json +53 -53
- package/package.json +8 -9
- package/project.json +2 -71
- package/src/generators/move/lib/update-cypress-config.js +2 -1
- package/src/generators/move/lib/update-owners-and-conformance.d.ts +4 -0
- package/src/generators/move/lib/update-owners-and-conformance.d.ts.map +1 -0
- package/src/generators/move/lib/update-owners-and-conformance.js +78 -0
- package/src/generators/move/lib/update-package-json.js +2 -1
- package/src/generators/move/lib/update-project-root-files.js +2 -1
- package/src/generators/move/lib/update-storybook-config.js +2 -1
- package/src/generators/move/move.d.ts.map +1 -1
- package/src/generators/move/move.js +2 -0
- package/src/generators/new/generate-preset.js +3 -2
- package/src/generators/new/new.js +1 -1
- package/src/generators/remove/lib/remove-project-references-in-config.d.ts.map +1 -1
- package/src/generators/remove/lib/remove-project-references-in-config.js +87 -1
- package/src/generators/utils/get-npm-package-version.js +1 -1
- package/src/utilities/default-base.js +1 -1
- package/src/utils/output.js +2 -1
package/assets.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"outDir": "dist/packages/workspace",
|
|
3
|
+
"assets": [
|
|
4
|
+
{
|
|
5
|
+
"glob": "**/files/**"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"glob": "**/files/**/.gitkeep"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"glob": "**/files-integrated-repo/**"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"glob": "**/files-integrated-repo/**/.gitkeep"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"glob": "**/files-package-based-repo/**"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"glob": "**/files-readme/**"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"glob": "**/files-root-app/**"
|
|
24
|
+
},
|
|
25
|
+
{ "glob": "presets/*.json" },
|
|
26
|
+
{ "glob": "package.json" },
|
|
27
|
+
{ "glob": "executors.json" },
|
|
28
|
+
{ "glob": "generators.json" },
|
|
29
|
+
{ "glob": "migrations.json" },
|
|
30
|
+
{ "glob": "src/**/schema.json" },
|
|
31
|
+
{
|
|
32
|
+
"glob": "src/**/schema.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"LICENSE"
|
|
35
|
+
]
|
|
36
|
+
}
|
package/executors.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"executors": {
|
|
3
|
+
"counter": {
|
|
4
|
+
"implementation": "./src/executors/counter/counter.impl",
|
|
5
|
+
"batchImplementation": "./src/executors/counter/counter.impl#batchCounter",
|
|
6
|
+
"schema": "./src/executors/counter/schema.json",
|
|
7
|
+
"description": "A dummy executor useful for E2E tests.",
|
|
8
|
+
"hidden": true
|
|
9
|
+
}
|
|
9
10
|
}
|
|
10
|
-
}
|
|
11
11
|
}
|
package/generators.json
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
2
|
+
"name": "nx/workspace",
|
|
3
|
+
"version": "0.1",
|
|
4
|
+
"generators": {
|
|
5
|
+
"preset": {
|
|
6
|
+
"factory": "./src/generators/preset/preset#presetGenerator",
|
|
7
|
+
"schema": "./src/generators/preset/schema.json",
|
|
8
|
+
"description": "Create application in an empty workspace.",
|
|
9
|
+
"x-use-standalone-layout": true,
|
|
10
|
+
"hidden": true
|
|
11
|
+
},
|
|
12
|
+
"move": {
|
|
13
|
+
"factory": "./src/generators/move/move",
|
|
14
|
+
"schema": "./src/generators/move/schema.json",
|
|
15
|
+
"aliases": ["mv"],
|
|
16
|
+
"description": "Move an application or library to another folder."
|
|
17
|
+
},
|
|
18
|
+
"remove": {
|
|
19
|
+
"factory": "./src/generators/remove/remove#removeGenerator",
|
|
20
|
+
"schema": "./src/generators/remove/schema.json",
|
|
21
|
+
"aliases": ["rm"],
|
|
22
|
+
"description": "Remove an application or library."
|
|
23
|
+
},
|
|
24
|
+
"convert-to-monorepo": {
|
|
25
|
+
"factory": "./src/generators/convert-to-monorepo/convert-to-monorepo",
|
|
26
|
+
"schema": "./src/generators/convert-to-monorepo/schema.json",
|
|
27
|
+
"description": "Convert a Nx project to a monorepo."
|
|
28
|
+
},
|
|
29
|
+
"new": {
|
|
30
|
+
"factory": "./src/generators/new/new#newGenerator",
|
|
31
|
+
"schema": "./src/generators/new/schema.json",
|
|
32
|
+
"description": "Create a workspace.",
|
|
33
|
+
"hidden": true
|
|
34
|
+
},
|
|
35
|
+
"run-commands": {
|
|
36
|
+
"factory": "./src/generators/run-commands/run-commands#runCommandsGenerator",
|
|
37
|
+
"schema": "./src/generators/run-commands/schema.json",
|
|
38
|
+
"aliases": ["run-command", "target"],
|
|
39
|
+
"description": "Generates a target to run any command in the terminal."
|
|
40
|
+
},
|
|
41
|
+
"fix-configuration": {
|
|
42
|
+
"factory": "./src/generators/convert-to-nx-project/convert-to-nx-project#convertToNxProjectGenerator",
|
|
43
|
+
"schema": "./src/generators/convert-to-nx-project/schema.json",
|
|
44
|
+
"aliases": ["convert-to-nx-project"],
|
|
45
|
+
"description": "Fixes projects configuration"
|
|
46
|
+
},
|
|
47
|
+
"npm-package": {
|
|
48
|
+
"factory": "./src/generators/npm-package/npm-package#npmPackageGenerator",
|
|
49
|
+
"schema": "./src/generators/npm-package/schema.json",
|
|
50
|
+
"description": "Create a minimal NPM package.",
|
|
51
|
+
"x-type": "library"
|
|
52
|
+
},
|
|
53
|
+
"ci-workflow": {
|
|
54
|
+
"factory": "./src/generators/ci-workflow/ci-workflow#ciWorkflowGenerator",
|
|
55
|
+
"schema": "./src/generators/ci-workflow/schema.json",
|
|
56
|
+
"description": "Generate a CI workflow."
|
|
57
|
+
},
|
|
58
|
+
"infer-targets": {
|
|
59
|
+
"factory": "./src/generators/infer-targets/infer-targets",
|
|
60
|
+
"schema": "./src/generators/infer-targets/schema.json",
|
|
61
|
+
"description": "Convert Nx projects to use inferred targets."
|
|
62
|
+
}
|
|
62
63
|
}
|
|
63
|
-
}
|
|
64
64
|
}
|
package/migrations.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
"generators": {},
|
|
3
|
+
"packageJsonUpdates": {
|
|
4
|
+
"20.2.0": {
|
|
5
|
+
"version": "20.2.0-beta.5",
|
|
6
|
+
"x-prompt": "Do you want to update to TypeScript v5.6?",
|
|
7
|
+
"requires": {
|
|
8
|
+
"typescript": ">=5.5.0 <5.6.0"
|
|
9
|
+
},
|
|
10
|
+
"packages": {
|
|
11
|
+
"typescript": {
|
|
12
|
+
"version": "~5.6.2",
|
|
13
|
+
"alwaysAddToPackageJson": false
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"20.4.0": {
|
|
18
|
+
"version": "20.4.0-beta.1",
|
|
19
|
+
"x-prompt": "Do you want to update to TypeScript v5.7?",
|
|
20
|
+
"requires": {
|
|
21
|
+
"typescript": ">=5.6.0 <5.7.0"
|
|
22
|
+
},
|
|
23
|
+
"packages": {
|
|
24
|
+
"typescript": {
|
|
25
|
+
"version": "~5.7.2",
|
|
26
|
+
"alwaysAddToPackageJson": false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"21.2.0": {
|
|
31
|
+
"version": "21.2.0-beta.0",
|
|
32
|
+
"x-prompt": "Do you want to update to TypeScript v5.8?",
|
|
33
|
+
"requires": {
|
|
34
|
+
"typescript": ">=5.7.0 <5.8.0"
|
|
35
|
+
},
|
|
36
|
+
"packages": {
|
|
37
|
+
"typescript": {
|
|
38
|
+
"version": "~5.8.2",
|
|
39
|
+
"alwaysAddToPackageJson": false
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"21.5.0": {
|
|
44
|
+
"version": "21.5.0-beta.2",
|
|
45
|
+
"x-prompt": "Do you want to update to TypeScript v5.9?",
|
|
46
|
+
"requires": {
|
|
47
|
+
"typescript": ">=5.8.0 <5.9.0"
|
|
48
|
+
},
|
|
49
|
+
"packages": {
|
|
50
|
+
"typescript": {
|
|
51
|
+
"version": "~5.9.2",
|
|
52
|
+
"alwaysAddToPackageJson": false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
14
55
|
}
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"20.4.0": {
|
|
18
|
-
"version": "20.4.0-beta.1",
|
|
19
|
-
"x-prompt": "Do you want to update to TypeScript v5.7?",
|
|
20
|
-
"requires": {
|
|
21
|
-
"typescript": ">=5.6.0 <5.7.0"
|
|
22
|
-
},
|
|
23
|
-
"packages": {
|
|
24
|
-
"typescript": {
|
|
25
|
-
"version": "~5.7.2",
|
|
26
|
-
"alwaysAddToPackageJson": false
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"21.2.0": {
|
|
31
|
-
"version": "21.2.0-beta.0",
|
|
32
|
-
"x-prompt": "Do you want to update to TypeScript v5.8?",
|
|
33
|
-
"requires": {
|
|
34
|
-
"typescript": ">=5.7.0 <5.8.0"
|
|
35
|
-
},
|
|
36
|
-
"packages": {
|
|
37
|
-
"typescript": {
|
|
38
|
-
"version": "~5.8.2",
|
|
39
|
-
"alwaysAddToPackageJson": false
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"21.5.0": {
|
|
44
|
-
"version": "21.5.0-beta.2",
|
|
45
|
-
"x-prompt": "Do you want to update to TypeScript v5.9?",
|
|
46
|
-
"requires": {
|
|
47
|
-
"typescript": ">=5.8.0 <5.9.0"
|
|
48
|
-
},
|
|
49
|
-
"packages": {
|
|
50
|
-
"typescript": {
|
|
51
|
-
"version": "~5.9.2",
|
|
52
|
-
"alwaysAddToPackageJson": false
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
56
|
}
|
|
56
|
-
}
|
|
57
57
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/workspace",
|
|
3
|
-
"version": "22.7.0-beta.
|
|
3
|
+
"version": "22.7.0-beta.10",
|
|
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": {
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"CLI"
|
|
21
21
|
],
|
|
22
22
|
"main": "./index.js",
|
|
23
|
-
"
|
|
23
|
+
"type": "commonjs",
|
|
24
|
+
"types": "./index.d.ts",
|
|
24
25
|
"author": "Victor Savkin",
|
|
25
26
|
"license": "MIT",
|
|
26
27
|
"bugs": {
|
|
@@ -38,22 +39,20 @@
|
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
|
-
"@nx/devkit": "22.7.0-beta.
|
|
42
|
+
"@nx/devkit": "22.7.0-beta.10",
|
|
42
43
|
"@zkochan/js-yaml": "0.0.7",
|
|
43
44
|
"chalk": "^4.1.0",
|
|
44
45
|
"enquirer": "~2.3.6",
|
|
45
|
-
"picomatch": "4.0.
|
|
46
|
+
"picomatch": "4.0.4",
|
|
46
47
|
"semver": "^7.6.3",
|
|
47
48
|
"tslib": "^2.3.0",
|
|
48
49
|
"yargs-parser": "21.1.1",
|
|
49
|
-
"nx": "22.7.0-beta.
|
|
50
|
+
"nx": "22.7.0-beta.10"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"nx": "22.7.0-beta.
|
|
53
|
+
"nx": "22.7.0-beta.10"
|
|
53
54
|
},
|
|
54
55
|
"publishConfig": {
|
|
55
56
|
"access": "public"
|
|
56
|
-
}
|
|
57
|
-
"types": "./index.d.ts",
|
|
58
|
-
"type": "commonjs"
|
|
57
|
+
}
|
|
59
58
|
}
|
package/project.json
CHANGED
|
@@ -6,77 +6,8 @@
|
|
|
6
6
|
"targets": {
|
|
7
7
|
"build": {
|
|
8
8
|
"outputs": ["{workspaceRoot}/dist/packages/workspace/README.md"],
|
|
9
|
-
"command": "node ./scripts/copy-readme.js workspace"
|
|
10
|
-
|
|
11
|
-
"legacy-post-build": {
|
|
12
|
-
"executor": "@nx/workspace-plugin:legacy-post-build",
|
|
13
|
-
"options": {
|
|
14
|
-
"tsConfig": "./tsconfig.lib.json",
|
|
15
|
-
"assets": [
|
|
16
|
-
{
|
|
17
|
-
"input": "packages/workspace",
|
|
18
|
-
"glob": "**/files/**",
|
|
19
|
-
"output": "/"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"input": "packages/workspace",
|
|
23
|
-
"glob": "**/files/**/.gitkeep",
|
|
24
|
-
"output": "/"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"input": "packages/workspace",
|
|
28
|
-
"glob": "**/files-integrated-repo/**",
|
|
29
|
-
"output": "/"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"input": "packages/workspace",
|
|
33
|
-
"glob": "**/files-integrated-repo/**/.gitkeep",
|
|
34
|
-
"output": "/"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"input": "packages/workspace",
|
|
38
|
-
"glob": "**/files-package-based-repo/**",
|
|
39
|
-
"output": "/"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"input": "packages/workspace",
|
|
43
|
-
"glob": "**/files-readme/**",
|
|
44
|
-
"output": "/"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"glob": "**/files-packaged-based-repo/**/.gitkeep",
|
|
48
|
-
"input": "packages/workspace",
|
|
49
|
-
"output": "/"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"input": "packages/workspace",
|
|
53
|
-
"glob": "**/files-root-app/**",
|
|
54
|
-
"output": "/"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"input": "packages/workspace",
|
|
58
|
-
"glob": "**/*.json",
|
|
59
|
-
"ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
|
|
60
|
-
"output": "/"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"input": "packages/workspace",
|
|
64
|
-
"glob": "**/*.{js,css,html,svg}",
|
|
65
|
-
"ignore": ["**/jest.config.js"],
|
|
66
|
-
"output": "/"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"input": "packages/workspace",
|
|
70
|
-
"glob": "**/*.d.ts",
|
|
71
|
-
"output": "/"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"input": "",
|
|
75
|
-
"glob": "LICENSE",
|
|
76
|
-
"output": "/"
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
}
|
|
9
|
+
"command": "node ./scripts/copy-readme.js workspace",
|
|
10
|
+
"inputs": ["copyReadme"]
|
|
80
11
|
},
|
|
81
12
|
"add-extra-dependencies": {
|
|
82
13
|
"command": "node ./scripts/add-dependency-to-build.js workspace nx"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateCypressConfig = updateCypressConfig;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path = tslib_1.__importStar(require("path"));
|
|
5
6
|
/**
|
|
6
7
|
* Updates the videos and screenshots folders in the cypress.json/cypress.config.ts if it exists (i.e. we're moving an e2e project)
|
|
7
8
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-owners-and-conformance.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-owners-and-conformance.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EAEL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gBAAgB,QA4BzB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateOwnersAndConformance = updateOwnersAndConformance;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function updateOwnersAndConformance(tree, schema) {
|
|
6
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
let changed = false;
|
|
8
|
+
if (renameProjectInConformanceRules(nxJson, schema.projectName, schema.newProjectName)) {
|
|
9
|
+
changed = true;
|
|
10
|
+
}
|
|
11
|
+
if (renameProjectInOwnersPatterns(nxJson, schema.projectName, schema.newProjectName)) {
|
|
12
|
+
changed = true;
|
|
13
|
+
}
|
|
14
|
+
if (changed) {
|
|
15
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function renameProjectInConformanceRules(nxJson, oldName, newName) {
|
|
19
|
+
const conformance = nxJson['conformance'];
|
|
20
|
+
if (!conformance?.rules) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
let changed = false;
|
|
24
|
+
for (const rule of conformance.rules) {
|
|
25
|
+
if (!rule.projects) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
for (let i = 0; i < rule.projects.length; i++) {
|
|
29
|
+
const entry = rule.projects[i];
|
|
30
|
+
if (typeof entry === 'string' && entry === oldName) {
|
|
31
|
+
rule.projects[i] = newName;
|
|
32
|
+
changed = true;
|
|
33
|
+
}
|
|
34
|
+
else if (typeof entry === 'object' && entry.matcher === oldName) {
|
|
35
|
+
entry.matcher = newName;
|
|
36
|
+
changed = true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return changed;
|
|
41
|
+
}
|
|
42
|
+
function renameProjectInOwnersPatterns(nxJson, oldName, newName) {
|
|
43
|
+
const owners = nxJson['owners'];
|
|
44
|
+
if (typeof owners !== 'object' || !owners) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
let changed = false;
|
|
48
|
+
if (owners.patterns) {
|
|
49
|
+
if (renameInPatternsList(owners.patterns, oldName, newName)) {
|
|
50
|
+
changed = true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (owners.sections) {
|
|
54
|
+
for (const section of owners.sections) {
|
|
55
|
+
if (section.patterns) {
|
|
56
|
+
if (renameInPatternsList(section.patterns, oldName, newName)) {
|
|
57
|
+
changed = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return changed;
|
|
63
|
+
}
|
|
64
|
+
function renameInPatternsList(patterns, oldName, newName) {
|
|
65
|
+
let changed = false;
|
|
66
|
+
for (const pattern of patterns) {
|
|
67
|
+
if (!pattern.projects) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
for (let i = 0; i < pattern.projects.length; i++) {
|
|
71
|
+
if (pattern.projects[i] === oldName) {
|
|
72
|
+
pattern.projects[i] = newName;
|
|
73
|
+
changed = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return changed;
|
|
78
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updatePackageJson = updatePackageJson;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const path = require("path");
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
7
|
/**
|
|
7
8
|
* Updates the name in the package.json if it exists.
|
|
8
9
|
*
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateProjectRootFiles = updateProjectRootFiles;
|
|
4
4
|
exports.updateFilesForRootProjects = updateFilesForRootProjects;
|
|
5
5
|
exports.updateFilesForNonRootProjects = updateFilesForNonRootProjects;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const path = require("path");
|
|
8
|
+
const path = tslib_1.__importStar(require("path"));
|
|
8
9
|
const path_1 = require("path");
|
|
9
10
|
const allowedExt = ['.ts', '.js', '.json', '.cts', '.cjs'];
|
|
10
11
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateStorybookConfig = updateStorybookConfig;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const path = require("path");
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
6
7
|
const path_1 = require("path");
|
|
7
8
|
/**
|
|
8
9
|
* Updates relative path to root storybook config for `main.js` & `webpack.config.js`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/move/move.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/move/move.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAyBpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,8BA8DhE;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -16,6 +16,7 @@ const update_default_project_1 = require("./lib/update-default-project");
|
|
|
16
16
|
const update_eslint_config_1 = require("./lib/update-eslint-config");
|
|
17
17
|
const update_implicit_dependencies_1 = require("./lib/update-implicit-dependencies");
|
|
18
18
|
const update_imports_1 = require("./lib/update-imports");
|
|
19
|
+
const update_owners_and_conformance_1 = require("./lib/update-owners-and-conformance");
|
|
19
20
|
const update_jest_config_1 = require("./lib/update-jest-config");
|
|
20
21
|
const update_package_json_1 = require("./lib/update-package-json");
|
|
21
22
|
const update_project_root_files_1 = require("./lib/update-project-root-files");
|
|
@@ -46,6 +47,7 @@ async function moveGenerator(tree, rawSchema) {
|
|
|
46
47
|
(0, update_build_targets_1.updateBuildTargets)(tree, schema);
|
|
47
48
|
(0, update_default_project_1.updateDefaultProject)(tree, schema);
|
|
48
49
|
(0, update_implicit_dependencies_1.updateImplicitDependencies)(tree, schema);
|
|
50
|
+
(0, update_owners_and_conformance_1.updateOwnersAndConformance)(tree, schema);
|
|
49
51
|
if (projectConfig.root === '.') {
|
|
50
52
|
// we want to migrate eslint config once the root project files are moved
|
|
51
53
|
(0, extract_base_configs_1.maybeMigrateEslintConfigIfRootProject)(tree, projectConfig);
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addPresetDependencies = addPresetDependencies;
|
|
4
4
|
exports.generatePreset = generatePreset;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
7
|
const presets_1 = require("../utils/presets");
|
|
7
8
|
const versions_1 = require("../../utils/versions");
|
|
8
9
|
const get_npm_package_version_1 = require("../utils/get-npm-package-version");
|
|
9
10
|
const path_1 = require("path");
|
|
10
|
-
const
|
|
11
|
+
const yargs_parser_1 = tslib_1.__importDefault(require("yargs-parser"));
|
|
11
12
|
const child_process_1 = require("child_process");
|
|
12
13
|
const installation_directory_1 = require("nx/src/utils/installation-directory");
|
|
13
14
|
function addPresetDependencies(host, options) {
|
|
@@ -15,7 +16,7 @@ function addPresetDependencies(host, options) {
|
|
|
15
16
|
return (0, devkit_1.addDependenciesToPackageJson)(host, dependencies, dev, (0, path_1.join)(options.directory, 'package.json'));
|
|
16
17
|
}
|
|
17
18
|
function generatePreset(host, opts) {
|
|
18
|
-
const parsedArgs =
|
|
19
|
+
const parsedArgs = (0, yargs_parser_1.default)(process.argv, {
|
|
19
20
|
boolean: ['interactive'],
|
|
20
21
|
default: {
|
|
21
22
|
interactive: true,
|
|
@@ -21,7 +21,7 @@ async function newGenerator(tree, opts) {
|
|
|
21
21
|
(0, child_process_1.execSync)(pmc.preInstall, {
|
|
22
22
|
cwd: (0, devkit_1.joinPathFragments)(tree.root, options.directory),
|
|
23
23
|
stdio: process.env.NX_GENERATE_QUIET === 'true' ? 'ignore' : 'inherit',
|
|
24
|
-
windowsHide:
|
|
24
|
+
windowsHide: true,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
(0, devkit_1.installPackagesTask)(tree, false, options.directory, options.packageManager);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-project-references-in-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/remove/lib/remove-project-references-in-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"remove-project-references-in-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/remove/lib/remove-project-references-in-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAIL,IAAI,EAGL,MAAM,YAAY,CAAC;AAEpB,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAsCzE"}
|
|
@@ -3,10 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.removeProjectReferencesInConfig = removeProjectReferencesInConfig;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function removeProjectReferencesInConfig(tree, schema) {
|
|
6
|
-
// Unset default project if deleting the default project
|
|
7
6
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
let nxJsonChanged = false;
|
|
8
|
+
// Unset default project if deleting the default project
|
|
8
9
|
if (nxJson.defaultProject && nxJson.defaultProject === schema.projectName) {
|
|
9
10
|
delete nxJson.defaultProject;
|
|
11
|
+
nxJsonChanged = true;
|
|
12
|
+
}
|
|
13
|
+
// Remove project from conformance rules
|
|
14
|
+
if (removeProjectFromConformanceRules(nxJson, schema.projectName)) {
|
|
15
|
+
nxJsonChanged = true;
|
|
16
|
+
}
|
|
17
|
+
// Remove project from owners patterns
|
|
18
|
+
if (removeProjectFromOwnersPatterns(nxJson, schema.projectName)) {
|
|
19
|
+
nxJsonChanged = true;
|
|
20
|
+
}
|
|
21
|
+
if (nxJsonChanged) {
|
|
10
22
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
11
23
|
}
|
|
12
24
|
// Remove implicit dependencies onto removed project
|
|
@@ -18,3 +30,77 @@ function removeProjectReferencesInConfig(tree, schema) {
|
|
|
18
30
|
}
|
|
19
31
|
});
|
|
20
32
|
}
|
|
33
|
+
function removeProjectFromConformanceRules(nxJson, projectName) {
|
|
34
|
+
const conformance = nxJson['conformance'];
|
|
35
|
+
if (!conformance?.rules) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
let changed = false;
|
|
39
|
+
// Iterate backwards so that splicing doesn't shift unvisited indices
|
|
40
|
+
for (let i = conformance.rules.length - 1; i >= 0; i--) {
|
|
41
|
+
const rule = conformance.rules[i];
|
|
42
|
+
if (!rule.projects) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const originalLength = rule.projects.length;
|
|
46
|
+
rule.projects = rule.projects.filter((entry) => {
|
|
47
|
+
if (typeof entry === 'string') {
|
|
48
|
+
return entry !== projectName;
|
|
49
|
+
}
|
|
50
|
+
if (typeof entry === 'object' && entry.matcher) {
|
|
51
|
+
return entry.matcher !== projectName;
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
});
|
|
55
|
+
if (rule.projects.length !== originalLength) {
|
|
56
|
+
changed = true;
|
|
57
|
+
if (rule.projects.length === 0) {
|
|
58
|
+
conformance.rules.splice(i, 1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return changed;
|
|
63
|
+
}
|
|
64
|
+
function removeProjectFromOwnersPatterns(nxJson, projectName) {
|
|
65
|
+
const owners = nxJson['owners'];
|
|
66
|
+
if (typeof owners !== 'object' || !owners) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
let changed = false;
|
|
70
|
+
// Filter top-level patterns
|
|
71
|
+
if (owners.patterns) {
|
|
72
|
+
if (filterOwnersPatternsList(owners.patterns, projectName)) {
|
|
73
|
+
changed = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Filter section-level patterns (GitLab)
|
|
77
|
+
if (owners.sections) {
|
|
78
|
+
for (const section of owners.sections) {
|
|
79
|
+
if (section.patterns) {
|
|
80
|
+
if (filterOwnersPatternsList(section.patterns, projectName)) {
|
|
81
|
+
changed = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return changed;
|
|
87
|
+
}
|
|
88
|
+
function filterOwnersPatternsList(patterns, projectName) {
|
|
89
|
+
let changed = false;
|
|
90
|
+
// Iterate backwards so that splicing doesn't shift unvisited indices
|
|
91
|
+
for (let i = patterns.length - 1; i >= 0; i--) {
|
|
92
|
+
const pattern = patterns[i];
|
|
93
|
+
if (!pattern.projects) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const originalLength = pattern.projects.length;
|
|
97
|
+
pattern.projects = pattern.projects.filter((entry) => entry !== projectName);
|
|
98
|
+
if (pattern.projects.length !== originalLength) {
|
|
99
|
+
changed = true;
|
|
100
|
+
if (pattern.projects.length === 0) {
|
|
101
|
+
patterns.splice(i, 1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return changed;
|
|
106
|
+
}
|
|
@@ -16,7 +16,7 @@ function getNpmPackageVersion(packageName, packageVersion) {
|
|
|
16
16
|
const npmBin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
17
17
|
const version = require('child_process').execFileSync(npmBin, ['view', packageSpec, 'version', '--json'], {
|
|
18
18
|
stdio: ['pipe', 'pipe', 'ignore'],
|
|
19
|
-
windowsHide:
|
|
19
|
+
windowsHide: true,
|
|
20
20
|
});
|
|
21
21
|
if (version) {
|
|
22
22
|
// package@1.12 => ["1.12.0", "1.12.1"]
|
package/src/utils/output.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.output = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk = tslib_1.__importStar(require("chalk"));
|
|
5
6
|
/**
|
|
6
7
|
* Automatically disable styling applied by chalk if CI=true
|
|
7
8
|
*/
|