Embedded the frontend in the binary, and built it in the build script
`npm run sync` in web/ copies the build output (web/dist, from npm run build) to internal/frontend/dist, which the binary embeds. Go can't embed from outside the package's directory (web/ is also outside the Go module), hence the copy. Only dist/.gitkeep is committed, so a fresh clone still compiles, and a binary built without syncing first serves no frontend. job-search serve serves server.frontend.dir if it is set, or else the embedded build, or warns that there is no frontend. scripts/build.sh builds and syncs the frontend before building, running npm ci first for a release or when web/node_modules is missing.
This commit is contained in:
1 parent
1832ea7437
commit
5e6c011ecb
12 files changed
+104
-11
No files matched your search
@@ -15,7 +15,8 @@ npm run lint # eslint .
|
||||
npm run format:check # prettier --check .
|
||||
npm run format # prettier --write .: formats every file
|
||||
npm run generate:api # regenerate src/types/api.ts from the backend's OpenAPI description
|
||||
npm run build # typecheck, then vite build
|
||||
npm run build # typecheck, then vite build into dist/
|
||||
npm run sync # copy dist/ to ../internal/frontend/dist/, which the backend embeds
|
||||
npm run dev # dev server; /api and /ws go to the backend (API_PROXY_TARGET, default localhost:9393)
|
||||
```
|
||||
|
||||
@@ -79,7 +80,7 @@ if (isRelease(parsed)) { ... }
|
||||
| `src/primitives/` | Solid primitives: state and loading, no markup (`createX.ts`) |
|
||||
| `src/components/` | Components, one exported component per file |
|
||||
| `src/lib/` | Plain functions: no Solid, no DOM where avoidable |
|
||||
| `scripts/` | Development scripts run by npm, in TypeScript (`generateApiTypes.ts`) |
|
||||
| `scripts/` | Development scripts run by npm, in TypeScript (`generateApiTypes.ts`, `syncDist.ts`) |
|
||||
|
||||
- Components' files are PascalCase, named after the component
|
||||
(`MarkMenu.tsx`). Other files are usually camelCase (`format.ts`); the
|
||||
|
||||
Reference in new issue
Block a user