chore(build): add offline build support and remove legacy build tasks

This commit is contained in:
Ivan 2026-05-18 05:09:24 -05:00
parent 6327e16c1b
commit 6fb0efbd89
No known key found for this signature in database
GPG key ID: B84314E2D9332AE0
3 changed files with 31 additions and 39 deletions

1
.gitignore vendored
View file

@ -8,6 +8,7 @@
# Dependencies
node_modules/
.pnpm-store/
vendor/offline/
# Python
__pycache__/

View file

@ -1,13 +1,35 @@
.PHONY: install run dev dev-fe build lint test test-be-perf clean help dist-linux dist-linux-x64
.PHONY: install install-offline run dev dev-fe build lint test test-be-perf clean help dist-linux dist-linux-x64
# Auto-detect offline bundle and configure caches
OFFLINE_BUNDLE := $(shell find vendor/offline -maxdepth 1 -type d -name 'meshchatx-offline-bundle-*' 2>/dev/null | head -n 1)
ifeq ($(MESHCHATX_OFFLINE_BUILD),1)
ifneq ($(OFFLINE_BUNDLE),)
export UV_CACHE_DIR := $(abspath $(OFFLINE_BUNDLE)/uv-cache)
export ELECTRON_BUILDER_CACHE := $(abspath $(OFFLINE_BUNDLE)/electron-builder-cache)
endif
endif
install:
ifeq ($(MESHCHATX_OFFLINE_BUILD),1)
@if [ ! -d "node_modules" ]; then \
echo "Error: node_modules not found for offline build." >&2; \
echo "Run: bash scripts/install-offline.sh" >&2; \
exit 1; \
fi
@echo "Offline build: skipping pnpm install (node_modules present)"
else
pnpm install
poetry install
poetry run python scripts/patch_lxst_pyogg_ogg_ctypes.py
endif
uv sync --group dev $(if $(filter 1,$(MESHCHATX_OFFLINE_BUILD)),--offline)
uv run python scripts/patch_lxst_pyogg_ogg_ctypes.py
install-offline:
bash scripts/install-offline.sh
# Python backend only. For HMR, use: make dev OR make run in one terminal and pnpm run dev in another.
run:
poetry run python -m meshchatx.meshchat
uv run python -m meshchatx.meshchat
# Vite dev server (live reload) + backend. Open http://localhost:5173 — proxies /api and /ws to MESHCHAT_PORT (default 8000).
dev:
@ -36,15 +58,15 @@ help:
lint:
pnpm run lint
poetry run ruff check .
poetry run ruff format --check .
uv run ruff check .
uv run ruff format --check .
test:
pnpm run test
poetry run python -m pytest tests/backend -n auto --cov=meshchatx/src/backend
uv run pytest tests/backend -n auto --cov=meshchatx/src/backend
test-be-perf:
poetry run python -m pytest tests/backend/test_performance_hotpaths.py tests/backend/test_performance_bottlenecks.py
uv run pytest tests/backend/test_performance_hotpaths.py tests/backend/test_performance_bottlenecks.py
clean:
rm -rf node_modules build dist python-dist meshchatx/public build-dir out

View file

@ -396,37 +396,6 @@ tasks:
- "PLATFORM=win32 PYTHON_CMD='{{.WINE_PYTHON}}' {{.NPM}} run build-backend"
- "npx electron-builder --linux AppImage deb --win portable nsis --publish=never"
# --- Legacy Electron Builds ---
dist:legacy:linux:
desc: Build Linux AppImage (Legacy Electron)
deps: [build:fe]
cmds:
- "PLATFORM=linux {{.NPM}} run build-backend"
- "npx electron-builder -c electron/package-legacy.json --linux AppImage --publish=never"
dist:legacy:win:
desc: Build Windows EXE (Legacy Electron)
deps: [build:fe]
cmds:
- "PLATFORM=win32 {{.NPM}} run build-backend"
- "npx electron-builder -c electron/package-legacy.json --win portable --publish=never"
dist:legacy:win:wine:
desc: Build Windows EXE via Wine (Legacy Electron)
deps: [build:fe]
cmds:
- "PLATFORM=win32 PYTHON_CMD='{{.WINE_PYTHON}}' {{.NPM}} run build-backend"
- "npx electron-builder -c electron/package-legacy.json --win portable nsis --publish=never"
dist:legacy:all:
desc: Build all Legacy apps
deps: [build:fe]
cmds:
- "PLATFORM=linux {{.NPM}} run build-backend"
- "PLATFORM=win32 {{.NPM}} run build-backend"
- "npx electron-builder -c electron/package-legacy.json --linux AppImage deb --win portable nsis --publish=never"
# --- Docker ---
docker:build: