From 9227b99f2e969bf95b4f8b71e3e3208d5beb324a Mon Sep 17 00:00:00 2001 From: Ishan Kumar Date: Mon, 12 Oct 2026 11:44:44 -0400 Subject: [PATCH] Host the Floor Plan Digitizer at /floorplantool/ (unlisted internal tool) Pull i-kumar/floorplandigitizer in as the git submodule `floorplantool/` and build it as a separate Vite app (base /floorplantool/) after the client build, copying its dist into client/dist/floorplantool so the GitHub Pages artifact serves it next to the site. Nothing on the site links to it on purpose. A submodule pointer bump on main redeploys it; the Build-and-Test workflow builds it on PRs too. Co-Authored-By: Claude Fable 5.1 --- .github/workflows/deploy-frontend.yml | 18 +++++++++++-- .github/workflows/deploy.yml | 5 ++++ .gitmodules | 3 +++ DEPLOYMENT.md | 6 +++++ README.md | 33 +++++++++++++++++++++++ floorplantool | 1 + scripts/build-floorplantool.sh | 39 +++++++++++++++++++++++++++ 7 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 160000 floorplantool create mode 100755 scripts/build-floorplantool.sh diff --git a/.github/workflows/deploy-frontend.yml b/.github/workflows/deploy-frontend.yml index f94a008..13287de 100644 --- a/.github/workflows/deploy-frontend.yml +++ b/.github/workflows/deploy-frontend.yml @@ -3,7 +3,13 @@ name: Deploy Frontend to GitHub Pages on: push: branches: [ main ] - paths: [ 'client/**' ] + paths: + - 'client/**' + # Floor plan tool (git submodule): a pointer bump redeploys it. + - 'floorplantool' + - '.gitmodules' + - 'scripts/build-floorplantool.sh' + - '.github/workflows/deploy-frontend.yml' workflow_dispatch: permissions: @@ -22,13 +28,17 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + submodules: true - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22.12' cache: 'npm' - cache-dependency-path: 'client/package-lock.json' + cache-dependency-path: | + client/package-lock.json + floorplantool/package-lock.json - name: Install dependencies run: | @@ -39,6 +49,10 @@ jobs: run: | cd client VITE_API_URL=${{ secrets.EC2_API_URL || 'https://api.maizebus.com' }} npm run build + + # Internal tool, served at /floorplantool/ (not linked from the site). + - name: Build floor plan tool + run: bash scripts/build-floorplantool.sh - name: Setup Pages uses: actions/configure-pages@v4 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7cbdcbf..ef0e0df 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,6 +13,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + submodules: true - name: Setup Node.js uses: actions/setup-node@v4 @@ -30,6 +32,9 @@ jobs: - name: Build client run: | cd client && npm run build + + - name: Build floor plan tool + run: bash scripts/build-floorplantool.sh - name: Build server run: | diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e8c757a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "floorplantool"] + path = floorplantool + url = https://github.com/i-kumar/floorplandigitizer.git diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 0bd3f3a..d6dad90 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -6,6 +6,12 @@ This project uses GitHub Actions to deploy the frontend to GitHub Pages and the The frontend is automatically deployed to GitHub Pages when changes are pushed to the `main` branch in the `client/` directory. +The same workflow also builds the **floor plan tool** (git submodule +`floorplantool/`, see the README) with `scripts/build-floorplantool.sh` and ships +it inside the same Pages artifact at `/floorplantool/`. A submodule pointer bump +on `main` triggers a redeploy; `workflow_dispatch` is the manual fallback. The +checkout step uses `submodules: true` — keep it, or the tool build fails. + ### Setup GitHub Pages 1. Go to your repository settings diff --git a/README.md b/README.md index 56b6300..ea9bac6 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ A full-stack web application for MaizeBus, built with React (Vite) frontend and maizebus-web/ ├── client/ # React frontend (Vite + TypeScript) ├── server/ # Node.js backend (Express + TypeScript) +├── floorplantool/ # Floor Plan Digitizer — git submodule (internal tool, see below) +├── scripts/ # build-floorplantool.sh (CI glue for the tool) ├── package.json # Root package.json with workspace configuration └── README.md ``` @@ -97,6 +99,37 @@ EMAIL_TO=contact@maizebus.com npm run start ``` +## Floor plan tool (internal, unlisted) + +The [Floor Plan Digitizer](https://github.com/i-kumar/floorplandigitizer) is +deployed alongside the site at **https://www.maizebus.com/floorplantool/**. It +is deliberately not linked from the navbar or anywhere else on the site — +share the URL directly. + +It lives in its own repository and is pulled in here as a git submodule +(`floorplantool/`). The frontend deploy workflow builds it separately +(`scripts/build-floorplantool.sh`, Vite base `/floorplantool/`) and copies the +output into `client/dist/floorplantool/` before uploading to GitHub Pages. The +site's React app never imports it, so the two apps share no dependencies. + +```bash +# Fresh clone: fetch the submodule too +git clone --recurse-submodules https://github.com/mbusdev/maizebus-web.git +# ...or, in an existing clone +git submodule update --init + +# Ship a newer version of the tool: move the pointer to its latest main and push +git submodule update --remote floorplantool +git add floorplantool && git commit -m "Update floor plan tool" && git push + +# Build the full site locally (client first — it wipes client/dist) +cd client && npm ci && npm run build && cd .. +bash scripts/build-floorplantool.sh +``` + +Develop the tool in its own repo (`cd floorplantool && npm run dev`, or clone +it separately); the submodule here only pins which commit is deployed. + ## License MIT License - see LICENSE file for details diff --git a/floorplantool b/floorplantool new file mode 160000 index 0000000..ed94017 --- /dev/null +++ b/floorplantool @@ -0,0 +1 @@ +Subproject commit ed940173b1d3c6d04a0fffcf0ee0c01f216925da diff --git a/scripts/build-floorplantool.sh b/scripts/build-floorplantool.sh new file mode 100755 index 0000000..ac4826d --- /dev/null +++ b/scripts/build-floorplantool.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Build the Floor Plan Digitizer (git submodule in ./floorplantool) and drop +# its static output into client/dist/floorplantool, so the GitHub Pages +# artifact serves it at https://www.maizebus.com/floorplantool/ next to the +# main site. It is an internal tool: nothing on the site links to it. +# +# Run AFTER `cd client && npm run build` — that step wipes client/dist. +# +# To ship a newer version of the tool, bump the submodule pointer: +# git submodule update --remote floorplantool +# git add floorplantool && git commit -m "Update floor plan tool" +set -euo pipefail +cd "$(dirname "$0")/.." + +TOOL_DIR=floorplantool +OUT_DIR=client/dist/floorplantool +BASE_PATH=/floorplantool/ + +if [ ! -f "$TOOL_DIR/package.json" ]; then + echo "error: $TOOL_DIR is empty — run 'git submodule update --init' first" >&2 + exit 1 +fi +if [ ! -f client/dist/index.html ]; then + echo "error: client/dist is missing — run 'cd client && npm run build' first" >&2 + exit 1 +fi + +echo "==> Building floor plan tool (base $BASE_PATH)" +( + cd "$TOOL_DIR" + npm ci --no-audit --no-fund + npm run typecheck + npx vite build --base="$BASE_PATH" +) + +echo "==> Copying into $OUT_DIR" +rm -rf "$OUT_DIR" +cp -R "$TOOL_DIR/dist" "$OUT_DIR" +echo "==> Done: $(find "$OUT_DIR" -type f | wc -l | tr -d ' ') files in $OUT_DIR"