Commit 2baf2b7
committed
fix(site): derive base from GITHUB_REPOSITORY and fix 404 redirect target
Addresses Copilot review feedback on PR #11.
vite.config.ts:
Production `base` is no longer hardcoded to /coder-skill-scanner/.
Resolves via:
1. VITE_BASE_PATH env (explicit override)
2. GITHUB_REPOSITORY (CI default; forks Just Work with zero config)
3. / (apex / local-build fallback)
Dev keeps / so the local Vite server and report proxy work without
env juggling.
public/404.html + new rewrite-public-base-url Vite plugin:
The GitHub Pages SPA-fallback page redirected to /?p=... (apex),
which bounced users off the project page and onto the github.io
apex instead of bringing them back into the SPA. Use %BASE_URL% as
the redirect prefix and substitute it at build time via a tiny
plugin (Vite handles the substitution for index.html but copies
public/ verbatim).
Verified with four build runs (GITHUB_REPOSITORY=coder/coder-skill-scanner,
GITHUB_REPOSITORY=someone-else/my-scanner, VITE_BASE_PATH override, no
env). In every case the bases emitted in dist/index.html and the
target string in dist/404.html match.1 parent a401700 commit 2baf2b7
2 files changed
Lines changed: 62 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
17 | 65 | | |
18 | 66 | | |
19 | 67 | | |
| 68 | + | |
20 | 69 | | |
21 | 70 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
27 | 75 | | |
28 | 76 | | |
29 | 77 | | |
| |||
0 commit comments