@nx/workspace 19.1.0-canary.20240511-f7dcf43 → 19.1.0-canary.20240515-a2a7d7e
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__ +1 -1
- package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ +2 -2
- package/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ +1 -1
- package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +1 -1
- package/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ +1 -1
- package/src/generators/move/lib/update-imports.js +14 -0
- package/src/generators/new/generate-preset.d.ts +1 -1
- 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.20240515-a2a7d7e",
|
|
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.20240515-a2a7d7e",
|
|
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.20240515-a2a7d7e",
|
|
70
|
+
"@nrwl/workspace": "19.1.0-canary.20240515-a2a7d7e"
|
|
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 %>
|
package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__
CHANGED
|
@@ -17,7 +17,7 @@ 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
|
|
|
@@ -33,7 +33,7 @@ pipelines:
|
|
|
33
33
|
- export NX_BRANCH=$BITBUCKET_BRANCH
|
|
34
34
|
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
|
|
35
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
|
|
36
|
-
# - <%=
|
|
36
|
+
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
37
37
|
|
|
38
38
|
<% if(packageManager == 'pnpm'){ %>
|
|
39
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:
|
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
|
|
@@ -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
|
|
@@ -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');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { NormalizedSchema } from './new';
|
|
3
|
-
export declare function addPresetDependencies(host: Tree, options: NormalizedSchema): import("nx/
|
|
3
|
+
export declare function addPresetDependencies(host: Tree, options: NormalizedSchema): import("@nx/devkit").GeneratorCallback;
|
|
4
4
|
export declare function generatePreset(host: Tree, opts: NormalizedSchema): Promise<void>;
|
|
@@ -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)) {
|