fix: add local Fern theme fallback#768
Conversation
Signed-off-by: Andre Manoel <amanoel@nvidia.com>
|
Fern preview: Fern preview failed or skipped; see workflow logs.
|
Greptile SummaryThis PR adds a Fern theme access preflight to
|
| Filename | Overview |
|---|---|
| Makefile | Adds check-fern-theme-access, serve-fern-docs-dev, and serve-fern-docs-local-theme targets; routes serve-fern-docs-locally through a preflight that silently falls back to the local preview path when theme auth fails. Logic is correct. |
| fern/scripts/serve-local-docs-preview.py | New script that creates a temp directory with absolute-path symlinks to all fern/ children except docs.yml, writes a modified docs.yml (global-theme removed, local styles injected), then runs the supplied command from that dir. Signal handling and cleanup via context manager are correct. |
| fern/styles/local-preview.css | New standalone CSS file providing NVIDIA-style visual approximation for local preview; scoped to local preview only and not referenced from docs.yml. |
| fern/README.md | Adds a Troubleshooting section describing the fallback behavior and how to restore real theme access; also documents the local-preview.css file scope. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[make serve-fern-docs-locally] --> B[install-docs-deps]
B --> C[prepare-fern-docs]
C --> D[serve-fern-docs-dev]
D --> E{check-fern-theme-access FERN_GLOBAL_THEME set?}
E -- No global-theme in docs.yml --> F[fern docs dev real theme path]
E -- global-theme present --> G{fern docs theme list succeeds?}
G -- yes --> F
G -- no --> H[serve-fern-docs-local-theme]
H --> I[serve-local-docs-preview.py --root fern]
I --> J[Create temp dir with symlinks and modified docs.yml]
J --> K[fern docs dev from temp preview root]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[make serve-fern-docs-locally] --> B[install-docs-deps]
B --> C[prepare-fern-docs]
C --> D[serve-fern-docs-dev]
D --> E{check-fern-theme-access FERN_GLOBAL_THEME set?}
E -- No global-theme in docs.yml --> F[fern docs dev real theme path]
E -- global-theme present --> G{fern docs theme list succeeds?}
G -- yes --> F
G -- no --> H[serve-fern-docs-local-theme]
H --> I[serve-local-docs-preview.py --root fern]
I --> J[Create temp dir with symlinks and modified docs.yml]
J --> K[fern docs dev from temp preview root]
Reviews (2): Last reviewed commit: "fix: address Fern fallback review feedba..." | Re-trigger Greptile
|
|
||
| | Symptom | Fix | | ||
| |---------|-----| | ||
| | Local preview uses the local fallback theme | Sign in to https://dashboard.buildwithfern.com, run `cd fern && npx -y fern-api@5.41.1 login`, then retry. If it still falls back, export a privileged `DOCS_FERN_TOKEN` as `FERN_TOKEN`. | |
There was a problem hiding this comment.
Hardcoded Fern version will drift with
fern.config.json
The troubleshooting instruction uses the literal version fern-api@5.41.1. When the pinned version in fern.config.json is bumped, contributors following this table will run a different CLI version than the Makefile uses — which can cause subtle mismatches (e.g., a fern login token stored for the old version that doesn't authenticate the new one). The Makefile already derives FERN_VERSION dynamically from fern.config.json, so the README should reference that fact or use a generic form like npx -y fern-api@<version-from-fern.config.json> to keep the two in sync.
Prompt To Fix With AI
This is a comment left during a code review.
Path: fern/README.md
Line: 187
Comment:
**Hardcoded Fern version will drift with `fern.config.json`**
The troubleshooting instruction uses the literal version `fern-api@5.41.1`. When the pinned version in `fern.config.json` is bumped, contributors following this table will run a different CLI version than the Makefile uses — which can cause subtle mismatches (e.g., a `fern login` token stored for the old version that doesn't authenticate the new one). The Makefile already derives `FERN_VERSION` dynamically from `fern.config.json`, so the README should reference that fact or use a generic form like `npx -y fern-api@<version-from-fern.config.json>` to keep the two in sync.
How can I resolve this? If you propose a fix, please make it concise.
Code Review: PR #768 —
|
Signed-off-by: Andre Manoel <amanoel@nvidia.com>
📋 Summary
make serve-fern-docs-locallycurrently renders a broken local Fern preview when the developer's Fern account cannot fetch the NVIDIAglobal-theme. This PR keeps the real global theme as the preferred path, but falls back to a temporary local preview config with close NVIDIA-style styling so contributors can still iterate on docs without a privilegedFERN_TOKEN.🔗 Related Issue
N/A
🔄 Changes
serve-local-docs-preview.pyto generate a temporaryfern/docs.ymlwithout mutating the publish config.local-preview.cssfor a small NVIDIA-style local-only approximation.fern/README.md.🧪 Testing
.venv/bin/ruff check --fix ..venv/bin/ruff format .make check-fern-docsNPM_CONFIG_CACHE=/private/tmp/codex-npm-cache .venv/bin/python fern/scripts/serve-local-docs-preview.py --root fern -- npx -y fern-api@5.41.1 checkmake serve-fern-docs-locallyreachedDocs preview server ready on http://localhost:3000with the fallback path, then was stopped.make testpasses (not run - docs tooling change)✅ Checklist