@nx/workspace 0.0.0-pr-22179-271588f → 0.0.0-pr-26482-ebe2dba

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.
Files changed (30) hide show
  1. package/LICENSE +1 -1
  2. package/migrations.json +13 -18
  3. package/package.json +5 -5
  4. package/src/generators/ci-workflow/ci-workflow.js +8 -8
  5. package/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ +23 -12
  6. package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ +18 -7
  7. package/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ +17 -8
  8. package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +18 -8
  9. package/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ +11 -6
  10. package/src/generators/convert-to-monorepo/convert-to-monorepo.js +12 -0
  11. package/src/generators/move/lib/move-project-files.js +1 -4
  12. package/src/generators/move/lib/normalize-schema.js +1 -1
  13. package/src/generators/move/lib/update-imports.js +15 -1
  14. package/src/generators/new/files-integrated-repo/__dot__gitignore +2 -1
  15. package/src/generators/new/files-package-based-repo/__dot__gitignore +1 -0
  16. package/src/generators/new/files-package-based-repo/packages/__dot__gitkeep +0 -0
  17. package/src/generators/new/files-root-app/__dot__gitignore +2 -1
  18. package/src/generators/new/generate-preset.js +3 -0
  19. package/src/generators/new/generate-workspace-files.js +1 -0
  20. package/src/generators/new/new.js +0 -1
  21. package/src/generators/new/schema.json +2 -2
  22. package/src/generators/preset/preset.js +38 -22
  23. package/src/generators/preset/schema.json +2 -2
  24. package/src/generators/remove/lib/update-jest-config.js +2 -1
  25. package/src/generators/utils/presets.d.ts +2 -6
  26. package/src/generators/utils/presets.js +2 -7
  27. package/src/utils/versions.d.ts +2 -2
  28. package/src/utils/versions.js +2 -2
  29. package/src/migrations/update-15-7-0/split-configuration-into-project-json-files.d.ts +0 -3
  30. package/src/migrations/update-15-7-0/split-configuration-into-project-json-files.js +0 -11
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2023 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2024 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/migrations.json CHANGED
@@ -1,11 +1,5 @@
1
1
  {
2
2
  "generators": {
3
- "15-7-0-split-configuration-into-project-json-files": {
4
- "version": "15.7.0-beta.0",
5
- "description": "Split global configuration files (e.g., workspace.json) into individual project.json files.",
6
- "cli": "nx",
7
- "implementation": "./src/migrations/update-15-7-0/split-configuration-into-project-json-files"
8
- },
9
3
  "update-16-0-0-add-nx-packages": {
10
4
  "cli": "nx",
11
5
  "version": "16.0.0-beta.1",
@@ -26,18 +20,6 @@
26
20
  }
27
21
  },
28
22
  "packageJsonUpdates": {
29
- "15.8.0": {
30
- "version": "15.8.0-beta.2",
31
- "x-prompt": "Do you want to update to TypeScript v4.9?",
32
- "requires": {
33
- "typescript": ">=4.8.2 <4.9.0"
34
- },
35
- "packages": {
36
- "typescript": {
37
- "version": "~4.9.5"
38
- }
39
- }
40
- },
41
23
  "16.1.0": {
42
24
  "version": "16.1.0-beta.0",
43
25
  "x-prompt": "Do you want to update to TypeScript v5.0?",
@@ -85,6 +67,19 @@
85
67
  "version": "~5.3.2"
86
68
  }
87
69
  }
70
+ },
71
+ "18.2.0": {
72
+ "version": "18.2.0-beta.0",
73
+ "x-prompt": "Do you want to update to TypeScript v5.4?",
74
+ "requires": {
75
+ "typescript": ">=5.3.0 <5.4.0"
76
+ },
77
+ "packages": {
78
+ "typescript": {
79
+ "version": "~5.4.2",
80
+ "alwaysAddToPackageJson": false
81
+ }
82
+ }
88
83
  }
89
84
  }
90
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/workspace",
3
- "version": "0.0.0-pr-22179-271588f",
3
+ "version": "0.0.0-pr-26482-ebe2dba",
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": {
@@ -19,7 +19,7 @@
19
19
  "Cypress",
20
20
  "CLI"
21
21
  ],
22
- "main": "./index.js",
22
+ "main": "./index",
23
23
  "typings": "./index.d.ts",
24
24
  "author": "Victor Savkin",
25
25
  "license": "MIT",
@@ -61,13 +61,13 @@
61
61
  }
62
62
  },
63
63
  "dependencies": {
64
- "@nx/devkit": "0.0.0-pr-22179-271588f",
64
+ "@nx/devkit": "0.0.0-pr-26482-ebe2dba",
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": "0.0.0-pr-22179-271588f",
70
- "@nrwl/workspace": "0.0.0-pr-22179-271588f"
69
+ "nx": "0.0.0-pr-26482-ebe2dba",
70
+ "@nrwl/workspace": "0.0.0-pr-26482-ebe2dba"
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public"
@@ -8,11 +8,6 @@ const nx_cloud_utils_1 = require("nx/src/utils/nx-cloud-utils");
8
8
  async function ciWorkflowGenerator(tree, schema) {
9
9
  const ci = schema.ci;
10
10
  const nxJson = (0, devkit_1.readJson)(tree, 'nx.json');
11
- const nxCloudUsed = nxJson.nxCloudAccessToken ??
12
- Object.values(nxJson.tasksRunnerOptions ?? {}).find((r) => r.runner == '@nrwl/nx-cloud' || r.runner == 'nx-cloud');
13
- if (!nxCloudUsed) {
14
- throw new Error('This workspace is not connected to Nx Cloud.');
15
- }
16
11
  if (ci === 'bitbucket-pipelines' && defaultBranchNeedsOriginPrefix(nxJson)) {
17
12
  (0, devkit_1.writeJson)(tree, 'nx.json', appendOriginPrefix(nxJson));
18
13
  }
@@ -24,9 +19,13 @@ exports.ciWorkflowGenerator = ciWorkflowGenerator;
24
19
  function normalizeOptions(options, tree) {
25
20
  const { name: workflowName, fileName: workflowFileName } = (0, devkit_1.names)(options.name);
26
21
  const packageManager = (0, devkit_1.detectPackageManager)();
27
- const { exec: packageManagerPrefix, ciInstall: packageManagerInstall } = (0, devkit_1.getPackageManagerCommand)(packageManager);
28
- const nxCloudUrl = (0, nx_cloud_utils_1.getNxCloudUrl)((0, devkit_1.readJson)(tree, 'nx.json'));
29
- const nxCloudHost = new URL(nxCloudUrl).host;
22
+ const { exec: packageManagerPrefix, ciInstall: packageManagerInstall, dlx: packageManagerPreInstallPrefix, } = (0, devkit_1.getPackageManagerCommand)(packageManager);
23
+ let nxCloudHost = 'nx.app';
24
+ try {
25
+ const nxCloudUrl = (0, nx_cloud_utils_1.getNxCloudUrl)((0, devkit_1.readJson)(tree, 'nx.json'));
26
+ nxCloudHost = new URL(nxCloudUrl).host;
27
+ }
28
+ catch { }
30
29
  const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
31
30
  const allDependencies = {
32
31
  ...packageJson.dependencies,
@@ -39,6 +38,7 @@ function normalizeOptions(options, tree) {
39
38
  packageManager,
40
39
  packageManagerInstall,
41
40
  packageManagerPrefix,
41
+ packageManagerPreInstallPrefix,
42
42
  mainBranch: (0, default_base_1.deduceDefaultBase)(),
43
43
  hasE2E,
44
44
  nxCloudHost,
@@ -27,11 +27,7 @@ jobs:
27
27
  - bash: az devops configure --defaults organization=$(System.TeamFoundationCollectionUri) project=$(System.TeamProject)
28
28
  displayName: 'Set default Azure DevOps organization and project'
29
29
  # Get last successfull commit from Azure Devops CLI
30
- - displayName: 'Get last successful commit SHA'
31
- condition: ne(variables['Build.Reason'], 'PullRequest')
32
- env:
33
- AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
34
- bash: |
30
+ - bash: |
35
31
  LAST_SHA=$(az pipelines build list --branch $(Build.SourceBranchName) --definition-ids $(System.DefinitionId) --result succeeded --top 1 --query "[0].triggerInfo.\"ci.sourceSha\"")
36
32
  if [ -z "$LAST_SHA" ]
37
33
  then
@@ -40,15 +36,30 @@ jobs:
40
36
  echo "Last successful commit SHA: $LAST_SHA"
41
37
  echo "##vso[task.setvariable variable=BASE_SHA]$LAST_SHA"
42
38
  fi
43
-
44
- # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
45
- # 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
46
- # - script: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
39
+ displayName: 'Get last successful commit SHA'
40
+ condition: ne(variables['Build.Reason'], 'PullRequest')
41
+ env:
42
+ AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
47
43
 
48
44
  <% if(packageManager == 'pnpm'){ %>
49
45
  - script: npm install --prefix=$HOME/.local -g pnpm@8
50
46
  displayName: Install PNPM
51
- <% } %>- script: <%= packageManagerInstall %>
52
47
 
53
- - script: <%= packageManagerPrefix %> nx-cloud record -- nx format:check --base=$(BASE_SHA) --head=$(HEAD_SHA)
54
- - script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) -t lint test build<% if(hasE2E){ %> e2e-ci<% } %>
48
+ <% } %>
49
+ <% if(packageManager == 'bun'){ %>
50
+ - script: npm install --prefix=$HOME/.local -g Bun
51
+ displayName: Install Bun
52
+
53
+ <% } %>
54
+ # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
55
+ # 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
56
+ # - script: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
57
+
58
+ - script: <%= packageManagerInstall %>
59
+ - script: git branch --track <%= mainBranch %> origin/<%= mainBranch %>
60
+ condition: eq(variables['Build.Reason'], 'PullRequest')
61
+
62
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
63
+ # - script: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
64
+ - script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) lint test build<% if(hasE2E){ %>
65
+ - script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --parallel 1 e2e-ci<% } %>
@@ -11,31 +11,42 @@ pipelines:
11
11
  script:
12
12
  - export NX_BRANCH=$BITBUCKET_PR_ID
13
13
 
14
- # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
15
- # 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
16
- # - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
17
-
18
14
  <% if(packageManager == 'pnpm'){ %>
19
15
  - npm install --prefix=$HOME/.local -g pnpm@8
16
+
17
+ <% } %>
18
+ <% if(packageManager == 'bun'){ %>
19
+ - npm install --prefix=$HOME/.local -g bun
20
+
20
21
  <% } %>
22
+ # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
23
+ # 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
24
+ # - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
25
+
21
26
  - <%= packageManagerInstall %>
22
27
 
23
28
  - <%= packageManagerPrefix %> nx-cloud record -- nx format:check
24
- - <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %> e2e-ci<% } %> --base=origin/<%= mainBranch %>
29
+ - <%= packageManagerPrefix %> nx affected --base=origin/<%= mainBranch %> -t lint test build<% if(hasE2E){ %>
30
+ - <%= packageManagerPrefix %> nx affected --base=origin/<%= mainBranch %> --parallel 1 -t e2e-ci<% } %>
25
31
 
26
32
  branches:
27
33
  main:
28
34
  - step:
29
35
  name: 'Build and test affected apps on "<%= mainBranch %>" branch changes'
30
36
  script:
37
+ - export NX_BRANCH=$BITBUCKET_BRANCH
31
38
  # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
32
39
  # 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
33
- # - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
40
+ # - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
34
41
 
35
42
  <% if(packageManager == 'pnpm'){ %>
36
43
  - npm install --prefix=$HOME/.local -g pnpm@8
37
44
  <% } %>
45
+ <% if(packageManager == 'bun'){ %>
46
+ - npm install --prefix=$HOME/.local -g bun
47
+ <% } %>
38
48
  - <%= packageManagerInstall %>
39
49
 
40
- - <%= packageManagerPrefix %> nx-cloud record -- nx format:check
50
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
51
+ # - <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
41
52
  - <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %> e2e-ci<% } %> --base=HEAD~1
@@ -9,21 +9,30 @@ jobs:
9
9
  - image: cimg/node:lts-browsers
10
10
  steps:
11
11
  - checkout
12
-
13
- # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
14
- # 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
15
- # - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
16
-
17
12
  <% if(packageManager == 'pnpm'){ %>
18
13
  - run:
19
14
  name: Install PNPM
20
15
  command: npm install --prefix=$HOME/.local -g pnpm@8
21
- <% } %>- run: <%= packageManagerInstall %>
16
+ <% } %>
17
+ <% if(packageManager == 'bun'){ %>
18
+ - run:
19
+ name: Install Bun
20
+ command: npm install --prefix=$HOME/.local -g bun
21
+ <% } %>
22
+
23
+
24
+ # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
25
+ # 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
26
+ # - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
27
+
28
+ - run: <%= packageManagerInstall %>
22
29
  - nx/set-shas:
23
30
  main-branch-name: '<%= mainBranch %>'
24
31
 
25
- - run: <%= packageManagerPrefix %> nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD
26
- - run: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build<% if(hasE2E){ %> e2e-ci<% } %>
32
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
33
+ # - run: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
34
+ - run: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build<% if(hasE2E){ %>
35
+ - run: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --parallel 1 -t e2e-ci<% } %>
27
36
 
28
37
  workflows:
29
38
  version: 2
@@ -17,22 +17,32 @@ jobs:
17
17
  - uses: actions/checkout@v4
18
18
  with:
19
19
  fetch-depth: 0
20
-
21
- # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
22
- # 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
23
- # - run: <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
24
-
25
20
  <% if(packageManager == 'pnpm'){ %>
26
21
  - uses: pnpm/action-setup@v2
27
22
  with:
28
23
  version: 8
29
- <% } %># Cache node_modules
24
+ <% } %>
25
+ <% if(packageManager == 'bun'){ %>
26
+ - uses: oven-sh/setup-bun@v1
27
+ with:
28
+ bun-version: latest
29
+ <% } %>
30
+
31
+ # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
32
+ # 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
33
+ # - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
34
+
35
+ <% if(packageManager != 'bun'){ %>
36
+ # Cache node_modules
30
37
  - uses: actions/setup-node@v3
31
38
  with:
32
39
  node-version: 20
33
40
  cache: '<%= packageManager %>'
41
+ <% } %>
34
42
  - run: <%= packageManagerInstall %>
35
43
  - uses: nrwl/nx-set-shas@v4
36
44
 
37
- - run: <%= packageManagerPrefix %> nx-cloud record -- nx format:check
38
- - run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %> e2e-ci<% } %>
45
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
46
+ # - run: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
47
+ - run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %>
48
+ - run: <%= packageManagerPrefix %> nx affected --parallel 1 -t e2e-ci<% } %>
@@ -9,16 +9,21 @@ variables:
9
9
  - main
10
10
  - merge_requests
11
11
  script:
12
- # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
13
- # 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
14
- # - <%= packageManagerPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
15
-
16
12
  <% if(packageManager == 'pnpm'){ %>
17
13
  - npm install --prefix=$HOME/.local -g pnpm@8
18
14
  <% } %>
15
+ <% if(packageManager == 'bun'){ %>
16
+ - npm install --prefix=$HOME/.local -g bun
17
+ <% } %>
18
+ # Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
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
+ # - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
21
+
19
22
  - <%= packageManagerInstall %>
20
23
  - NX_HEAD=$CI_COMMIT_SHA
21
24
  - NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}
22
25
 
23
- - <%= packageManagerPrefix %> nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD
24
- - <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build<% if(hasE2E){ %> e2e-ci<% } %>
26
+ # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
27
+ # - <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
28
+ - <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build<% if(hasE2E){ %>
29
+ - <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --parallel 1 -t e2e-ci<% } %>
@@ -25,6 +25,18 @@ async function monorepoGenerator(tree, options) {
25
25
  const isRootProjectApp = rootProject.projectType === 'application';
26
26
  const appsDir = isRootProjectApp ? 'apps' : 'packages';
27
27
  const libsDir = isRootProjectApp ? 'libs' : 'packages';
28
+ if (rootProject) {
29
+ // If project was created using `nx init` then it might not have project.json.
30
+ // Need to create one to avoid name conflicts with root package.json.
31
+ if (!tree.exists('project.json')) {
32
+ (0, devkit_1.writeJson)(tree, 'project.json', { name: rootProject.name });
33
+ }
34
+ (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
35
+ // Avoid name conflicts once we move root project into its own folder.
36
+ json.name = `@${rootProject.name}/source`;
37
+ return json;
38
+ });
39
+ }
28
40
  for (const project of projectsToMove) {
29
41
  await (0, move_1.moveGenerator)(tree, {
30
42
  projectName: project.name,
@@ -15,10 +15,7 @@ function moveProjectFiles(tree, schema, project) {
15
15
  const knownRootProjectFiles = [
16
16
  // Config files
17
17
  'project.json',
18
- 'tsconfig.json',
19
- 'tsconfig.app.json',
20
- 'tsconfig.lib.json',
21
- 'tsconfig.spec.json',
18
+ /^tsconfig(?!\.base\.json$)((\..+)?\.json$|json$)/,
22
19
  '.babelrc',
23
20
  '.eslintrc.json',
24
21
  'eslint.config.js',
@@ -133,7 +133,7 @@ function logDeprecationMessage(formats, options) {
133
133
  ? '@nx/angular:move'
134
134
  : '@nx/workspace:move';
135
135
  devkit_1.logger.warn((0, devkit_1.stripIndents) `
136
- In Nx 19, the project name and destination will no longer be derived.
136
+ In Nx 20, the project name and destination will no longer be derived.
137
137
  Please provide the exact new project name and destination in the future.
138
138
  Example: nx g ${callingGenerator} --projectName ${options.projectName} --destination ${formats['derived'].destination}` +
139
139
  (options.projectName !== formats['derived'].newProjectName
@@ -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');
@@ -124,7 +138,7 @@ function updateImportDeclarations(sourceFile, from, to) {
124
138
  ]);
125
139
  const changes = [];
126
140
  for (const { moduleSpecifier } of importDecls) {
127
- if (tsModule.isStringLiteral(moduleSpecifier)) {
141
+ if (moduleSpecifier && tsModule.isStringLiteral(moduleSpecifier)) {
128
142
  changes.push(...updateModuleSpecifier(moduleSpecifier, from, to));
129
143
  }
130
144
  }
@@ -38,4 +38,5 @@ testem.log
38
38
  .DS_Store
39
39
  Thumbs.db
40
40
 
41
- .nx/cache
41
+ .nx/cache
42
+ .nx/workspace-data
@@ -39,3 +39,4 @@ testem.log
39
39
  Thumbs.db
40
40
 
41
41
  .nx/cache
42
+ .nx/workspace-data
@@ -38,4 +38,5 @@ testem.log
38
38
  .DS_Store
39
39
  Thumbs.db
40
40
 
41
- .nx/cache
41
+ .nx/cache
42
+ .nx/workspace-data
@@ -98,6 +98,9 @@ function getPresetDependencies({ preset, presetVersion, bundler, e2eTestRunner,
98
98
  case presets_1.Preset.NextJs:
99
99
  case presets_1.Preset.NextJsStandalone:
100
100
  return { dependencies: { '@nx/next': versions_1.nxVersion }, dev: {} };
101
+ case presets_1.Preset.RemixStandalone:
102
+ case presets_1.Preset.RemixMonorepo:
103
+ return { dependencies: { '@nx/remix': versions_1.nxVersion }, dev: {} };
101
104
  case presets_1.Preset.VueMonorepo:
102
105
  case presets_1.Preset.VueStandalone:
103
106
  return {
@@ -82,6 +82,7 @@ function createFiles(tree, options) {
82
82
  options.preset === presets_1.Preset.NuxtStandalone ||
83
83
  options.preset === presets_1.Preset.NodeStandalone ||
84
84
  options.preset === presets_1.Preset.NextJsStandalone ||
85
+ options.preset === presets_1.Preset.RemixStandalone ||
85
86
  options.preset === presets_1.Preset.TsStandalone
86
87
  ? './files-root-app'
87
88
  : options.preset === presets_1.Preset.NPM
@@ -71,7 +71,6 @@ function normalizeOptions(options) {
71
71
  const normalized = {
72
72
  ...options,
73
73
  };
74
- normalized.name = (0, devkit_1.names)(options.name).fileName;
75
74
  if (!options.directory) {
76
75
  normalized.directory = normalized.name;
77
76
  }
@@ -56,7 +56,7 @@
56
56
  "packageManager": {
57
57
  "description": "The package manager used to install dependencies.",
58
58
  "type": "string",
59
- "enum": ["npm", "yarn", "pnpm"]
59
+ "enum": ["npm", "yarn", "pnpm", "bun"]
60
60
  },
61
61
  "framework": {
62
62
  "description": "The framework which the application is using",
@@ -76,7 +76,7 @@
76
76
  "e2eTestRunner": {
77
77
  "description": "The tool to use for running e2e tests.",
78
78
  "type": "string",
79
- "enum": ["cypress", "playwright", "jest", "detox", "none"]
79
+ "enum": ["playwright", "cypress", "jest", "detox", "none"]
80
80
  },
81
81
  "ssr": {
82
82
  "description": "Enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) for the Angular application.",
@@ -5,7 +5,6 @@ const devkit_1 = require("@nx/devkit");
5
5
  const presets_1 = require("../utils/presets");
6
6
  const path_1 = require("path");
7
7
  async function presetGenerator(tree, options) {
8
- options = normalizeOptions(options);
9
8
  const presetTask = await createPreset(tree, options);
10
9
  return async () => {
11
10
  (0, devkit_1.installPackagesTask)(tree);
@@ -16,12 +15,9 @@ async function presetGenerator(tree, options) {
16
15
  exports.presetGenerator = presetGenerator;
17
16
  exports.default = presetGenerator;
18
17
  async function createPreset(tree, options) {
19
- console.log('Crate preset');
20
18
  const nxJson = (0, devkit_1.readNxJson)(tree);
21
19
  const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
22
20
  nxJson.useInferencePlugins !== false;
23
- console.log('Add plugin', addPlugin);
24
- console.log(options.preset, presets_1.Preset.ReactNative);
25
21
  if (options.preset === presets_1.Preset.Apps) {
26
22
  return;
27
23
  }
@@ -35,7 +31,7 @@ async function createPreset(tree, options) {
35
31
  linter: options.linter,
36
32
  standalone: options.standaloneApi,
37
33
  routing: options.routing,
38
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
34
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
39
35
  bundler: options.bundler,
40
36
  ssr: options.ssr,
41
37
  prefix: options.prefix,
@@ -52,7 +48,7 @@ async function createPreset(tree, options) {
52
48
  routing: options.routing,
53
49
  rootProject: true,
54
50
  standalone: options.standaloneApi,
55
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
51
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
56
52
  bundler: options.bundler,
57
53
  ssr: options.ssr,
58
54
  prefix: options.prefix,
@@ -68,7 +64,7 @@ async function createPreset(tree, options) {
68
64
  style: options.style,
69
65
  linter: options.linter,
70
66
  bundler: options.bundler ?? 'webpack',
71
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
67
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
72
68
  addPlugin,
73
69
  });
74
70
  }
@@ -83,11 +79,38 @@ async function createPreset(tree, options) {
83
79
  linter: options.linter,
84
80
  rootProject: true,
85
81
  bundler: options.bundler ?? 'vite',
86
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
82
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
87
83
  unitTestRunner: options.bundler === 'vite' ? 'vitest' : 'jest',
88
84
  addPlugin,
89
85
  });
90
86
  }
87
+ else if (options.preset === presets_1.Preset.RemixMonorepo) {
88
+ const { applicationGenerator: remixApplicationGenerator } = require('@nx' +
89
+ '/remix/generators');
90
+ return remixApplicationGenerator(tree, {
91
+ name: options.name,
92
+ directory: (0, path_1.join)('apps', options.name),
93
+ projectNameAndRootFormat: 'as-provided',
94
+ linter: options.linter,
95
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
96
+ unitTestRunner: 'vitest',
97
+ addPlugin,
98
+ });
99
+ }
100
+ else if (options.preset === presets_1.Preset.RemixStandalone) {
101
+ const { applicationGenerator: remixApplicationGenerator } = require('@nx' +
102
+ '/remix/generators');
103
+ return remixApplicationGenerator(tree, {
104
+ name: options.name,
105
+ directory: '.',
106
+ projectNameAndRootFormat: 'as-provided',
107
+ linter: options.linter,
108
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
109
+ rootProject: true,
110
+ unitTestRunner: 'vitest',
111
+ addPlugin,
112
+ });
113
+ }
91
114
  else if (options.preset === presets_1.Preset.VueMonorepo) {
92
115
  const { applicationGenerator: vueApplicationGenerator } = require('@nx' +
93
116
  '/vue');
@@ -97,7 +120,7 @@ async function createPreset(tree, options) {
97
120
  projectNameAndRootFormat: 'as-provided',
98
121
  style: options.style,
99
122
  linter: options.linter,
100
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
123
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
101
124
  addPlugin,
102
125
  });
103
126
  }
@@ -111,7 +134,7 @@ async function createPreset(tree, options) {
111
134
  style: options.style,
112
135
  linter: options.linter,
113
136
  rootProject: true,
114
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
137
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
115
138
  unitTestRunner: 'vitest',
116
139
  addPlugin,
117
140
  });
@@ -125,7 +148,7 @@ async function createPreset(tree, options) {
125
148
  projectNameAndRootFormat: 'as-provided',
126
149
  style: options.style,
127
150
  linter: options.linter,
128
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
151
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
129
152
  addPlugin,
130
153
  });
131
154
  }
@@ -139,7 +162,7 @@ async function createPreset(tree, options) {
139
162
  style: options.style,
140
163
  linter: options.linter,
141
164
  rootProject: true,
142
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
165
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
143
166
  unitTestRunner: 'vitest',
144
167
  addPlugin,
145
168
  });
@@ -155,7 +178,7 @@ async function createPreset(tree, options) {
155
178
  linter: options.linter,
156
179
  appDir: options.nextAppDir,
157
180
  src: options.nextSrcDir,
158
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
181
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
159
182
  addPlugin,
160
183
  });
161
184
  }
@@ -170,7 +193,7 @@ async function createPreset(tree, options) {
170
193
  linter: options.linter,
171
194
  appDir: options.nextAppDir,
172
195
  src: options.nextSrcDir,
173
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
196
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
174
197
  rootProject: true,
175
198
  addPlugin,
176
199
  });
@@ -185,7 +208,7 @@ async function createPreset(tree, options) {
185
208
  style: options.style,
186
209
  linter: options.linter,
187
210
  bundler: 'vite',
188
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
211
+ e2eTestRunner: options.e2eTestRunner ?? 'playwright',
189
212
  addPlugin,
190
213
  });
191
214
  }
@@ -213,11 +236,8 @@ async function createPreset(tree, options) {
213
236
  });
214
237
  }
215
238
  else if (options.preset === presets_1.Preset.ReactNative) {
216
- console.log('Before require');
217
239
  const { reactNativeApplicationGenerator } = require('@nx' +
218
240
  '/react-native');
219
- console.log('Hello', reactNativeApplicationGenerator);
220
- console.log('Active require');
221
241
  return reactNativeApplicationGenerator(tree, {
222
242
  name: options.name,
223
243
  directory: (0, path_1.join)('apps', options.name),
@@ -295,7 +315,3 @@ async function createPreset(tree, options) {
295
315
  throw new Error(`Invalid preset ${options.preset}`);
296
316
  }
297
317
  }
298
- function normalizeOptions(options) {
299
- options.name = (0, devkit_1.names)(options.name).fileName;
300
- return options;
301
- }
@@ -62,7 +62,7 @@
62
62
  "packageManager": {
63
63
  "description": "The package manager used to install dependencies.",
64
64
  "type": "string",
65
- "enum": ["npm", "yarn", "pnpm"]
65
+ "enum": ["npm", "yarn", "pnpm", "bun"]
66
66
  },
67
67
  "framework": {
68
68
  "description": "The framework which the application is using",
@@ -93,7 +93,7 @@
93
93
  "e2eTestRunner": {
94
94
  "description": "The tool to use for running e2e tests.",
95
95
  "type": "string",
96
- "enum": ["cypress", "playwright", "jest", "detox", "none"]
96
+ "enum": ["playwright", "cypress", "jest", "detox", "none"]
97
97
  },
98
98
  "ssr": {
99
99
  "description": "Enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) for the Angular application.",
@@ -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 (!tree.exists(rootConfigPath) ||
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)) {
@@ -1,11 +1,5 @@
1
1
  export declare enum Preset {
2
2
  Apps = "apps",
3
- /** @deprecated Use Apps instead
4
- */
5
- Empty = "empty",
6
- /** @deprecated Use NPM instead
7
- */
8
- Core = "core",
9
3
  NPM = "npm",
10
4
  TS = "ts",
11
5
  WebComponents = "web-components",
@@ -14,6 +8,8 @@ export declare enum Preset {
14
8
  ReactMonorepo = "react-monorepo",
15
9
  ReactStandalone = "react-standalone",
16
10
  NextJsStandalone = "nextjs-standalone",
11
+ RemixMonorepo = "remix-monorepo",
12
+ RemixStandalone = "remix-standalone",
17
13
  ReactNative = "react-native",
18
14
  VueMonorepo = "vue-monorepo",
19
15
  VueStandalone = "vue-standalone",
@@ -4,13 +4,6 @@ exports.Preset = void 0;
4
4
  var Preset;
5
5
  (function (Preset) {
6
6
  Preset["Apps"] = "apps";
7
- // TODO(v19): Remove Empty and Core presets
8
- /** @deprecated Use Apps instead
9
- */
10
- Preset["Empty"] = "empty";
11
- /** @deprecated Use NPM instead
12
- */
13
- Preset["Core"] = "core";
14
7
  Preset["NPM"] = "npm";
15
8
  Preset["TS"] = "ts";
16
9
  Preset["WebComponents"] = "web-components";
@@ -19,6 +12,8 @@ var Preset;
19
12
  Preset["ReactMonorepo"] = "react-monorepo";
20
13
  Preset["ReactStandalone"] = "react-standalone";
21
14
  Preset["NextJsStandalone"] = "nextjs-standalone";
15
+ Preset["RemixMonorepo"] = "remix-monorepo";
16
+ Preset["RemixStandalone"] = "remix-standalone";
22
17
  Preset["ReactNative"] = "react-native";
23
18
  Preset["VueMonorepo"] = "vue-monorepo";
24
19
  Preset["VueStandalone"] = "vue-standalone";
@@ -1,3 +1,3 @@
1
1
  export declare const nxVersion: any;
2
- export declare const typescriptVersion = "~5.3.2";
3
- export declare const angularCliVersion = "~17.2.0";
2
+ export declare const typescriptVersion = "~5.4.2";
3
+ export declare const angularCliVersion = "~18.0.0";
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.angularCliVersion = exports.typescriptVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
- exports.typescriptVersion = '~5.3.2';
5
+ exports.typescriptVersion = '~5.4.2';
6
6
  // TODO: remove when preset generation is reworked and
7
7
  // deps are not installed from workspace
8
- exports.angularCliVersion = '~17.2.0';
8
+ exports.angularCliVersion = '~18.0.0';
@@ -1,3 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function splitConfigurationIntoProjectJsonFiles(tree: Tree): Promise<void>;
3
- export default splitConfigurationIntoProjectJsonFiles;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.splitConfigurationIntoProjectJsonFiles = void 0;
4
- const devkit_1 = require("@nx/devkit");
5
- const convert_to_nx_project_1 = require("../../generators/convert-to-nx-project/convert-to-nx-project");
6
- async function splitConfigurationIntoProjectJsonFiles(tree) {
7
- await (0, convert_to_nx_project_1.default)(tree, { all: true });
8
- await (0, devkit_1.formatFiles)(tree);
9
- }
10
- exports.splitConfigurationIntoProjectJsonFiles = splitConfigurationIntoProjectJsonFiles;
11
- exports.default = splitConfigurationIntoProjectJsonFiles;