Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Compiled output
/dist
/packages/*/dist
/apps/docs/.analog
.wrangler
/tmp
/out-tsc
/bazel-out
Expand Down
5 changes: 4 additions & 1 deletion apps/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ From the repository root:
```bash
pnpm install
pnpm docs:dev # dev server on http://localhost:5173
pnpm docs:build # production build in apps/docs/dist
pnpm docs:build # production build in dist/apps/docs
pnpm docs:test # unit tests for the build plugins
pnpm docs:deploy # build, then deploy to Cloudflare Workers with wrangler
```

`docs:deploy` serves the prerendered pages in `dist/apps/docs/analog/public` as static assets, using `wrangler.jsonc`. Log in once with `pnpm --filter angular-devtools-docs exec wrangler login`, or set `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` in CI.

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`.

## Edit
Expand Down
3 changes: 2 additions & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"prettier": "^3.8.1",
"typescript": "~6.0.2",
"vite": "^8.3.0",
"vitest": "^4.0.8"
"vitest": "^4.0.8",
"wrangler": "^4.147.0"
}
}
10 changes: 9 additions & 1 deletion apps/docs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@
"sourceRoot": "apps/docs/src",
"tags": ["type:app", "scope:docs"],
"targets": {
"build": {
"outputs": ["{workspaceRoot}/dist/apps/docs"]
},
"preview": {
"dependsOn": ["build"],
"command": "node dist/analog/server/index.mjs",
"command": "node ../../dist/apps/docs/analog/server/index.mjs",
"options": {"cwd": "{projectRoot}"},
"continuous": true
},
"deploy": {
"dependsOn": ["build"],
"command": "wrangler deploy",
"options": {"cwd": "{projectRoot}"}
}
}
}
17 changes: 17 additions & 0 deletions apps/docs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {defineConfig, type Plugin} from 'vite';
import analog from '@analogjs/platform';
import tailwindcss from '@tailwindcss/vite';
import {readFileSync} from 'node:fs';
import {resolve} from 'node:path';
import {getBuildExtensions} from './src/marked-extensions/index.ts';
import {pageMetaPlugin} from './page-meta.plugin.ts';
import {internalLinkGuard} from './link-guard.plugin.ts';
Expand Down Expand Up @@ -67,9 +68,14 @@ function siteHtml(): Plugin {
};
}

// Nx runs the build from apps/docs, so Analog would write to apps/docs/dist.
// The site goes to <repo>/dist/apps/docs like the other projects.
const outDir = resolve(import.meta.dirname, '../../dist/apps/docs');

export default defineConfig(async () => ({
build: {
target: ['es2020'],
outDir: resolve(outDir, 'client'),
},
resolve: {
mainFields: ['module'],
Expand All @@ -90,6 +96,17 @@ export default defineConfig(async () => ({
searchIndexPlugin(),
apiGenPlugin(),
analog({
// The intermediate SSR bundle is only used for prerendering. It imports
// packages installed in apps/docs/node_modules, which Node cannot find
// from <repo>/dist, so it stays under apps/docs.
ssrBuildDir: resolve(import.meta.dirname, '.analog/ssr'),
nitro: {
buildDir: resolve(import.meta.dirname, '.analog/nitro'),
output: {
dir: resolve(outDir, 'analog'),
publicDir: resolve(outDir, 'analog/public'),
},
},
prerender: {
routes: async () => prerenderRoutes(import.meta.dirname),
},
Expand Down
10 changes: 10 additions & 0 deletions apps/docs/wrangler.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "../../node_modules/wrangler/config-schema.json",
"name": "angular-devtools-docs",
"compatibility_date": "2026-05-01",
// The site is fully prerendered, so it is served as static assets only.
"assets": {
"directory": "../../dist/apps/docs/analog/public",
"not_found_handling": "404-page",
},
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"analog:dev": "pnpm --filter analog-demo dev",
"docs:dev": "nx serve angular-devtools-docs",
"docs:build": "nx build angular-devtools-docs",
"docs:test": "nx test angular-devtools-docs"
"docs:test": "nx test angular-devtools-docs",
"docs:deploy": "nx deploy angular-devtools-docs"
},
"private": true,
"packageManager": "pnpm@10.33.4",
Expand Down
Loading
Loading