@nx/workspace 22.7.0-beta.12 → 22.7.0-beta.13
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/package.json +4 -4
- 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/remove/lib/update-tsconfig.d.ts.map +1 -1
- package/src/generators/remove/lib/update-tsconfig.js +2 -1
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.13",
|
|
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": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@nx/devkit": "22.7.0-beta.
|
|
42
|
+
"@nx/devkit": "22.7.0-beta.13",
|
|
43
43
|
"@zkochan/js-yaml": "0.0.7",
|
|
44
44
|
"chalk": "^4.1.0",
|
|
45
45
|
"enquirer": "~2.3.6",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"semver": "^7.6.3",
|
|
48
48
|
"tslib": "^2.3.0",
|
|
49
49
|
"yargs-parser": "21.1.1",
|
|
50
|
-
"nx": "22.7.0-beta.
|
|
50
|
+
"nx": "22.7.0-beta.13"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"nx": "22.7.0-beta.
|
|
53
|
+
"nx": "22.7.0-beta.13"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
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
|
*/
|
|
@@ -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;
|