Skip to content

Commit b4e9140

Browse files
fix: support and migrate to Nx 23 (#2393)
1 parent 02a0284 commit b4e9140

15 files changed

Lines changed: 1220 additions & 1229 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,5 @@ vitest.config.*.timestamp*
7676
.claude/worktrees
7777
.claude/settings.local.json
7878
.nx/polygraph
79-
.nx/self-healing
79+
.nx/self-healing
80+
.nx/migrate-runs

libs/my-package/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default defineConfig(({ mode }) => ({
2424
fileName: `fesm2022/my-package`,
2525
formats: ['es' as const],
2626
},
27-
rollupOptions: {
27+
rolldownOptions: {
2828
external: [/^@angular\/.*/, 'rxjs', 'rxjs/operators'],
2929
output: {
3030
preserveModules: false,

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
"@astrojs/react": "^5.0.0",
6060
"@babel/core": "^7.29.0",
6161
"@mdx-js/react": "3.1.1",
62-
"@nx/angular": "22.7.5",
63-
"@nx/devkit": "22.7.5",
62+
"@nx/angular": "23.0.1",
63+
"@nx/devkit": "23.0.1",
6464
"@trpc/client": "^10.45.2",
6565
"@trpc/server": "^10.45.2",
6666
"ajv-formats": "^3.0.1",
@@ -107,16 +107,16 @@
107107
"@eslint/eslintrc": "^3.3.5",
108108
"@eslint/js": "^10.0.1",
109109
"@netlify/functions": "^2.8.2",
110-
"@nx/cypress": "22.7.5",
111-
"@nx/eslint": "22.7.5",
112-
"@nx/eslint-plugin": "22.7.5",
113-
"@nx/js": "22.7.5",
114-
"@nx/playwright": "22.7.5",
115-
"@nx/plugin": "22.7.5",
116-
"@nx/storybook": "22.7.5",
117-
"@nx/vite": "22.7.5",
118-
"@nx/vitest": "22.7.5",
119-
"@nx/web": "22.7.5",
110+
"@nx/cypress": "23.0.1",
111+
"@nx/eslint": "23.0.1",
112+
"@nx/eslint-plugin": "23.0.1",
113+
"@nx/js": "23.0.1",
114+
"@nx/playwright": "23.0.1",
115+
"@nx/plugin": "23.0.1",
116+
"@nx/storybook": "23.0.1",
117+
"@nx/vite": "23.0.1",
118+
"@nx/vitest": "23.0.1",
119+
"@nx/web": "23.0.1",
120120
"@oxc-angular/vite": "^0.0.15",
121121
"@oxc-project/runtime": "^0.117.0",
122122
"@playwright/test": "^1.58.2",
@@ -153,7 +153,7 @@
153153
"conventional-changelog": "^7.2.0",
154154
"conventional-changelog-cli": "^5.0.0",
155155
"cpy-cli": "^7.0.0",
156-
"cypress": "15.11.0",
156+
"cypress": "15.18.0",
157157
"esbuild": "0.27.3",
158158
"eslint": "^10.0.3",
159159
"eslint-config-prettier": "10.1.8",
@@ -166,7 +166,7 @@
166166
"find-up": "^8.0.0",
167167
"fs-extra": "^11.3.4",
168168
"h3": "^1.13.0",
169-
"happy-dom": "^20.8.3",
169+
"happy-dom": "20.10.6",
170170
"jiti": "2.6.1",
171171
"jsdom": "28.1.0",
172172
"jsonc-eslint-parser": "^3.1.0",
@@ -177,7 +177,7 @@
177177
"minimist": "^1.2.8",
178178
"ng-packagr": "^22.0.0",
179179
"nitropack": "^2.13.1",
180-
"nx": "22.7.5",
180+
"nx": "23.0.1",
181181
"playwright": "^1.58.2",
182182
"postcss": "^8.5.8",
183183
"postcss-import": "~16.1.1",

packages/content-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"tslib": "^2.8.1"
99
},
1010
"peerDependencies": {
11-
"@nx/devkit": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0 || ^22",
11+
"@nx/devkit": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0 || ^23.0.0 || ^23",
1212
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
1313
},
1414
"peerDependenciesMeta": {

packages/content/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
2828
"@angular/platform-browser": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
2929
"@angular/router": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
30-
"@nx/devkit": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0 || ^22",
30+
"@nx/devkit": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0 || ^23.0.0 || ^23",
3131
"front-matter": "^4.0.2",
3232
"marked": "^15.0.7",
3333
"marked-gfm-heading-id": "^4.1.1",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { vitestExecutor } from '@nx/vite/executors';
1+
import { vitestExecutor } from '@nx/vitest/executors';
22

33
export default vitestExecutor;

packages/nx-plugin/src/generators/app/generator.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { lt } from 'semver';
1010

1111
import generator from './generator';
1212
import { AnalogNxApplicationGeneratorOptions } from './schema';
13-
import { checkAndCleanWithSemver } from '@nx/devkit/src/utils/semver';
13+
import { checkAndCleanWithSemver } from '@nx/devkit/internal';
1414

1515
describe('nx-plugin generator', () => {
1616
const setup = async (

packages/nx-plugin/src/generators/app/lib/add-angular-app.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
import { getWorkspaceLayout, Tree } from '@nx/devkit';
2+
// `@nx/angular` exposes its generators only through its `exports` map, which
3+
// this project's classic `node` module resolution does not consult. Reference
4+
// the built declaration directly so the type resolves; the runtime entry is
5+
// imported below via `@nx/angular/generators`.
6+
import type { applicationGenerator } from '@nx/angular/dist/generators';
27
import { NormalizedOptions } from '../generator';
38

49
export async function addAngularApp(tree: Tree, options: NormalizedOptions) {
510
const isNx = tree.exists('/nx.json');
611
const appsDir = isNx ? getWorkspaceLayout(tree).appsDir : 'projects';
712

8-
const appOptions: typeof import('@nx/angular/src/generators/application/schema') =
9-
{
10-
name: options.analogAppName,
11-
directory: `${appsDir}/${options.analogAppName}`,
12-
linter: !isNx || process.env['NODE_ENV'] === 'test' ? 'none' : 'eslint',
13-
unitTestRunner: 'vitest',
14-
standalone: true,
15-
ssr: false,
16-
bundler: 'esbuild',
17-
serverRouting: false,
18-
skipFormat: true,
19-
tags: options.tags,
20-
};
13+
type ApplicationSchema = Parameters<typeof applicationGenerator>[1];
14+
const appOptions: ApplicationSchema = {
15+
name: options.analogAppName,
16+
directory: `${appsDir}/${options.analogAppName}`,
17+
linter: !isNx || process.env['NODE_ENV'] === 'test' ? 'none' : 'eslint',
18+
// Analog sets up its own Vitest configuration in the init generator, so the
19+
// Angular generator should not scaffold a test runner. Nx 23 also removed
20+
// the `'vitest'` option in favour of `'vitest-angular'`/`'vitest-analog'`.
21+
unitTestRunner: 'none' as ApplicationSchema['unitTestRunner'],
22+
standalone: true,
23+
ssr: false,
24+
bundler: 'esbuild',
25+
serverRouting: false,
26+
skipFormat: true,
27+
tags: options.tags,
28+
};
2129

2230
await (
2331
await import(

packages/nx-plugin/src/generators/app/lib/add-tailwind-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { checkAndCleanWithSemver } from '@nx/devkit/src/utils/semver';
1+
import { checkAndCleanWithSemver } from '@nx/devkit/internal';
22
import { getTailwindDependencies } from '../versions/tailwind-dependencies';
33
import { lt } from 'semver';
44
import {

packages/nx-plugin/src/generators/preset/__snapshots__/generator.spec.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ exports[`preset generator > should match project.json 1`] = `
3030
"targets": {
3131
"build": {
3232
"executor": "@analogjs/platform:vite",
33+
"defaultConfiguration": "production",
34+
"outputs": ["{workspaceRoot}/dist/apps/my-app"],
3335
"options": {
3436
"configFile": "my-app/vite.config.ts",
3537
"main": "my-app/src/main.ts",
3638
"outputPath": "dist/my-app/client",
3739
"tsConfig": "my-app/tsconfig.app.json"
3840
},
39-
"defaultConfiguration": "production",
4041
"configurations": {
4142
"development": {
4243
"mode": "development"
@@ -45,8 +46,7 @@ exports[`preset generator > should match project.json 1`] = `
4546
"sourcemap": false,
4647
"mode": "production"
4748
}
48-
},
49-
"outputs": ["{workspaceRoot}/dist/apps/my-app"]
49+
}
5050
},
5151
"serve": {
5252
"executor": "@analogjs/platform:vite-dev-server",

0 commit comments

Comments
 (0)