From 633510b7de2ada719f95070e1d9c78851f6f6931 Mon Sep 17 00:00:00 2001 From: Jack Kingsman Date: Wed, 11 Mar 2026 17:44:55 -0700 Subject: [PATCH] Bring back in package-lock.json --- .gitignore | 1 - AGENTS.md | 4 ++-- Dockerfile | 4 ++-- README.md | 6 +++--- app/frontend_static.py | 4 +--- frontend/{package-lock.docker.json => package-lock.json} | 0 scripts/collect_licenses.sh | 8 +------- scripts/docker_ci.sh | 2 +- tests/e2e/playwright.config.ts | 4 ++-- tests/test_frontend_static.py | 2 +- 10 files changed, 13 insertions(+), 22 deletions(-) rename frontend/{package-lock.docker.json => package-lock.json} (100%) diff --git a/.gitignore b/.gitignore index 1bb7792..500024b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ wheels/ # Virtual environments .venv frontend/node_modules/ -frontend/package-lock.json frontend/test-results/ # Frontend build output (built from source by end users) diff --git a/AGENTS.md b/AGENTS.md index 90be2d7..874e494 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -223,7 +223,7 @@ MESHCORE_SERIAL_PORT=/dev/cu.usbserial-0001 uv run uvicorn app.main:app --reload ```bash cd frontend -npm install +npm ci npm run dev # http://localhost:5173, proxies /api to :8000 ``` @@ -237,7 +237,7 @@ Terminal 2: `cd frontend && npm run dev` In production, the FastAPI backend serves the compiled frontend. Build the frontend first: ```bash -cd frontend && npm install && npm run build && cd .. +cd frontend && npm ci && npm run build && cd .. uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 ``` diff --git a/Dockerfile b/Dockerfile index 5459660..bdd9d4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,8 @@ ARG COMMIT_HASH=unknown WORKDIR /build -COPY frontend/package.json frontend/.npmrc ./ -RUN npm install +COPY frontend/package.json frontend/package-lock.json frontend/.npmrc ./ +RUN npm ci COPY frontend/ ./ RUN VITE_COMMIT_HASH=${COMMIT_HASH} npm run build diff --git a/README.md b/README.md index 1086e09..95ba617 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ cd Remote-Terminal-for-MeshCore uv sync # Build frontend -cd frontend && npm install && npm run build && cd .. +cd frontend && npm ci && npm run build && cd .. # Run server uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 @@ -175,7 +175,7 @@ uv run uvicorn app.main:app --reload ```bash cd frontend -npm install +npm ci npm run dev # Dev server at http://localhost:5173 (proxies API to :8000) npm run build # Production build to dist/ ``` @@ -287,7 +287,7 @@ sudo -u remoteterm uv sync # Build frontend (required for the backend to serve the web UI) cd /opt/remoteterm/frontend -sudo -u remoteterm npm install +sudo -u remoteterm npm ci sudo -u remoteterm npm run build # Install and start service diff --git a/app/frontend_static.py b/app/frontend_static.py index ddb0109..fcc39fa 100644 --- a/app/frontend_static.py +++ b/app/frontend_static.py @@ -164,7 +164,5 @@ def register_frontend_missing_fallback(app: FastAPI) -> None: async def frontend_not_built(): return JSONResponse( status_code=404, - content={ - "detail": "Frontend not built. Run: cd frontend && npm install && npm run build" - }, + content={"detail": "Frontend not built. Run: cd frontend && npm ci && npm run build"}, ) diff --git a/frontend/package-lock.docker.json b/frontend/package-lock.json similarity index 100% rename from frontend/package-lock.docker.json rename to frontend/package-lock.json diff --git a/scripts/collect_licenses.sh b/scripts/collect_licenses.sh index a98d24c..0dfa602 100755 --- a/scripts/collect_licenses.sh +++ b/scripts/collect_licenses.sh @@ -7,7 +7,6 @@ set -euo pipefail REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" OUT="${1:-$REPO_ROOT/LICENSES.md}" -FRONTEND_DOCKER_LOCK="$REPO_ROOT/frontend/package-lock.docker.json" FRONTEND_LICENSE_IMAGE="${FRONTEND_LICENSE_IMAGE:-node:20-slim}" FRONTEND_LICENSE_NPM="${FRONTEND_LICENSE_NPM:-10.9.5}" @@ -72,7 +71,6 @@ frontend_licenses_docker() { set -euo pipefail cp -a /src/frontend ./frontend cd frontend - cp package-lock.docker.json package-lock.json npm i -g npm@$FRONTEND_LICENSE_NPM >/dev/null npm ci --ignore-scripts >/dev/null node /src/scripts/print_frontend_licenses.cjs @@ -80,11 +78,7 @@ frontend_licenses_docker() { } frontend_licenses() { - if [ -f "$FRONTEND_DOCKER_LOCK" ]; then - frontend_licenses_docker - else - frontend_licenses_local - fi + frontend_licenses_docker } # ── Assemble ───────────────────────────────────────────────────────── diff --git a/scripts/docker_ci.sh b/scripts/docker_ci.sh index a63d350..e08150b 100755 --- a/scripts/docker_ci.sh +++ b/scripts/docker_ci.sh @@ -35,7 +35,7 @@ run_combo() { npm i -g npm@${npm_version} echo 'Using Node:' \$(node -v) echo 'Using npm:' \$(npm -v) - npm install + npm ci npm run build " diff --git a/tests/e2e/playwright.config.ts b/tests/e2e/playwright.config.ts index 88ed63c..a23de8b 100644 --- a/tests/e2e/playwright.config.ts +++ b/tests/e2e/playwright.config.ts @@ -38,8 +38,8 @@ export default defineConfig({ command: `bash -c ' echo "[e2e] $(date +%T.%3N) Starting webServer command..." if [ ! -d frontend/dist ]; then - echo "[e2e] $(date +%T.%3N) frontend/dist missing — running npm install + build" - cd frontend && npm install && npm run build + echo "[e2e] $(date +%T.%3N) frontend/dist missing — running npm ci + build" + cd frontend && npm ci && npm run build echo "[e2e] $(date +%T.%3N) Frontend build complete" else echo "[e2e] $(date +%T.%3N) frontend/dist exists — skipping build" diff --git a/tests/test_frontend_static.py b/tests/test_frontend_static.py index fbc21ce..8c1c86c 100644 --- a/tests/test_frontend_static.py +++ b/tests/test_frontend_static.py @@ -28,7 +28,7 @@ def test_missing_dist_logs_error_and_keeps_app_running(tmp_path, caplog): with TestClient(app) as client: resp = client.get("/") assert resp.status_code == 404 - assert "npm install" in resp.json()["detail"] + assert "npm ci" in resp.json()["detail"] assert "npm run build" in resp.json()["detail"]