Skip to content

Commit 6abd4b3

Browse files
Analog to nx (pangular-inspector#196)
chore: use nx for analog docs
1 parent 234becc commit 6abd4b3

7 files changed

Lines changed: 124 additions & 91 deletions

File tree

‎apps/docs/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ From the repository root:
1010
pnpm install
1111
pnpm docs:dev # dev server on http://localhost:5173
1212
pnpm docs:build # production build in apps/docs/dist
13+
pnpm docs:test # unit tests for the build plugins
1314
```
1415

15-
With Nx: `pnpm nx serve angular-devtools-docs`, `pnpm nx build angular-devtools-docs` and `pnpm nx test angular-devtools-docs`.
16+
These scripts run Nx targets. The `@nx/vite` and `@nx/vitest` plugins infer them from `vite.config.ts`. You can also run any target directly, for example `pnpm nx typecheck angular-devtools-docs` or `pnpm nx preview angular-devtools-docs`.
1617

1718
## Edit
1819

‎apps/docs/angular.json‎

Lines changed: 0 additions & 54 deletions
This file was deleted.

‎apps/docs/package.json‎

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,8 @@
99
"node": "^22.22.3 || ^24.15.0 || >=26.0.0"
1010
},
1111
"scripts": {
12-
"ng": "ng",
13-
"dev": "vite",
14-
"start": "pnpm run dev",
15-
"build": "vite build",
16-
"watch": "vite build --watch",
17-
"test": "vitest run",
18-
"preview": "node dist/analog/server/index.mjs",
1912
"format": "prettier --write .",
20-
"format:check": "prettier --check .",
21-
"test:watch": "vitest"
13+
"format:check": "prettier --check ."
2214
},
2315
"dependencies": {
2416
"@analogjs/content": "^2.7.5",
@@ -63,22 +55,5 @@
6355
"typescript": "~6.0.2",
6456
"vite": "^8.3.0",
6557
"vitest": "^4.0.8"
66-
},
67-
"nx": {
68-
"name": "angular-devtools-docs",
69-
"targets": {
70-
"build": {
71-
"outputs": [
72-
"{projectRoot}/dist"
73-
]
74-
},
75-
"serve": {
76-
"command": "vite",
77-
"options": {
78-
"cwd": "{projectRoot}"
79-
},
80-
"continuous": true
81-
}
82-
}
8358
}
8459
}

‎apps/docs/project.json‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
3+
"name": "angular-devtools-docs",
4+
"projectType": "application",
5+
"sourceRoot": "apps/docs/src",
6+
"tags": ["type:app", "scope:docs"],
7+
"targets": {
8+
"preview": {
9+
"dependsOn": ["build"],
10+
"command": "node dist/analog/server/index.mjs",
11+
"options": {"cwd": "{projectRoot}"},
12+
"continuous": true
13+
}
14+
}
15+
}

‎nx.json‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,27 @@
99
"default": ["{projectRoot}/**/*", "sharedGlobals"],
1010
"production": ["default"]
1111
},
12+
"plugins": [
13+
{
14+
"plugin": "@nx/vite/plugin",
15+
"include": ["apps/docs/**/*"],
16+
"options": {
17+
"buildTargetName": "build",
18+
"devTargetName": "serve",
19+
"previewTargetName": "preview",
20+
"serveStaticTargetName": "serve-static",
21+
"typecheckTargetName": "typecheck"
22+
}
23+
},
24+
{
25+
"plugin": "@nx/vitest",
26+
"include": ["apps/docs/**/*"],
27+
"options": {
28+
"testTargetName": "test",
29+
"testMode": "run"
30+
}
31+
}
32+
],
1233
"nxCloudId": "6ababfaa6b3b7cbe16499a58",
1334
"analytics": true
1435
}

‎package.json‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
"extension:build": "pnpm devtools:build && rm -rf extension/ui && cp -r dist/devtools-ui extension/ui",
3333
"extension:zip": "pnpm extension:build && rm -f dist/ng-devtools-extension.zip && cd extension && zip -r ../dist/ng-devtools-extension.zip . -x '*.DS_Store'",
3434
"analog:dev": "pnpm --filter analog-demo dev",
35-
"docs:dev": "pnpm --filter angular-devtools-docs dev",
36-
"docs:build": "pnpm --filter angular-devtools-docs build"
35+
"docs:dev": "nx serve angular-devtools-docs",
36+
"docs:build": "nx build angular-devtools-docs",
37+
"docs:test": "nx test angular-devtools-docs"
3738
},
3839
"private": true,
3940
"packageManager": "pnpm@10.33.4",
@@ -70,6 +71,8 @@
7071
"@ngrx/store": "^22.0.1",
7172
"@ngrx/store-devtools": "^22.0.1",
7273
"@nx/angular": "23.2.1",
74+
"@nx/vite": "23.2.1",
75+
"@nx/vitest": "23.2.1",
7376
"@nx/workspace": "23.2.1",
7477
"@schematics/angular": "^22.1.8",
7578
"@types/express": "^5.0.1",

0 commit comments

Comments
 (0)