@nx/workspace 22.7.0-pr.34971.73bed1f → 22.7.0-pr.35356.e1b62ce
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/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +1 -1
- package/src/generators/move/lib/update-imports.js +12 -5
- 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/move.d.ts.map +1 -1
- package/src/generators/move/move.js +2 -0
- 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/remove/lib/update-tsconfig.d.ts.map +1 -1
- package/src/generators/remove/lib/update-tsconfig.js +2 -1
- package/jest-mocks/prettier.js +0 -111
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-pr.
|
|
3
|
+
"version": "22.7.0-pr.35356.e1b62ce",
|
|
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-pr.
|
|
42
|
+
"@nx/devkit": "22.7.0-pr.35356.e1b62ce",
|
|
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-pr.
|
|
50
|
+
"nx": "22.7.0-pr.35356.e1b62ce"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"nx": "22.7.0-pr.
|
|
53
|
+
"nx": "22.7.0-pr.35356.e1b62ce"
|
|
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"
|
package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__
CHANGED
|
@@ -48,7 +48,7 @@ jobs:
|
|
|
48
48
|
- run: <%= packageManagerInstall %><% if(hasCypress){ %>
|
|
49
49
|
- run: <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
|
|
50
50
|
- run: <%= packageManagerPrefix %> playwright install --with-deps<% } %><% if(!useRunMany){ %>
|
|
51
|
-
- uses: nrwl/nx-set-shas@
|
|
51
|
+
- uses: nrwl/nx-set-shas@v5<% } %>
|
|
52
52
|
|
|
53
53
|
<% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
|
|
54
54
|
# <%- comment %><% } %><% } %><% if (command.command) { %>
|
|
@@ -35,12 +35,12 @@ function updateImports(tree, schema, project) {
|
|
|
35
35
|
if (tree.exists(tsConfigPath)) {
|
|
36
36
|
tsConfig = (0, devkit_1.readJson)(tree, tsConfigPath);
|
|
37
37
|
const sourceRoot = (0, project_config_1.getProjectSourceRoot)(project, tree);
|
|
38
|
-
mainEntryPointImportPath = Object.keys(tsConfig.compilerOptions?.paths ?? {}).find((path) => tsConfig.compilerOptions.paths[path].some((x) => x.startsWith(ensureTrailingSlash(sourceRoot))));
|
|
39
|
-
secondaryEntryPointImportPaths = Object.keys(tsConfig.compilerOptions?.paths ?? {}).filter((path) => tsConfig.compilerOptions.paths[path].some((x) => x.startsWith(ensureTrailingSlash(project.root)) &&
|
|
40
|
-
!x.startsWith(ensureTrailingSlash(sourceRoot))));
|
|
38
|
+
mainEntryPointImportPath = Object.keys(tsConfig.compilerOptions?.paths ?? {}).find((path) => tsConfig.compilerOptions.paths[path].some((x) => stripDotSlash(x).startsWith(ensureTrailingSlash(sourceRoot))));
|
|
39
|
+
secondaryEntryPointImportPaths = Object.keys(tsConfig.compilerOptions?.paths ?? {}).filter((path) => tsConfig.compilerOptions.paths[path].some((x) => stripDotSlash(x).startsWith(ensureTrailingSlash(project.root)) &&
|
|
40
|
+
!stripDotSlash(x).startsWith(ensureTrailingSlash(sourceRoot))));
|
|
41
41
|
// Next.js libs have a custom path for the server we need to update that as well
|
|
42
42
|
// example "paths": { @acme/lib/server : ['libs/lib/src/server.ts'] }
|
|
43
|
-
serverEntryPointImportPath = Object.keys(tsConfig.compilerOptions?.paths ?? {}).find((path) => tsConfig.compilerOptions.paths[path].some((x) => x.startsWith(ensureTrailingSlash(sourceRoot)) &&
|
|
43
|
+
serverEntryPointImportPath = Object.keys(tsConfig.compilerOptions?.paths ?? {}).find((path) => tsConfig.compilerOptions.paths[path].some((x) => stripDotSlash(x).startsWith(ensureTrailingSlash(sourceRoot)) &&
|
|
44
44
|
x.includes('server') &&
|
|
45
45
|
path.endsWith('server')));
|
|
46
46
|
}
|
|
@@ -130,7 +130,11 @@ function updateTsConfigPaths(tsConfig, projectRef, tsConfigPath, projectRoot, sc
|
|
|
130
130
|
`${tsConfigPath} compilerOptions.paths`,
|
|
131
131
|
].join(' '));
|
|
132
132
|
}
|
|
133
|
-
const updatedPath = path.map((x) =>
|
|
133
|
+
const updatedPath = path.map((x) => {
|
|
134
|
+
const hadDotSlash = x.startsWith('./');
|
|
135
|
+
const result = (0, devkit_1.joinPathFragments)(projectRoot.to, (0, path_1.relative)(projectRoot.from, stripDotSlash(x)));
|
|
136
|
+
return hadDotSlash && !result.startsWith('./') ? `./${result}` : result;
|
|
137
|
+
});
|
|
134
138
|
if (schema.updateImportPath && projectRef.to) {
|
|
135
139
|
tsConfig.compilerOptions.paths[projectRef.to] = updatedPath;
|
|
136
140
|
if (projectRef.from !== projectRef.to) {
|
|
@@ -144,6 +148,9 @@ function updateTsConfigPaths(tsConfig, projectRef, tsConfigPath, projectRoot, sc
|
|
|
144
148
|
function ensureTrailingSlash(path) {
|
|
145
149
|
return path.endsWith('/') ? path : `${path}/`;
|
|
146
150
|
}
|
|
151
|
+
function stripDotSlash(path) {
|
|
152
|
+
return path.startsWith('./') ? path.slice(2) : path;
|
|
153
|
+
}
|
|
147
154
|
/**
|
|
148
155
|
* Changes imports in a file from one import to another
|
|
149
156
|
*/
|
|
@@ -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 +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);
|
|
@@ -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
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-tsconfig.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/remove/lib/update-tsconfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EAEL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAQnC;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"update-tsconfig.d.ts","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/remove/lib/update-tsconfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EAEL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAQnC;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAoC9D"}
|
|
@@ -31,7 +31,8 @@ async function updateTsconfig(tree, schema) {
|
|
|
31
31
|
else {
|
|
32
32
|
for (const importPath in json.compilerOptions.paths) {
|
|
33
33
|
for (const path of json.compilerOptions.paths[importPath]) {
|
|
34
|
-
const
|
|
34
|
+
const normalized = (0, devkit_1.normalizePath)(path).replace(/^\.\//, '');
|
|
35
|
+
const project = (0, find_project_for_path_1.findProjectForPath)(normalized, projectMapping);
|
|
35
36
|
if (project === schema.projectName) {
|
|
36
37
|
delete json.compilerOptions.paths[importPath];
|
|
37
38
|
break;
|
package/jest-mocks/prettier.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
const prettierDir = path.dirname(
|
|
4
|
-
require.resolve('prettier', {
|
|
5
|
-
paths: [path.join(__dirname, '../../../node_modules')],
|
|
6
|
-
})
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
// Load standalone prettier (no dynamic imports)
|
|
10
|
-
const standalone = require(path.join(prettierDir, 'standalone.js'));
|
|
11
|
-
|
|
12
|
-
// Pre-load CJS parser plugins (no dynamic imports)
|
|
13
|
-
const pluginNames = [
|
|
14
|
-
'babel',
|
|
15
|
-
'estree',
|
|
16
|
-
'typescript',
|
|
17
|
-
'html',
|
|
18
|
-
'postcss',
|
|
19
|
-
'markdown',
|
|
20
|
-
'angular',
|
|
21
|
-
'yaml',
|
|
22
|
-
];
|
|
23
|
-
const plugins = pluginNames.map((name) =>
|
|
24
|
-
require(path.join(prettierDir, 'plugins', `${name}.js`))
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
const prettierMock = {
|
|
28
|
-
...standalone,
|
|
29
|
-
resolveConfig: async () => null,
|
|
30
|
-
resolveConfigFile: async () => null,
|
|
31
|
-
clearConfigCache: () => {},
|
|
32
|
-
getFileInfo: async (filePath) => {
|
|
33
|
-
const ext = path.extname(filePath);
|
|
34
|
-
const parserMap = {
|
|
35
|
-
'.ts': 'typescript',
|
|
36
|
-
'.tsx': 'typescript',
|
|
37
|
-
'.js': 'babel',
|
|
38
|
-
'.jsx': 'babel',
|
|
39
|
-
'.mjs': 'babel',
|
|
40
|
-
'.cjs': 'babel',
|
|
41
|
-
'.json': 'json',
|
|
42
|
-
'.css': 'css',
|
|
43
|
-
'.scss': 'scss',
|
|
44
|
-
'.less': 'less',
|
|
45
|
-
'.html': 'html',
|
|
46
|
-
'.md': 'markdown',
|
|
47
|
-
'.yaml': 'yaml',
|
|
48
|
-
'.yml': 'yaml',
|
|
49
|
-
};
|
|
50
|
-
return { ignored: false, inferredParser: parserMap[ext] || null };
|
|
51
|
-
},
|
|
52
|
-
async format(source, options = {}) {
|
|
53
|
-
try {
|
|
54
|
-
return await standalone.format(source, {
|
|
55
|
-
...options,
|
|
56
|
-
plugins: [...plugins, ...(options.plugins || [])],
|
|
57
|
-
});
|
|
58
|
-
} catch (e) {
|
|
59
|
-
return source;
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
async check(source, options = {}) {
|
|
63
|
-
try {
|
|
64
|
-
return await standalone.check(source, {
|
|
65
|
-
...options,
|
|
66
|
-
plugins: [...plugins, ...(options.plugins || [])],
|
|
67
|
-
});
|
|
68
|
-
} catch (e) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
async formatWithCursor(source, options = {}) {
|
|
73
|
-
try {
|
|
74
|
-
return await standalone.formatWithCursor(source, {
|
|
75
|
-
...options,
|
|
76
|
-
plugins: [...plugins, ...(options.plugins || [])],
|
|
77
|
-
});
|
|
78
|
-
} catch (e) {
|
|
79
|
-
return { formatted: source, cursorOffset: options.cursorOffset || 0 };
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const handler = {
|
|
85
|
-
get(target, prop) {
|
|
86
|
-
if (prop === '__esModule') return true;
|
|
87
|
-
if (prop === 'default') return prettierMock;
|
|
88
|
-
return prettierMock[prop];
|
|
89
|
-
},
|
|
90
|
-
has(target, prop) {
|
|
91
|
-
return prop === '__esModule' || prop === 'default' || prop in prettierMock;
|
|
92
|
-
},
|
|
93
|
-
ownKeys() {
|
|
94
|
-
return [...Object.keys(prettierMock), '__esModule', 'default'];
|
|
95
|
-
},
|
|
96
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
97
|
-
if (prop === '__esModule')
|
|
98
|
-
return { configurable: true, enumerable: true, value: true };
|
|
99
|
-
if (prop === 'default')
|
|
100
|
-
return { configurable: true, enumerable: true, value: prettierMock };
|
|
101
|
-
if (prop in prettierMock)
|
|
102
|
-
return {
|
|
103
|
-
configurable: true,
|
|
104
|
-
enumerable: true,
|
|
105
|
-
value: prettierMock[prop],
|
|
106
|
-
};
|
|
107
|
-
return undefined;
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
module.exports = new Proxy({}, handler);
|