@nx/workspace 19.1.0-canary.20240510-1a85787 → 19.1.0-canary.20240514-cc9b7f3
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/ci-workflow.js +2 -1
- package/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ +3 -2
- package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ +4 -3
- package/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ +3 -2
- package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +3 -2
- package/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ +3 -2
- package/src/generators/move/lib/update-imports.js +14 -0
- package/src/generators/remove/lib/update-jest-config.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/workspace",
|
|
3
|
-
"version": "19.1.0-canary.
|
|
3
|
+
"version": "19.1.0-canary.20240514-cc9b7f3",
|
|
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,13 +61,13 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@nx/devkit": "19.1.0-canary.
|
|
64
|
+
"@nx/devkit": "19.1.0-canary.20240514-cc9b7f3",
|
|
65
65
|
"chalk": "^4.1.0",
|
|
66
66
|
"enquirer": "~2.3.6",
|
|
67
67
|
"tslib": "^2.3.0",
|
|
68
68
|
"yargs-parser": "21.1.1",
|
|
69
|
-
"nx": "19.1.0-canary.
|
|
70
|
-
"@nrwl/workspace": "19.1.0-canary.
|
|
69
|
+
"nx": "19.1.0-canary.20240514-cc9b7f3",
|
|
70
|
+
"@nrwl/workspace": "19.1.0-canary.20240514-cc9b7f3"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
@@ -19,7 +19,7 @@ exports.ciWorkflowGenerator = ciWorkflowGenerator;
|
|
|
19
19
|
function normalizeOptions(options, tree) {
|
|
20
20
|
const { name: workflowName, fileName: workflowFileName } = (0, devkit_1.names)(options.name);
|
|
21
21
|
const packageManager = (0, devkit_1.detectPackageManager)();
|
|
22
|
-
const { exec: packageManagerPrefix, ciInstall: packageManagerInstall } = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
22
|
+
const { exec: packageManagerPrefix, ciInstall: packageManagerInstall, dlx: packageManagerPreInstallPrefix, } = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
23
23
|
let nxCloudHost = 'nx.app';
|
|
24
24
|
try {
|
|
25
25
|
const nxCloudUrl = (0, nx_cloud_utils_1.getNxCloudUrl)((0, devkit_1.readJson)(tree, 'nx.json'));
|
|
@@ -38,6 +38,7 @@ function normalizeOptions(options, tree) {
|
|
|
38
38
|
packageManager,
|
|
39
39
|
packageManagerInstall,
|
|
40
40
|
packageManagerPrefix,
|
|
41
|
+
packageManagerPreInstallPrefix,
|
|
41
42
|
mainBranch: (0, default_base_1.deduceDefaultBase)(),
|
|
42
43
|
hasE2E,
|
|
43
44
|
nxCloudHost,
|
|
@@ -48,7 +48,7 @@ jobs:
|
|
|
48
48
|
<% } %>
|
|
49
49
|
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
|
50
50
|
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
|
|
51
|
-
# - script: <%=
|
|
51
|
+
# - script: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
52
52
|
|
|
53
53
|
- script: <%= packageManagerInstall %>
|
|
54
54
|
- script: git branch --track <%= mainBranch %> origin/<%= mainBranch %>
|
|
@@ -56,4 +56,5 @@ jobs:
|
|
|
56
56
|
|
|
57
57
|
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
|
|
58
58
|
# - script: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
|
|
59
|
-
- script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA)
|
|
59
|
+
- script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) lint test build<% if(hasE2E){ %>
|
|
60
|
+
- script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --parallel 1 e2e-ci<% } %>
|
package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__
CHANGED
|
@@ -17,12 +17,13 @@ pipelines:
|
|
|
17
17
|
<% } %>
|
|
18
18
|
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
|
19
19
|
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
|
|
20
|
-
# - <%=
|
|
20
|
+
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
21
21
|
|
|
22
22
|
- <%= packageManagerInstall %>
|
|
23
23
|
|
|
24
24
|
- <%= packageManagerPrefix %> nx-cloud record -- nx format:check
|
|
25
|
-
- <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %>
|
|
25
|
+
- <%= packageManagerPrefix %> nx affected --base=origin/<%= mainBranch %> -t lint test build<% if(hasE2E){ %>
|
|
26
|
+
- <%= packageManagerPrefix %> nx affected --base=origin/<%= mainBranch %> --parallel 1 -t e2e-ci<% } %>
|
|
26
27
|
|
|
27
28
|
branches:
|
|
28
29
|
main:
|
|
@@ -32,7 +33,7 @@ pipelines:
|
|
|
32
33
|
- export NX_BRANCH=$BITBUCKET_BRANCH
|
|
33
34
|
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
|
34
35
|
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
|
|
35
|
-
# - <%=
|
|
36
|
+
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
36
37
|
|
|
37
38
|
<% if(packageManager == 'pnpm'){ %>
|
|
38
39
|
- npm install --prefix=$HOME/.local -g pnpm@8
|
|
@@ -17,7 +17,7 @@ jobs:
|
|
|
17
17
|
|
|
18
18
|
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
|
19
19
|
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
|
|
20
|
-
# - run: <%=
|
|
20
|
+
# - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
21
21
|
|
|
22
22
|
- run: <%= packageManagerInstall %>
|
|
23
23
|
- nx/set-shas:
|
|
@@ -25,7 +25,8 @@ jobs:
|
|
|
25
25
|
|
|
26
26
|
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
|
|
27
27
|
# - run: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
|
|
28
|
-
- run: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build<% if(hasE2E){ %>
|
|
28
|
+
- run: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build<% if(hasE2E){ %>
|
|
29
|
+
- run: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --parallel 1 -t e2e-ci<% } %>
|
|
29
30
|
|
|
30
31
|
workflows:
|
|
31
32
|
version: 2
|
package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__
CHANGED
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
|
|
26
26
|
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
|
27
27
|
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
|
|
28
|
-
# - run: <%=
|
|
28
|
+
# - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
29
29
|
|
|
30
30
|
# Cache node_modules
|
|
31
31
|
- uses: actions/setup-node@v3
|
|
@@ -37,4 +37,5 @@ jobs:
|
|
|
37
37
|
|
|
38
38
|
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
|
|
39
39
|
# - run: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
|
|
40
|
-
- run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %>
|
|
40
|
+
- run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %>
|
|
41
|
+
- run: <%= packageManagerPrefix %> nx affected --parallel 1 -t e2e-ci<% } %>
|
|
@@ -14,7 +14,7 @@ variables:
|
|
|
14
14
|
<% } %>
|
|
15
15
|
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
|
16
16
|
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>" targets have been requested
|
|
17
|
-
# - <%=
|
|
17
|
+
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
18
18
|
|
|
19
19
|
- <%= packageManagerInstall %>
|
|
20
20
|
- NX_HEAD=$CI_COMMIT_SHA
|
|
@@ -22,4 +22,5 @@ variables:
|
|
|
22
22
|
|
|
23
23
|
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
|
|
24
24
|
# - <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
|
|
25
|
-
- <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build<% if(hasE2E){ %>
|
|
25
|
+
- <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build<% if(hasE2E){ %>
|
|
26
|
+
- <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --parallel 1 -t e2e-ci<% } %>
|
|
@@ -25,12 +25,18 @@ function updateImports(tree, schema, project) {
|
|
|
25
25
|
let tsConfig;
|
|
26
26
|
let mainEntryPointImportPath;
|
|
27
27
|
let secondaryEntryPointImportPaths;
|
|
28
|
+
let serverEntryPointImportPath;
|
|
28
29
|
if (tree.exists(tsConfigPath)) {
|
|
29
30
|
tsConfig = (0, devkit_1.readJson)(tree, tsConfigPath);
|
|
30
31
|
const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
|
|
31
32
|
mainEntryPointImportPath = Object.keys(tsConfig.compilerOptions?.paths ?? {}).find((path) => tsConfig.compilerOptions.paths[path].some((x) => x.startsWith(ensureTrailingSlash(sourceRoot))));
|
|
32
33
|
secondaryEntryPointImportPaths = Object.keys(tsConfig.compilerOptions?.paths ?? {}).filter((path) => tsConfig.compilerOptions.paths[path].some((x) => x.startsWith(ensureTrailingSlash(project.root)) &&
|
|
33
34
|
!x.startsWith(ensureTrailingSlash(sourceRoot))));
|
|
35
|
+
// Next.js libs have a custom path for the server we need to update that as well
|
|
36
|
+
// example "paths": { @acme/lib/server : ['libs/lib/src/server.ts'] }
|
|
37
|
+
serverEntryPointImportPath = Object.keys(tsConfig.compilerOptions?.paths ?? {}).find((path) => tsConfig.compilerOptions.paths[path].some((x) => x.startsWith(ensureTrailingSlash(sourceRoot)) &&
|
|
38
|
+
x.includes('server') &&
|
|
39
|
+
path.endsWith('server')));
|
|
34
40
|
}
|
|
35
41
|
mainEntryPointImportPath ??= (0, utils_1.normalizePathSlashes)((0, get_import_path_1.getImportPath)(tree, project.root.slice(libsDir.length).replace(/^\/|\\/, '')));
|
|
36
42
|
const projectRefs = [
|
|
@@ -48,6 +54,14 @@ function updateImports(tree, schema, project) {
|
|
|
48
54
|
: null,
|
|
49
55
|
})),
|
|
50
56
|
];
|
|
57
|
+
if (serverEntryPointImportPath &&
|
|
58
|
+
schema.importPath &&
|
|
59
|
+
serverEntryPointImportPath.startsWith(mainEntryPointImportPath)) {
|
|
60
|
+
projectRefs.push({
|
|
61
|
+
from: serverEntryPointImportPath,
|
|
62
|
+
to: serverEntryPointImportPath.replace(mainEntryPointImportPath, schema.importPath),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
51
65
|
for (const projectRef of projectRefs) {
|
|
52
66
|
if (schema.updateImportPath && projectRef.to) {
|
|
53
67
|
const replaceProjectRef = new RegExp(projectRef.from, 'g');
|
|
@@ -38,7 +38,8 @@ function updateJestConfig(tree, schema, projectConfig) {
|
|
|
38
38
|
const { createSourceFile, ScriptTarget, isPropertyAssignment, isArrayLiteralExpression, isStringLiteral, } = tsModule;
|
|
39
39
|
const projectToRemove = schema.projectName;
|
|
40
40
|
const rootConfigPath = (0, jest_config_1.findRootJestConfig)(tree);
|
|
41
|
-
if (!
|
|
41
|
+
if (!rootConfigPath ||
|
|
42
|
+
!tree.exists(rootConfigPath) ||
|
|
42
43
|
!tree.exists((0, path_1.join)(projectConfig.root, 'jest.config.ts')) ||
|
|
43
44
|
isUsingUtilityFunction(tree) ||
|
|
44
45
|
!isMonorepoConfig(tree)) {
|