Commit 7a1f6fd
authored
fix(embed): untrack web/frontend/dist/* and serve a fallback stub (#473)
The .gitignore already declares `web/frontend/` "auto-generated", and
every documented build path (`make build`, `make build-server`, the
release.yml + pr-build.yml CI workflows, the frontend/README.md
"Production Deployment" recipe) regenerates the bundle from source.
But the 39+ files under web/frontend/dist/ have been tracked since
a27d360, which means every `make frontend-build` produces a flood of
"deleted old-hash" + "untracked-but-gitignored new-hash" entries in
`git status`.
This commit brings the tracked state in line with the maintainers'
stated intent.
Changes:
1. `git rm --cached -r web/frontend/` removes the tracked Vite output.
2. Track `web/frontend/dist/.gitkeep` so //go:embed has at least one
file to embed on a fresh module fetch.
3. Track `web/embedded_fallback/index.html`, a small stub UI shown
when no real Vite bundle is present.
4. Change the embed directive in web/web.go to `all:frontend/dist`
(required to pick up the dotfile placeholder) and add a second
embed for the fallback. The handler falls back to the stub when
index.html isn't found in the real bundle.
5. `.gitignore` gains explicit re-include lines so the new .gitkeep
survives the generic `dist/` ignore rule earlier in the file.
6. Makefile's `frontend-build` recreates `.gitkeep` after copying the
freshly built dist into web/frontend/, so subsequent rebuilds
leave a clean `git status`.
User-visible behavior:
| Flow | Before | After |
|-----------------------------------------|---------------------|------------------------|
| `make build` from a clean tree | dirty tree after | clean tree after |
| `make build` re-run | dirty tree after | clean tree after |
| Bare `go build ./cmd/mcpproxy` | stale embedded UI | fallback stub at /ui/ |
| `go install …@latest` (no npm) | stale embedded UI | fallback stub at /ui/ |
| Docker / .deb / DMG release | uses `make build` | unchanged |
| CI release.yml / pr-build.yml | always rebuilds | unchanged |
The trade-off is that bare-Go-toolchain users (no npm) now get a stub
UI with a "build from source for the real UI" message instead of a
silently-stale bundle. The REST API, MCP endpoints, and CLI are
unaffected — only the `/ui/` route changes.
Verified:
- `go build ./...` succeeds
- `make frontend-build` produces a clean `git status`
- After wiping web/frontend/dist/* except .gitkeep, bare
`go build ./cmd/mcpproxy` compiles and the binary serves the
fallback HTML at /ui/
- `git archive HEAD | tar -x -C tmp && cd tmp && go build ./cmd/mcpproxy`
(the `go install` module-fetch simulation) produces the same fallback
behaviour1 parent 0597762 commit 7a1f6fd
31 files changed
Lines changed: 84 additions & 326 deletions
File tree
- web
- embedded_fallback
- frontend/dist
- assets
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
86 | 94 | | |
87 | 95 | | |
88 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
Whitespace-only changes.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments