mirror of
https://github.com/usestrix/strix.git
synced 2026-08-21 18:52:47 +02:00
Consolidate the viewer directories under strix/viewer
Move the Vite frontend source into strix/viewer/frontend and rename the built bundle to strix/viewer/static, so all the viewer's pieces live under one directory. Updated the server bundle path, vite outDir, packaging (pyproject exclude, PyInstaller spec), Makefile, gitignore, and docs to match. Avoided naming the bundle dir 'dist' since gitignore matches that unanchored and would drop the shipped bundle.
This commit is contained in:
+3
-3
@@ -1,8 +1,8 @@
|
||||
# Node / local-viewer SPA source (the built bundle in
|
||||
# strix/viewer/viewer_dist/ is committed and shipped; do not ignore it)
|
||||
# strix/viewer/static/ is committed and shipped; do not ignore it)
|
||||
node_modules/
|
||||
strix/viewer_src/node_modules/
|
||||
strix/viewer_src/.vite/
|
||||
strix/viewer/frontend/node_modules/
|
||||
strix/viewer/frontend/.vite/
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
|
||||
+7
-7
@@ -101,17 +101,17 @@ We welcome feature ideas! Please:
|
||||
|
||||
## 🖥️ Local viewer SPA
|
||||
|
||||
`strix view` serves a prebuilt web UI whose source lives in `strix/viewer_src/`
|
||||
(a Vite + React project) and whose built output is committed to
|
||||
`strix/viewer/viewer_dist/` and shipped in the package. End users never run a
|
||||
JS build. If you change anything under `strix/viewer_src/`, rebuild and commit
|
||||
the output:
|
||||
`strix view` serves a prebuilt web UI whose source lives in
|
||||
`strix/viewer/frontend/` (a Vite + React project) and whose built output is
|
||||
committed to `strix/viewer/static/` and shipped in the package. End users never
|
||||
run a JS build. If you change anything under `strix/viewer/frontend/`, rebuild
|
||||
and commit the output:
|
||||
|
||||
```bash
|
||||
make viewer # or: cd strix/viewer_src && npm ci && npm run build
|
||||
make viewer # or: cd strix/viewer/frontend && npm ci && npm run build
|
||||
```
|
||||
|
||||
Commit both the source change and the regenerated `strix/viewer/viewer_dist/`.
|
||||
Commit both the source change and the regenerated `strix/viewer/static/`.
|
||||
|
||||
## 🤝 Community
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ clean:
|
||||
|
||||
viewer:
|
||||
@echo "🖥️ Building the local-viewer SPA..."
|
||||
cd strix/viewer_src && npm ci && npm run build
|
||||
@echo "✅ Viewer built to strix/viewer/viewer_dist/ (commit the changes)."
|
||||
cd strix/viewer/frontend && npm ci && npm run build
|
||||
@echo "✅ Viewer built to strix/viewer/static/ (commit the changes)."
|
||||
|
||||
dev: format lint type-check
|
||||
@echo "✅ Development cycle complete!"
|
||||
|
||||
+3
-3
@@ -77,10 +77,10 @@ build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["strix"]
|
||||
# The prebuilt viewer bundle under strix/viewer/viewer_dist/ ships automatically
|
||||
# The prebuilt viewer bundle under strix/viewer/static/ ships automatically
|
||||
# (hatchling includes non-.py files under the package). The Vite SOURCE lives
|
||||
# under the package dir too but must never ship in the wheel.
|
||||
exclude = ["strix/viewer_src", "strix/viewer_src/**"]
|
||||
# under the package dir too (strix/viewer/frontend/) but must never ship in the wheel.
|
||||
exclude = ["strix/viewer/frontend", "strix/viewer/frontend/**"]
|
||||
|
||||
# ============================================================================
|
||||
# Type Checking Configuration
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@ for tcss_file in strix_root.rglob('*.tcss'):
|
||||
datas.append((str(tcss_file), str(rel_path.parent)))
|
||||
|
||||
# Prebuilt local-viewer SPA (served by `strix view`).
|
||||
viewer_dist = strix_root / 'viewer' / 'viewer_dist'
|
||||
for asset in viewer_dist.rglob('*'):
|
||||
viewer_static = strix_root / 'viewer' / 'static'
|
||||
for asset in viewer_static.rglob('*'):
|
||||
if asset.is_file():
|
||||
rel_path = asset.relative_to(project_root)
|
||||
datas.append((str(asset), str(rel_path.parent)))
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ def run_view(argv: list[str]) -> None:
|
||||
if not bundle_is_built():
|
||||
console.print(
|
||||
"[bold red]Viewer UI is not built.[/]\n"
|
||||
"Build it with: [cyan]cd strix/viewer_src && npm ci && npm run build[/]"
|
||||
"Build it with: [cyan]cd strix/viewer/frontend && npm ci && npm run build[/]"
|
||||
)
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
@@ -5,7 +5,7 @@ import { fileURLToPath, URL } from "node:url";
|
||||
|
||||
// The viewer is served as static files by a stdlib Python server on an
|
||||
// arbitrary ephemeral port, so all asset URLs must be relative (base: "./").
|
||||
// The build output is committed at strix/viewer/viewer_dist and shipped.
|
||||
// The build output is committed at strix/viewer/static and shipped.
|
||||
export default defineConfig({
|
||||
base: "./",
|
||||
plugins: [react(), tailwindcss()],
|
||||
@@ -15,7 +15,7 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
build: {
|
||||
outDir: "../viewer/viewer_dist",
|
||||
outDir: "../static",
|
||||
emptyOutDir: true,
|
||||
},
|
||||
});
|
||||
@@ -47,7 +47,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
def bundle_dir() -> Path:
|
||||
"""Directory holding the committed, prebuilt SPA (index.html + assets)."""
|
||||
return Path(__file__).resolve().parent / "viewer_dist"
|
||||
return Path(__file__).resolve().parent / "static"
|
||||
|
||||
|
||||
def bundle_is_built() -> bool:
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Reference in New Issue
Block a user