Skip to content

Commit 8241741

Browse files
committed
docs: expand maintainer debugging workflow
1 parent c824525 commit 8241741

1 file changed

Lines changed: 85 additions & 15 deletions

File tree

docs/debugging.md

Lines changed: 85 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ When debugging package changes in this monorepo, prefer the project-level Nx tar
2929
# Focus on Angular plugin HMR/style behavior
3030
DEBUG=analog:angular:hmr,analog:angular:styles pnpm nx test vite-plugin-angular
3131

32-
# Focus on platform routing output
33-
DEBUG=analog:platform:routes pnpm nx build platform
32+
# Focus on Compilation API inclusion, emit registration, and transform misses
33+
DEBUG=analog:angular:compilation-api,analog:angular:compiler,analog:angular:emit pnpm nx test vite-plugin-angular
3434

3535
# Focus on the style-pipeline integration seam in a served app
3636
DEBUG=analog:platform:style-pipeline,analog:angular:style-pipeline pnpm nx serve your-app
@@ -47,6 +47,16 @@ first so each `dist` folder contains its generated `package.json`. The source
4747
package manifests still contain `catalog:` and `workspace:*` references that are
4848
only rewritten during Analog's release-style build pipeline.
4949

50+
Prefer `link:` for active local debugging.
51+
52+
- `link:` keeps the consumer wired to the live built `dist` directories through
53+
symlinks.
54+
- `file:` can stage a snapshot into the consumer's `.pnpm` store. If you later
55+
rebuild Analog without changing the version or specifier, pnpm may decide the
56+
consumer install is already current and keep serving stale package contents.
57+
- If you must use `file:`, always verify the active installed package contents,
58+
not just the Analog source tree or `dist`.
59+
5060
### Local checkout example
5161

5262
`pnpm-workspace.yaml`
@@ -57,26 +67,26 @@ packages:
5767
- 'libs/**'
5868

5969
overrides:
60-
'@analogjs/platform': file:/path/to/analog/packages/platform/dist
61-
'@analogjs/router': file:/path/to/analog/packages/router/dist
62-
'@analogjs/vite-plugin-angular': file:/path/to/analog/packages/vite-plugin-angular/dist
63-
'@analogjs/vite-plugin-nitro': file:/path/to/analog/packages/vite-plugin-nitro/dist
64-
'@analogjs/vitest-angular': file:/path/to/analog/packages/vitest-angular/dist
70+
'@analogjs/platform': link:/path/to/analog/packages/platform/dist
71+
'@analogjs/router': link:/path/to/analog/packages/router/dist
72+
'@analogjs/vite-plugin-angular': link:/path/to/analog/packages/vite-plugin-angular/dist
73+
'@analogjs/vite-plugin-nitro': link:/path/to/analog/packages/vite-plugin-nitro/dist
74+
'@analogjs/vitest-angular': link:/path/to/analog/packages/vitest-angular/dist
6575
```
6676
6777
Root `package.json`
6878

6979
```json
7080
{
7181
"dependencies": {
72-
"@analogjs/platform": "file:/path/to/analog/packages/platform/dist"
82+
"@analogjs/platform": "link:/path/to/analog/packages/platform/dist"
7383
},
7484
"overrides": {
75-
"@analogjs/platform": "file:/path/to/analog/packages/platform/dist",
76-
"@analogjs/router": "file:/path/to/analog/packages/router/dist",
77-
"@analogjs/vite-plugin-angular": "file:/path/to/analog/packages/vite-plugin-angular/dist",
78-
"@analogjs/vite-plugin-nitro": "file:/path/to/analog/packages/vite-plugin-nitro/dist",
79-
"@analogjs/vitest-angular": "file:/path/to/analog/packages/vitest-angular/dist"
85+
"@analogjs/platform": "link:/path/to/analog/packages/platform/dist",
86+
"@analogjs/router": "link:/path/to/analog/packages/router/dist",
87+
"@analogjs/vite-plugin-angular": "link:/path/to/analog/packages/vite-plugin-angular/dist",
88+
"@analogjs/vite-plugin-nitro": "link:/path/to/analog/packages/vite-plugin-nitro/dist",
89+
"@analogjs/vitest-angular": "link:/path/to/analog/packages/vitest-angular/dist"
8090
}
8191
}
8292
```
@@ -88,13 +98,52 @@ can still resolve transitive packages like `@analogjs/vite-plugin-angular` and
8898
:::
8999

90100
:::note
91-
pnpm currently does not allow `file:` entries in `catalog`, so local checkout
92-
wiring needs direct `file:` overrides instead of `catalog:` indirection.
101+
If the consumer workspace uses pnpm `catalog` entries, switch both the catalog
102+
entries and the consumer overrides together. Mixed states are a common source of
103+
confusing resolution behavior.
93104
:::
94105

95106
If your app also uses other published Analog packages such as
96107
`@analogjs/content` or `@analogjs/storybook-angular`, pin those the same way.
97108

109+
### Consumer validation checklist
110+
111+
After rebuilding Analog and refreshing the consumer install:
112+
113+
```bash
114+
# Confirm the active install points at your local dist output
115+
readlink node_modules/@analogjs/vite-plugin-angular
116+
117+
# Confirm the dev server is actually listening
118+
curl -k -I https://localhost:4200/
119+
120+
# Confirm the shell HTML and stylesheet entry are present
121+
lightpanda fetch \
122+
--insecure-disable-tls-host-verification \
123+
--wait-until done \
124+
--wait-ms 12000 \
125+
--dump html \
126+
https://localhost:4200/ | sed -n '1,80p'
127+
```
128+
129+
What to trust:
130+
131+
- `curl` is the fastest readiness check.
132+
- `Lightpanda` is useful for reachability, shell HTML, and asset-presence smoke
133+
tests.
134+
- Treat the consumer dev server logs as the source of truth for Angular
135+
compilation failures such as:
136+
- `contains Angular decorators but is not in the TypeScript program`
137+
- missing Angular emit output
138+
- JIT fallback for `@Injectable()` / `@Component()`
139+
140+
What not to over-trust:
141+
142+
- `Lightpanda` can surface browser-client or HMR-transport behavior that does
143+
not necessarily mean Analog failed to compile the app correctly.
144+
- A successful Analog rebuild does not prove the consumer is executing the new
145+
package code unless the consumer install is verified.
146+
98147
### GitHub branch example
99148

100149
If you want the same pattern from a GitHub branch instead of a local path, pnpm
@@ -136,6 +185,27 @@ those manifests still contain unresolved `catalog:` and `workspace:*`
136185
specifiers.
137186
:::
138187

188+
## Useful Angular Debug Scopes
189+
190+
Start with the smallest scope set that answers the question:
191+
192+
```bash
193+
DEBUG=analog:angular:compilation-api,analog:angular:compiler pnpm nx serve your-app
194+
DEBUG=analog:angular:emit pnpm nx serve your-app
195+
DEBUG=analog:angular:emit:v pnpm nx serve your-app
196+
```
197+
198+
Recommended interpretation:
199+
200+
- `analog:angular:compilation-api`
201+
- wrapper tsconfig generation, initialization, high-level compilation flow
202+
- `analog:angular:compiler`
203+
- compiler-option mutations and transform-path decisions
204+
- `analog:angular:emit`
205+
- root-name expansion, emit registration, transform misses/hits
206+
- `analog:angular:emit:v`
207+
- per-file root lists, output registration, and normalized emitter lookups
208+
139209
## Notes
140210

141211
- Use the repo root unless you have a specific reason to run inside a package subdirectory.

0 commit comments

Comments
 (0)