@nx/workspace 21.3.0-beta.6 → 21.3.0-canary.20250614-db86a35

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/workspace",
3
- "version": "21.3.0-beta.6",
3
+ "version": "21.3.0-canary.20250614-db86a35",
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": {
@@ -38,14 +38,14 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@nx/devkit": "21.3.0-beta.6",
41
+ "@nx/devkit": "21.3.0-canary.20250614-db86a35",
42
42
  "@zkochan/js-yaml": "0.0.7",
43
43
  "chalk": "^4.1.0",
44
44
  "enquirer": "~2.3.6",
45
45
  "picomatch": "4.0.2",
46
46
  "tslib": "^2.3.0",
47
47
  "yargs-parser": "21.1.1",
48
- "nx": "21.3.0-beta.6"
48
+ "nx": "21.3.0-canary.20250614-db86a35"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"
@@ -1,12 +1,6 @@
1
1
  import { Tree } from '@nx/devkit';
2
- export type Command = {
3
- command?: string;
4
- comments?: string[];
5
- alwaysRun?: boolean;
6
- };
7
2
  export interface Schema {
8
3
  name: string;
9
4
  ci: 'github' | 'azure' | 'circleci' | 'bitbucket-pipelines' | 'gitlab';
10
- useRunMany?: boolean;
11
5
  }
12
6
  export declare function ciWorkflowGenerator(tree: Tree, schema: Schema): Promise<void>;
@@ -6,107 +6,6 @@ const default_base_1 = require("../../utilities/default-base");
6
6
  const path_1 = require("path");
7
7
  const nx_cloud_utils_1 = require("nx/src/utils/nx-cloud-utils");
8
8
  const ts_solution_setup_1 = require("../../utilities/typescript/ts-solution-setup");
9
- function getNxCloudRecordCommand(ci, packageManagerPrefix) {
10
- const baseCommand = `${packageManagerPrefix} nx-cloud record -- echo Hello World`;
11
- const prefix = getCiPrefix(ci);
12
- const exampleComment = `${prefix}${baseCommand}`;
13
- return {
14
- comments: [
15
- `Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud`,
16
- exampleComment,
17
- ],
18
- };
19
- }
20
- function getNxTasksCommand(ci, packageManagerPrefix, mainBranch, hasTypecheck, hasE2E, useRunMany = false) {
21
- const tasks = `lint test build${hasTypecheck ? ' typecheck' : ''}${hasE2E ? ' e2e' : ''}`;
22
- const commandType = useRunMany ? 'run-many' : 'affected';
23
- const nxCommandComments = useRunMany
24
- ? [
25
- `As your workspace grows, you can change this to use Nx Affected to run only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected`,
26
- ]
27
- : [
28
- `Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected`,
29
- ];
30
- if (hasE2E) {
31
- nxCommandComments.push(`When you enable task distribution, run the e2e-ci task instead of e2e`);
32
- }
33
- const args = getCiArgs(ci, mainBranch, useRunMany);
34
- const nxCommand = `${packageManagerPrefix} nx ${commandType} ${args}-t ${tasks}`;
35
- return {
36
- comments: nxCommandComments,
37
- command: nxCommand,
38
- };
39
- }
40
- function getNxCloudFixCiCommand(packageManagerPrefix) {
41
- return {
42
- comments: [
43
- `Nx Cloud recommends fixes for failures to help you get CI green faster. Learn more: https://nx.dev/ci/features/self-healing-ci`,
44
- ],
45
- command: `${packageManagerPrefix} nx fix-ci`,
46
- alwaysRun: true,
47
- };
48
- }
49
- function getCiCommands(ci, packageManagerPrefix, mainBranch, hasTypecheck, hasE2E, useRunMany = false) {
50
- return [
51
- getNxCloudRecordCommand(ci, packageManagerPrefix),
52
- getNxTasksCommand(ci, packageManagerPrefix, mainBranch, hasTypecheck, hasE2E, useRunMany),
53
- getNxCloudFixCiCommand(packageManagerPrefix),
54
- ];
55
- }
56
- function getCiPrefix(ci) {
57
- if (ci === 'github' || ci === 'circleci') {
58
- return '- run: ';
59
- }
60
- else if (ci === 'azure') {
61
- return '- script: ';
62
- }
63
- else if (ci === 'gitlab') {
64
- return '- ';
65
- }
66
- // Bitbucket expects just the command without prefix for pull requests
67
- return '';
68
- }
69
- function getCiArgs(ci, mainBranch, useRunMany = false) {
70
- // When using run-many, we don't need base/head SHA args
71
- if (useRunMany) {
72
- return '';
73
- }
74
- if (ci === 'azure') {
75
- return '--base=$(BASE_SHA) --head=$(HEAD_SHA) ';
76
- }
77
- else if (ci === 'bitbucket-pipelines') {
78
- return `--base=origin/${mainBranch} `;
79
- }
80
- return '';
81
- }
82
- function getBitbucketBranchCommands(packageManagerPrefix, hasTypecheck, hasE2E, useRunMany = false) {
83
- const tasks = `lint test build${hasTypecheck ? ' typecheck' : ''}${hasE2E ? ' e2e-ci' : ''}`;
84
- const nxCloudComments = [
85
- `Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud`,
86
- `- ${packageManagerPrefix} nx-cloud record -- echo Hello World`,
87
- ];
88
- // Build nx command comments and command
89
- const commandType = useRunMany ? 'run-many' : 'affected';
90
- const nxCommandComments = useRunMany
91
- ? [
92
- `As your workspace grows, you can change this to use Nx Affected to run only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected`,
93
- ]
94
- : [
95
- `Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected`,
96
- ];
97
- // Build command with conditional base arg
98
- const baseArg = useRunMany ? '' : ' --base=HEAD~1';
99
- const command = `${packageManagerPrefix} nx ${commandType} -t ${tasks}${baseArg}`;
100
- return [
101
- {
102
- comments: nxCloudComments,
103
- },
104
- {
105
- comments: nxCommandComments,
106
- command,
107
- },
108
- ];
109
- }
110
9
  async function ciWorkflowGenerator(tree, schema) {
111
10
  const ci = schema.ci;
112
11
  const options = normalizeOptions(schema, tree);
@@ -139,11 +38,6 @@ function normalizeOptions(options, tree) {
139
38
  const hasE2E = hasCypress || hasPlaywright;
140
39
  const hasTypecheck = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
141
40
  const connectedToCloud = (0, nx_cloud_utils_1.isNxCloudUsed)((0, devkit_1.readJson)(tree, 'nx.json'));
142
- const mainBranch = (0, default_base_1.deduceDefaultBase)();
143
- const commands = getCiCommands(options.ci, packageManagerPrefix, mainBranch, hasTypecheck, hasE2E, options.useRunMany ?? false);
144
- const branchCommands = options.ci === 'bitbucket-pipelines'
145
- ? getBitbucketBranchCommands(packageManagerPrefix, hasTypecheck, hasE2E, options.useRunMany ?? false)
146
- : undefined;
147
41
  return {
148
42
  workflowName,
149
43
  workflowFileName,
@@ -151,7 +45,7 @@ function normalizeOptions(options, tree) {
151
45
  packageManagerInstall,
152
46
  packageManagerPrefix,
153
47
  packageManagerPreInstallPrefix,
154
- mainBranch,
48
+ mainBranch: (0, default_base_1.deduceDefaultBase)(),
155
49
  packageManagerVersion: packageJson?.packageManager?.split('@')[1],
156
50
  hasCypress,
157
51
  hasE2E,
@@ -160,9 +54,6 @@ function normalizeOptions(options, tree) {
160
54
  nxCloudHost,
161
55
  tmpl: '',
162
56
  connectedToCloud,
163
- useRunMany: options.useRunMany ?? false,
164
- commands,
165
- branchCommands,
166
57
  };
167
58
  }
168
59
  function defaultBranchNeedsOriginPrefix(nxJson) {
@@ -8,13 +8,13 @@ pr:
8
8
  variables:
9
9
  CI: 'true'
10
10
  ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
11
- NX_BRANCH: $(System.PullRequest.PullRequestNumber)<% if(!useRunMany){ %>
11
+ NX_BRANCH: $(System.PullRequest.PullRequestNumber)
12
12
  TARGET_BRANCH: $[replace(variables['System.PullRequest.TargetBranch'],'refs/heads/','origin/')]
13
- BASE_SHA: $(git merge-base $(TARGET_BRANCH) HEAD)<% } %>
13
+ BASE_SHA: $(git merge-base $(TARGET_BRANCH) HEAD)
14
14
  ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
15
- NX_BRANCH: $(Build.SourceBranchName)<% if(!useRunMany){ %>
15
+ NX_BRANCH: $(Build.SourceBranchName)
16
16
  BASE_SHA: $(git rev-parse HEAD~1)
17
- HEAD_SHA: $(git rev-parse HEAD)<% } %>
17
+ HEAD_SHA: $(git rev-parse HEAD)
18
18
 
19
19
  jobs:
20
20
  - job: main
@@ -23,7 +23,7 @@ jobs:
23
23
  steps:
24
24
  - checkout: self
25
25
  fetchDepth: 0
26
- fetchFilter: tree:0<% if(!useRunMany){ %>
26
+ fetchFilter: tree:0
27
27
  # Set Azure Devops CLI default settings
28
28
  - bash: az devops configure --defaults organization=$(System.TeamFoundationCollectionUri) project=$(System.TeamProject)
29
29
  displayName: 'Set default Azure DevOps organization and project'
@@ -40,7 +40,7 @@ jobs:
40
40
  displayName: 'Get last successful commit SHA'
41
41
  condition: ne(variables['Build.Reason'], 'PullRequest')
42
42
  env:
43
- AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)<% } %>
43
+ AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
44
44
 
45
45
  <% if(packageManager == 'pnpm'){ %>
46
46
  - script: npm install --prefix=$HOME/.local -g pnpm@8
@@ -57,15 +57,16 @@ jobs:
57
57
  # Run this command as early as possible, before dependencies are installed
58
58
  # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
59
59
  <% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
60
- # - script: <%= packageManagerPreInstallPrefix %> nx start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
60
+ # - script: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
61
61
 
62
62
  - script: <%= packageManagerInstall %><% if(hasCypress){ %>
63
63
  - script: <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
64
- - script: <%= packageManagerPrefix %> playwright install --with-deps<% } %><% if(!useRunMany){ %>
64
+ - script: <%= packageManagerPrefix %> playwright install --with-deps<% } %>
65
65
  - script: git branch --track <%= mainBranch %> origin/<%= mainBranch %>
66
- condition: eq(variables['Build.Reason'], 'PullRequest')<% } %>
66
+ condition: eq(variables['Build.Reason'], 'PullRequest')
67
67
 
68
- <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
69
- # <%- comment %><% } %><% } %><% if (command.command) { %>
70
- - script: <%= command.command %><% if (command.alwaysRun) { %>
71
- condition: always()<% } %><% } %><% } %>
68
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
69
+ # - script: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
70
+ # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
71
+ # When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
72
+ - script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
@@ -23,22 +23,17 @@ pipelines:
23
23
  # Run this command as early as possible, before dependencies are installed
24
24
  # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
25
25
  <% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
26
- # - <%= packageManagerPreInstallPrefix %> nx start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
26
+ # - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
27
27
 
28
28
  - <%= packageManagerInstall %><% if(hasCypress){ %>
29
29
  - <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
30
30
  - <%= packageManagerPrefix %> playwright install --with-deps<% } %>
31
31
 
32
- <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
33
- # <%- comment %><% } %><% } %><% if (command.command && !command.alwaysRun) { %>
34
- - <%= command.command %><% } %><% } %>
35
- <% const alwaysRunCommands = commands.filter(c => c.alwaysRun && c.command) %>
36
- <% if (alwaysRunCommands.length > 0) { %>
37
- after-script:
38
- <% for (const command of alwaysRunCommands) { %>
39
- - <%= command.command %>
40
- <% } %>
41
- <% } %>
32
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
33
+ # <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
34
+ # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
35
+ # When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
36
+ - <%= packageManagerPrefix %> nx affected --base=origin/<%= mainBranch %> -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
42
37
 
43
38
  branches:
44
39
  main:
@@ -49,9 +44,9 @@ pipelines:
49
44
  # This enables task distribution via Nx Cloud
50
45
  # Run this command as early as possible, before dependencies are installed
51
46
  # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
52
- <% if (connectedToCloud) { %>- <%= packageManagerPreInstallPrefix %> nx start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
47
+ <% if (connectedToCloud) { %>- <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
53
48
  <% } else { %># Connect your workspace by running "nx connect" and uncomment this
54
- # - <%= packageManagerPreInstallPrefix %> nx start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
49
+ # - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
55
50
  <% } %>
56
51
  <% if(packageManager == 'pnpm'){ %>
57
52
  - npm install --prefix=$HOME/.local -g pnpm@8
@@ -61,13 +56,7 @@ pipelines:
61
56
  <% } %>
62
57
  - <%= packageManagerInstall %>
63
58
 
64
- <% for (const command of branchCommands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
65
- # <%- comment %><% } %><% } %><% if (command.command && !command.alwaysRun) { %>
66
- - <%= command.command %><% } %><% } %>
67
- <% const alwaysRunBranchCommands = branchCommands.filter(c => c.alwaysRun && c.command) %>
68
- <% if (alwaysRunBranchCommands.length > 0) { %>
69
- after-script:
70
- <% for (const command of alwaysRunBranchCommands) { %>
71
- - <%= command.command %>
72
- <% } %>
73
- <% } %>
59
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
60
+ # - <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
61
+ # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
62
+ - <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e-ci<% } %> --base=HEAD~1
@@ -25,19 +25,19 @@ jobs:
25
25
  # Run this command as early as possible, before dependencies are installed
26
26
  # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
27
27
  <% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
28
- # - run: <%= packageManagerPreInstallPrefix %> nx start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
28
+ # - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
29
29
 
30
30
  - run: <%= packageManagerInstall %><% if(hasCypress){ %>
31
31
  - run: <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
32
- - run: <%= packageManagerPrefix %> playwright install --with-deps<% } %><% if(!useRunMany){ %>
32
+ - run: <%= packageManagerPrefix %> playwright install --with-deps<% } %>
33
33
  - nx/set-shas:
34
- main-branch-name: '<%= mainBranch %>'<% } %>
34
+ main-branch-name: '<%= mainBranch %>'
35
35
 
36
- <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
37
- # <%- comment %><% } %><% } %><% if (command.command) { %>
38
- - run:
39
- command: <%= command.command %><% if (command.alwaysRun) { %>
40
- when: always<% } %><% } %><% } %>
36
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
37
+ # - run: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
38
+ # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
39
+ # When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
40
+ - run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
41
41
 
42
42
  workflows:
43
43
  version: 2
@@ -36,7 +36,7 @@ jobs:
36
36
  # Run this command as early as possible, before dependencies are installed
37
37
  # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
38
38
  <% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
39
- # - run: <%= packageManagerPreInstallPrefix %> nx start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
39
+ # - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
40
40
 
41
41
  <% if(packageManager !== 'bun'){ %>
42
42
  # Cache node_modules
@@ -47,10 +47,11 @@ jobs:
47
47
  <% } %>
48
48
  - run: <%= packageManagerInstall %><% if(hasCypress){ %>
49
49
  - run: <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
50
- - run: <%= packageManagerPrefix %> playwright install --with-deps<% } %><% if(!useRunMany){ %>
51
- - uses: nrwl/nx-set-shas@v4<% } %>
50
+ - run: <%= packageManagerPrefix %> playwright install --with-deps<% } %>
51
+ - uses: nrwl/nx-set-shas@v4
52
52
 
53
- <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
54
- # <%- comment %><% } %><% } %><% if (command.command) { %>
55
- - run: <%= command.command %><% if (command.alwaysRun) { %>
56
- if: always()<% } %><% } %><% } %>
53
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
54
+ # - run: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
55
+ # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
56
+ # When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
57
+ - run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
@@ -19,21 +19,16 @@ variables:
19
19
  # Run this command as early as possible, before dependencies are installed
20
20
  # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
21
21
  <% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
22
- # - <%= packageManagerPreInstallPrefix %> nx start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
22
+ # - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
23
23
 
24
24
  - <%= packageManagerInstall %><% if(hasCypress){ %>
25
25
  - <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
26
- - <%= packageManagerPrefix %> playwright install --with-deps<% } %><% if(!useRunMany){ %>
26
+ - <%= packageManagerPrefix %> playwright install --with-deps<% } %>
27
27
  - NX_HEAD=$CI_COMMIT_SHA
28
- - NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}<% } %>
28
+ - NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}
29
29
 
30
- <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
31
- # <%- comment %><% } %><% } %><% if (command.command && !command.alwaysRun) { %>
32
- - <%= command.command %><% } %><% } %>
33
- <% const alwaysRunCommands = commands.filter(c => c.alwaysRun && c.command) %>
34
- <% if (alwaysRunCommands.length > 0) { %>
35
- after_script:
36
- <% for (const command of alwaysRunCommands) { %>
37
- - <%= command.command %>
38
- <% } %>
39
- <% } %>
30
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
31
+ # - <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
32
+ # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
33
+ # When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
34
+ - <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
@@ -32,12 +32,6 @@
32
32
  "default": "CI",
33
33
  "x-prompt": "How should we name your workflow?",
34
34
  "pattern": "^[a-zA-Z].*$"
35
- },
36
- "useRunMany": {
37
- "type": "boolean",
38
- "description": "Use 'nx run-many' instead of 'nx affected' in the generated CI workflow.",
39
- "default": false,
40
- "hidden": true
41
35
  }
42
36
  },
43
37
  "required": ["ci", "name"]
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createProjectConfigurationInNewDestination = createProjectConfigurationInNewDestination;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const project_config_1 = require("../../utils/project-config");
6
5
  function createProjectConfigurationInNewDestination(tree, schema, projectConfig) {
7
6
  projectConfig.name = schema.newProjectName;
8
7
  const isRootProject = projectConfig.root === '.';
@@ -46,9 +45,8 @@ function createProjectConfigurationInNewDestination(tree, schema, projectConfig)
46
45
  }
47
46
  // Original sourceRoot is typically 'src' or 'app', but it could be any folder.
48
47
  // Make sure it is updated to be under the new destination.
49
- const sourceRoot = (0, project_config_1.getProjectSourceRoot)(projectConfig, tree);
50
- if (isRootProject && sourceRoot) {
51
- newProject.sourceRoot = (0, devkit_1.joinPathFragments)(schema.relativeToRootDestination, sourceRoot);
48
+ if (isRootProject && projectConfig.sourceRoot) {
49
+ newProject.sourceRoot = (0, devkit_1.joinPathFragments)(schema.relativeToRootDestination, projectConfig.sourceRoot);
52
50
  }
53
51
  if (schema.isNxConfiguredInPackageJson) {
54
52
  // Update the existing project configuration in the package.json
@@ -8,7 +8,6 @@ const ts_config_1 = require("../../../utilities/ts-config");
8
8
  const typescript_1 = require("../../../utilities/typescript");
9
9
  const utils_1 = require("./utils");
10
10
  const ts_solution_setup_1 = require("../../../utilities/typescript/ts-solution-setup");
11
- const project_config_1 = require("../../utils/project-config");
12
11
  let tsModule;
13
12
  /**
14
13
  * Updates all the imports in the workspace and modifies the tsconfig appropriately.
@@ -34,7 +33,7 @@ function updateImports(tree, schema, project) {
34
33
  let serverEntryPointImportPath;
35
34
  if (tree.exists(tsConfigPath)) {
36
35
  tsConfig = (0, devkit_1.readJson)(tree, tsConfigPath);
37
- const sourceRoot = (0, project_config_1.getProjectSourceRoot)(project, tree);
36
+ const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
38
37
  mainEntryPointImportPath = Object.keys(tsConfig.compilerOptions?.paths ?? {}).find((path) => tsConfig.compilerOptions.paths[path].some((x) => x.startsWith(ensureTrailingSlash(sourceRoot))));
39
38
  secondaryEntryPointImportPaths = Object.keys(tsConfig.compilerOptions?.paths ?? {}).filter((path) => tsConfig.compilerOptions.paths[path].some((x) => x.startsWith(ensureTrailingSlash(project.root)) &&
40
39
  !x.startsWith(ensureTrailingSlash(sourceRoot))));
@@ -1,4 +1,4 @@
1
- import { Tree } from '@nx/devkit';
1
+ import { PackageManager, Tree } from '@nx/devkit';
2
2
  import { Linter, LinterType } from '../../utils/lint';
3
3
  interface Schema {
4
4
  directory: string;
@@ -14,18 +14,18 @@ interface Schema {
14
14
  nextAppDir?: boolean;
15
15
  nextSrcDir?: boolean;
16
16
  linter?: Linter | LinterType;
17
- bundler?: string;
17
+ bundler?: 'vite' | 'webpack' | 'rspack';
18
18
  standaloneApi?: boolean;
19
19
  routing?: boolean;
20
20
  useReactRouter?: boolean;
21
- packageManager?: string;
22
- unitTestRunner?: string;
23
- e2eTestRunner?: string;
21
+ packageManager?: PackageManager;
22
+ unitTestRunner?: 'jest' | 'vitest' | 'none';
23
+ e2eTestRunner?: 'cypress' | 'playwright' | 'detox' | 'jest' | 'none';
24
24
  ssr?: boolean;
25
25
  prefix?: string;
26
26
  useGitHub?: boolean;
27
27
  nxCloud?: 'yes' | 'skip' | 'circleci' | 'github';
28
- formatter?: string;
28
+ formatter?: 'none' | 'prettier';
29
29
  workspaces?: boolean;
30
30
  workspaceGlobs?: string | string[];
31
31
  useProjectJson?: boolean;
@@ -55,15 +55,18 @@
55
55
  "linter": {
56
56
  "description": "The tool to use for running lint checks.",
57
57
  "type": "string",
58
+ "enum": ["eslint", "none"],
58
59
  "default": "eslint"
59
60
  },
60
61
  "packageManager": {
61
62
  "description": "The package manager used to install dependencies.",
62
- "type": "string"
63
+ "type": "string",
64
+ "enum": ["npm", "yarn", "pnpm", "bun"]
63
65
  },
64
66
  "framework": {
65
67
  "description": "The framework which the application is using",
66
- "type": "string"
68
+ "type": "string",
69
+ "enum": ["express", "koa", "fastify", "nest", "none"]
67
70
  },
68
71
  "nextAppDir": {
69
72
  "description": "Enable the App Router for this project.",
@@ -77,11 +80,13 @@
77
80
  },
78
81
  "unitTestRunner": {
79
82
  "description": "The tool to use for running unit tests.",
80
- "type": "string"
83
+ "type": "string",
84
+ "enum": ["jest", "vitest", "none"]
81
85
  },
82
86
  "e2eTestRunner": {
83
87
  "description": "The tool to use for running e2e tests.",
84
- "type": "string"
88
+ "type": "string",
89
+ "enum": ["playwright", "cypress", "jest", "detox", "none"]
85
90
  },
86
91
  "ssr": {
87
92
  "description": "Enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) for the Angular application.",
@@ -95,6 +100,7 @@
95
100
  "formatter": {
96
101
  "description": "The tool to use for code formatting.",
97
102
  "type": "string",
103
+ "enum": ["none", "prettier"],
98
104
  "default": "none"
99
105
  },
100
106
  "workspaces": {
@@ -6,20 +6,20 @@ export interface Schema {
6
6
  preset: Preset;
7
7
  style?: string;
8
8
  linter?: string;
9
- formatter?: string;
9
+ formatter?: 'none' | 'prettier';
10
10
  workspaces?: boolean;
11
11
  standaloneConfig?: boolean;
12
12
  framework?: string;
13
- packageManager?: string;
14
- bundler?: string;
13
+ packageManager?: PackageManager;
14
+ bundler?: 'vite' | 'rsbuild' | 'webpack' | 'rspack' | 'esbuild';
15
15
  docker?: boolean;
16
16
  nextAppDir?: boolean;
17
17
  nextSrcDir?: boolean;
18
18
  routing?: boolean;
19
19
  useReactRouter?: boolean;
20
20
  standaloneApi?: boolean;
21
- unitTestRunner?: string;
22
- e2eTestRunner?: string;
21
+ unitTestRunner?: 'jest' | 'vitest' | 'none';
22
+ e2eTestRunner?: 'cypress' | 'playwright' | 'jest' | 'detox' | 'none';
23
23
  js?: boolean;
24
24
  ssr?: boolean;
25
25
  serverRouting?: boolean;
@@ -17,6 +17,7 @@
17
17
  "linter": {
18
18
  "description": "The tool to use for running lint checks.",
19
19
  "type": "string",
20
+ "enum": ["eslint", "none"],
20
21
  "default": "eslint"
21
22
  },
22
23
  "routing": {
@@ -65,15 +66,18 @@
65
66
  },
66
67
  "packageManager": {
67
68
  "description": "The package manager used to install dependencies.",
68
- "type": "string"
69
+ "type": "string",
70
+ "enum": ["npm", "yarn", "pnpm", "bun"]
69
71
  },
70
72
  "framework": {
71
73
  "description": "The framework which the application is using",
72
- "type": "string"
74
+ "type": "string",
75
+ "enum": ["express", "koa", "fastify", "nest", "none"]
73
76
  },
74
77
  "bundler": {
75
78
  "description": "The bundler to use for building the application.",
76
79
  "type": "string",
80
+ "enum": ["vite", "rspack", "rsbuild", "esbuild", "webpack"],
77
81
  "default": "vite"
78
82
  },
79
83
  "docker": {
@@ -93,11 +97,13 @@
93
97
  },
94
98
  "unitTestRunner": {
95
99
  "description": "The tool to use for running unit tests.",
96
- "type": "string"
100
+ "type": "string",
101
+ "enum": ["jest", "vitest", "none"]
97
102
  },
98
103
  "e2eTestRunner": {
99
104
  "description": "The tool to use for running e2e tests.",
100
- "type": "string"
105
+ "type": "string",
106
+ "enum": ["playwright", "cypress", "jest", "detox", "none"]
101
107
  },
102
108
  "ssr": {
103
109
  "description": "Enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) for the Angular application.",
@@ -111,6 +117,7 @@
111
117
  "formatter": {
112
118
  "description": "The tool to use for code formatting.",
113
119
  "type": "string",
120
+ "enum": ["none", "prettier"],
114
121
  "default": "none"
115
122
  },
116
123
  "workspaces": {
@@ -1,4 +1,4 @@
1
1
  export declare const nxVersion: any;
2
2
  export declare const typescriptVersion = "~5.8.2";
3
- export declare const angularCliVersion = "~20.1.0";
3
+ export declare const angularCliVersion = "~20.0.0";
4
4
  export declare const angularRspackVersion = "^21.1.0";
@@ -5,5 +5,5 @@ exports.nxVersion = require('../../package.json').version;
5
5
  exports.typescriptVersion = '~5.8.2';
6
6
  // TODO: remove when preset generation is reworked and
7
7
  // deps are not installed from workspace
8
- exports.angularCliVersion = '~20.1.0';
8
+ exports.angularCliVersion = '~20.0.0';
9
9
  exports.angularRspackVersion = '^21.1.0';
@@ -1,2 +0,0 @@
1
- import { type ProjectConfiguration, type Tree } from '@nx/devkit';
2
- export declare function getProjectSourceRoot(project: ProjectConfiguration, tree?: Tree): string;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProjectSourceRoot = getProjectSourceRoot;
4
- const devkit_1 = require("@nx/devkit");
5
- const node_fs_1 = require("node:fs");
6
- const node_path_1 = require("node:path");
7
- function getProjectSourceRoot(project, tree) {
8
- if (tree) {
9
- return (project.sourceRoot ??
10
- (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'src'))
11
- ? (0, devkit_1.joinPathFragments)(project.root, 'src')
12
- : project.root));
13
- }
14
- return (project.sourceRoot ??
15
- ((0, node_fs_1.existsSync)((0, node_path_1.join)(devkit_1.workspaceRoot, project.root, 'src'))
16
- ? (0, devkit_1.joinPathFragments)(project.root, 'src')
17
- : project.root));
18
- }