Commit 0186ae9
committed
fix(shell-docs): unbreak preview build + harden related regressions
Three regressions from the earlier CR Round 1 fix batch + a related
miss the same round didn't catch.
1. `components/ai/page-actions.tsx` is `"use client"`; importing
`getBaseUrl` from `@/lib/sitemap-helpers` pulled `fs` / `path` /
`gray-matter` into the client bundle and broke the build entirely
("Module not found: Can't resolve 'fs'"). The whole point of
`getBaseUrl` is the 2-line env-var read + trailing-slash strip — no
filesystem work — so inline a `getClientBaseUrl()` helper here with a
pointer to the canonical server-side version. `sitemap-helpers.ts`
stays untouched so other server-side callers keep their convenience.
2. The same file re-threw caught errors from `fetchMarkdown` /
`clipboard.writeText` on the assumption that Fumadocs's
`useCopyButton` would treat the rejection as "don't flip the
`checked` state". It doesn't — there's no `.catch()` on the
internal promise (verified in
`fumadocs-ui/dist/utils/use-copy-button.js`), so the throw produced
an unhandled rejection (browser console noise + Sentry spam) AND
gave the user no visible failure indicator either way. Log and
swallow at this layer; a follow-up PR can introduce an explicit
error UI if we want "Copy failed" to surface.
3. `.claude/launch.json` routed `shell` to port 3004 by passing
`-- --port 3004` to `npm --prefix showcase/shell run dev`. But
shell's `dev` script ends with `npx -y concurrently -k -n
bundle,next "tsx ... --watch" "next dev"` — the trailing
`--port 3004` was parsed by `concurrently`, not `next dev`, so
`next dev` still bound 3000 and the original collision with `docs`
persisted. Switch to `bash -c "PORT=3004 npm --prefix showcase/shell
run dev"` so the env var passes through `concurrently` into
`next dev` (which natively reads PORT).
Call-site enumeration:
- `getClientBaseUrl` (new) — only used inside the same file. No
external callers to update.
- `getBaseUrl` (untouched in `@/lib/sitemap-helpers`) — server-side
callers (sitemap routes, `llms-full.txt` route, `llms.txt` route)
unchanged; verified via grep that no `"use client"` file imports it.
- `MarkdownCopyButton` — error now logged once via `console.error`
and swallowed; the button stays in its idle state.
- `.claude/launch.json` `shell` entry — `runtimeExecutable` flipped
from `npm` to `bash`; harness reads these as opaque strings.1 parent 04c6383 commit 0186ae9
2 files changed
Lines changed: 28 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 18 | + | |
| 19 | + | |
28 | 20 | | |
29 | 21 | | |
30 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
| |||
73 | 87 | | |
74 | 88 | | |
75 | 89 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
79 | 98 | | |
80 | | - | |
81 | 99 | | |
82 | 100 | | |
83 | 101 | | |
| |||
128 | 146 | | |
129 | 147 | | |
130 | 148 | | |
131 | | - | |
132 | | - | |
| 149 | + | |
| 150 | + | |
133 | 151 | | |
134 | 152 | | |
135 | 153 | | |
136 | 154 | | |
137 | 155 | | |
138 | 156 | | |
139 | | - | |
| 157 | + | |
140 | 158 | | |
141 | 159 | | |
142 | 160 | | |
| |||
0 commit comments