@nx/workspace 24.0.5 → 24.1.0-beta.0

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.
@@ -2,7 +2,6 @@ import { Tree } from '@nx/devkit';
2
2
  export type Command = {
3
3
  command?: string;
4
4
  comments?: string[];
5
- alwaysRun?: boolean;
6
5
  };
7
6
  export interface Schema {
8
7
  name: string;
@@ -30,20 +30,10 @@ function getNxTasksCommand(ci, packageManagerPrefix, mainBranch, hasTypecheck, h
30
30
  command: nxCommand,
31
31
  };
32
32
  }
33
- function getNxCloudFixCiCommand(packageManagerPrefix) {
34
- return {
35
- comments: [
36
- `Nx Cloud recommends fixes for failures to help you get CI green faster. Learn more: https://nx.dev/ci/features/self-healing-ci`,
37
- ],
38
- command: `${packageManagerPrefix} nx fix-ci`,
39
- alwaysRun: true,
40
- };
41
- }
42
33
  function getCiCommands(ci, packageManagerPrefix, mainBranch, hasTypecheck, hasE2E, useRunMany = false) {
43
34
  return [
44
35
  getNxCloudRecordCommand(ci, packageManagerPrefix),
45
36
  getNxTasksCommand(ci, packageManagerPrefix, mainBranch, hasTypecheck, hasE2E, useRunMany),
46
- getNxCloudFixCiCommand(packageManagerPrefix),
47
37
  ];
48
38
  }
49
39
  function getCiPrefix(ci) {
@@ -55,10 +55,10 @@ jobs:
55
55
 
56
56
  # This enables task distribution via Nx Cloud
57
57
  # Run this command as early as possible, before dependencies are installed
58
- # Configure Nx Agents and task distribution in .nx/ci-config.yaml
59
- # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#nx-cloud-start-nx-agents
58
+ # Configure workers and task distribution in .nx/pipelines/ci.yaml
59
+ # Learn more at https://nx.dev/docs/reference/nx-cloud-cli#nx-cloud-start-workers
60
60
  <% 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<% } %>
61
- # - script: <%= packageManagerPreInstallPrefix %> nx start-nx-agents
61
+ # - script: <%= packageManagerPreInstallPrefix %> nx-cloud start-workers
62
62
 
63
63
  - script: <%= packageManagerInstall %><% if(hasCypress){ %>
64
64
  - script: <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
@@ -68,5 +68,4 @@ jobs:
68
68
 
69
69
  <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
70
70
  # <%- comment %><% } %><% } %><% if (command.command) { %>
71
- - script: <%= command.command %><% if (command.alwaysRun) { %>
72
- condition: always()<% } %><% } %><% } %>
71
+ - script: <%= command.command %><% } %><% } %>
@@ -21,25 +21,18 @@ pipelines:
21
21
  <% } %>
22
22
  # This enables task distribution via Nx Cloud
23
23
  # Run this command as early as possible, before dependencies are installed
24
- # Configure Nx Agents and task distribution in .nx/ci-config.yaml
25
- # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#nx-cloud-start-nx-agents
24
+ # Configure workers and task distribution in .nx/pipelines/ci.yaml
25
+ # Learn more at https://nx.dev/docs/reference/nx-cloud-cli#nx-cloud-start-workers
26
26
  <% 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<% } %>
27
- # - <%= packageManagerPreInstallPrefix %> nx start-nx-agents
27
+ # - <%= packageManagerPreInstallPrefix %> nx-cloud start-workers
28
28
 
29
29
  - <%= packageManagerInstall %><% if(hasCypress){ %>
30
30
  - <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
31
31
  - <%= packageManagerPrefix %> playwright install --with-deps<% } %>
32
32
 
33
33
  <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
34
- # <%- comment %><% } %><% } %><% if (command.command && !command.alwaysRun) { %>
34
+ # <%- comment %><% } %><% } %><% if (command.command) { %>
35
35
  - <%= command.command %><% } %><% } %>
36
- <% const alwaysRunCommands = commands.filter(c => c.alwaysRun && c.command) %>
37
- <% if (alwaysRunCommands.length > 0) { %>
38
- after-script:
39
- <% for (const command of alwaysRunCommands) { %>
40
- - <%= command.command %>
41
- <% } %>
42
- <% } %>
43
36
 
44
37
  branches:
45
38
  main:
@@ -49,11 +42,11 @@ pipelines:
49
42
  - export NX_BRANCH=$BITBUCKET_BRANCH
50
43
  # This enables task distribution via Nx Cloud
51
44
  # Run this command as early as possible, before dependencies are installed
52
- # Configure Nx Agents and task distribution in .nx/ci-config.yaml
53
- # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#nx-cloud-start-nx-agents
54
- <% if (connectedToCloud) { %>- <%= packageManagerPreInstallPrefix %> nx start-nx-agents
45
+ # Configure workers and task distribution in .nx/pipelines/ci.yaml
46
+ # Learn more at https://nx.dev/docs/reference/nx-cloud-cli#nx-cloud-start-workers
47
+ <% if (connectedToCloud) { %>- <%= packageManagerPreInstallPrefix %> nx-cloud start-workers
55
48
  <% } else { %># Connect your workspace by running "nx connect" and uncomment this
56
- # - <%= packageManagerPreInstallPrefix %> nx start-nx-agents
49
+ # - <%= packageManagerPreInstallPrefix %> nx-cloud start-workers
57
50
  <% } %>
58
51
  <% if(packageManager == 'pnpm'){ %>
59
52
  - npm install --prefix=$HOME/.local -g pnpm@11
@@ -64,12 +57,5 @@ pipelines:
64
57
  - <%= packageManagerInstall %>
65
58
 
66
59
  <% for (const command of branchCommands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
67
- # <%- comment %><% } %><% } %><% if (command.command && !command.alwaysRun) { %>
60
+ # <%- comment %><% } %><% } %><% if (command.command) { %>
68
61
  - <%= command.command %><% } %><% } %>
69
- <% const alwaysRunBranchCommands = branchCommands.filter(c => c.alwaysRun && c.command) %>
70
- <% if (alwaysRunBranchCommands.length > 0) { %>
71
- after-script:
72
- <% for (const command of alwaysRunBranchCommands) { %>
73
- - <%= command.command %>
74
- <% } %>
75
- <% } %>
@@ -0,0 +1,8 @@
1
+ # Nx Cloud reads this file to configure your CI pipeline.
2
+ # Uncomment the "nx-cloud start-workers" line in your CI workflow to distribute tasks across workers.
3
+ # Learn how to configure this file at https://nx.dev/docs/reference/nx-cloud/ci-config
4
+ worker-templates:
5
+ default:
6
+ workers: 3 linux-medium-js
7
+ stop-after:
8
+ - <% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>
@@ -23,10 +23,10 @@ jobs:
23
23
 
24
24
  # This enables task distribution via Nx Cloud
25
25
  # Run this command as early as possible, before dependencies are installed
26
- # Configure Nx Agents and task distribution in .nx/ci-config.yaml
27
- # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#nx-cloud-start-nx-agents
26
+ # Configure workers and task distribution in .nx/pipelines/ci.yaml
27
+ # Learn more at https://nx.dev/docs/reference/nx-cloud-cli#nx-cloud-start-workers
28
28
  <% 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<% } %>
29
- # - run: <%= packageManagerPreInstallPrefix %> nx start-nx-agents
29
+ # - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-workers
30
30
 
31
31
  - run: <%= packageManagerInstall %><% if(hasCypress){ %>
32
32
  - run: <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
@@ -37,8 +37,7 @@ jobs:
37
37
  <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
38
38
  # <%- comment %><% } %><% } %><% if (command.command) { %>
39
39
  - run:
40
- command: <%= command.command %><% if (command.alwaysRun) { %>
41
- when: always<% } %><% } %><% } %>
40
+ command: <%= command.command %><% } %><% } %>
42
41
 
43
42
  workflows:
44
43
  version: 2
@@ -34,10 +34,10 @@ jobs:
34
34
  <% } %>
35
35
  # This enables task distribution via Nx Cloud
36
36
  # Run this command as early as possible, before dependencies are installed
37
- # Configure Nx Agents and task distribution in .nx/ci-config.yaml
38
- # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#nx-cloud-start-nx-agents
37
+ # Configure workers and task distribution in .nx/pipelines/ci.yaml
38
+ # Learn more at https://nx.dev/docs/reference/nx-cloud-cli#nx-cloud-start-workers
39
39
  <% 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<% } %>
40
- # - run: <%= packageManagerPreInstallPrefix %> nx start-nx-agents
40
+ # - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-workers
41
41
 
42
42
  <% if(packageManager !== 'bun'){ %>
43
43
  # Cache node_modules
@@ -53,5 +53,4 @@ jobs:
53
53
 
54
54
  <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
55
55
  # <%- comment %><% } %><% } %><% if (command.command) { %>
56
- - run: <%= command.command %><% if (command.alwaysRun) { %>
57
- if: always()<% } %><% } %><% } %>
56
+ - run: <%= command.command %><% } %><% } %>
@@ -18,10 +18,10 @@ variables:
18
18
  <% } %>
19
19
  # This enables task distribution via Nx Cloud
20
20
  # Run this command as early as possible, before dependencies are installed
21
- # Configure Nx Agents and task distribution in .nx/ci-config.yaml
22
- # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#nx-cloud-start-nx-agents
21
+ # Configure workers and task distribution in .nx/pipelines/ci.yaml
22
+ # Learn more at https://nx.dev/docs/reference/nx-cloud-cli#nx-cloud-start-workers
23
23
  <% 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<% } %>
24
- # - <%= packageManagerPreInstallPrefix %> nx start-nx-agents
24
+ # - <%= packageManagerPreInstallPrefix %> nx-cloud start-workers
25
25
 
26
26
  - <%= packageManagerInstall %><% if(hasCypress){ %>
27
27
  - <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
@@ -30,12 +30,5 @@ variables:
30
30
  - export NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$(git rev-parse HEAD~1 2>/dev/null || git rev-parse HEAD)}<% } %>
31
31
 
32
32
  <% for (const command of commands) { %><% if (command.comments) { %><% for (const comment of command.comments) { %>
33
- # <%- comment %><% } %><% } %><% if (command.command && !command.alwaysRun) { %>
33
+ # <%- comment %><% } %><% } %><% if (command.command) { %>
34
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
- <% } %>
@@ -8,7 +8,7 @@ const devkit_1 = require("@nx/devkit");
8
8
  function updateBuildTargets(tree, schema) {
9
9
  (0, devkit_1.getProjects)(tree).forEach((projectConfig, project) => {
10
10
  let changed = false;
11
- Object.entries(projectConfig.targets || {}).forEach(([target, targetConfig]) => {
11
+ Object.entries(projectConfig.targets || {}).forEach(([, targetConfig]) => {
12
12
  changed =
13
13
  updateJsonValue(targetConfig, (value) => {
14
14
  const [project, target, configuration] = value.split(':');
@@ -82,7 +82,6 @@ function generatePreset(host, opts) {
82
82
  stdio: 'inherit',
83
83
  cwd: newWorkspaceRoot,
84
84
  };
85
- const pmc = (0, devkit_1.getPackageManagerCommand)();
86
85
  const nxInstallationPaths = (0, internal_1.getNxRequirePaths)(newWorkspaceRoot);
87
86
  const nxBinForNewWorkspaceRoot = require.resolve('nx/bin/nx', {
88
87
  paths: nxInstallationPaths,
@@ -250,7 +250,6 @@ async function createReadme(tree, { name, appName, directory, preset, nxCloud, w
250
250
  const formattedNames = (0, devkit_1.names)(name);
251
251
  // default to an empty one for custom presets
252
252
  const presetInfo = presetToPluginMap[preset] ?? {
253
- package: '',
254
253
  generateLibCmd: null,
255
254
  };
256
255
  const nxCloudOnboardingUrl = nxCloudToken
@@ -12,7 +12,7 @@ function checkProjectIsSafeToRemove(tree, schema, project) {
12
12
  return;
13
13
  }
14
14
  const containedProjects = [];
15
- for (const [_, p] of (0, devkit_1.getProjects)(tree)) {
15
+ for (const [, p] of (0, devkit_1.getProjects)(tree)) {
16
16
  if (project.name !== p.name &&
17
17
  !(0, devkit_1.normalizePath)((0, path_1.relative)(project.root, p.root)).startsWith('..')) {
18
18
  containedProjects.push(p.name);
@@ -48,20 +48,20 @@ async function checkTargets(tree, schema) {
48
48
  }
49
49
  }
50
50
  function checkIfProjectIsUsed(config, callback) {
51
- function recur(obj, key, value) {
51
+ function recur(value) {
52
52
  if (typeof value === 'string') {
53
53
  callback(value);
54
54
  }
55
55
  else if (Array.isArray(value)) {
56
- value.forEach((x, idx) => recur(value, idx, x));
56
+ value.forEach((x) => recur(x));
57
57
  }
58
58
  else if (typeof value === 'object') {
59
- Object.entries(value).forEach(([k, v]) => {
60
- recur(value, k, v);
59
+ Object.entries(value).forEach(([, v]) => {
60
+ recur(v);
61
61
  });
62
62
  }
63
63
  }
64
- Object.entries(config).forEach(([k, v]) => {
65
- recur(config, k, v);
64
+ Object.entries(config).forEach(([, v]) => {
65
+ recur(v);
66
66
  });
67
67
  }
package/generators.json CHANGED
@@ -6,7 +6,6 @@
6
6
  "factory": "./dist/src/generators/preset/preset#presetGenerator",
7
7
  "schema": "./dist/src/generators/preset/schema.json",
8
8
  "description": "Create application in an empty workspace.",
9
- "x-use-standalone-layout": true,
10
9
  "hidden": true
11
10
  },
12
11
  "move": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/workspace",
3
- "version": "24.0.5",
3
+ "version": "24.1.0-beta.0",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -78,17 +78,17 @@
78
78
  }
79
79
  },
80
80
  "dependencies": {
81
- "@nx/devkit": "24.0.5",
81
+ "@nx/devkit": "24.1.0-beta.0",
82
82
  "@zkochan/js-yaml": "0.0.7",
83
83
  "chalk": "^4.1.0",
84
84
  "picomatch": "^4.0.7",
85
85
  "semver": "^7.6.3",
86
86
  "tslib": "^2.3.0",
87
87
  "yargs-parser": "21.1.1",
88
- "nx": "24.0.5"
88
+ "nx": "24.1.0-beta.0"
89
89
  },
90
90
  "devDependencies": {
91
- "nx": "24.0.5"
91
+ "nx": "24.1.0-beta.0"
92
92
  },
93
93
  "publishConfig": {
94
94
  "access": "public"
@@ -1,9 +0,0 @@
1
- # Nx Cloud reads this file to configure your CI Pipeline Executions.
2
- # Uncomment the "nx start-nx-agents" line in your CI workflow to distribute tasks across agents.
3
- # Learn how to start Nx Agents at https://nx.dev/ci/reference/nx-cloud-cli#nx-cloud-start-nx-agents
4
- # Learn how to configure this file at https://nx.dev/ci/reference/nx-cloud/ci-config
5
- dte:
6
- distribute-on: 3 linux-medium-js
7
- lifecycle:
8
- stop-after:
9
- - <% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>