Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/deploy-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: |
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "floorplantool"]
path = floorplantool
url = https://github.com/i-kumar/floorplandigitizer.git
6 changes: 6 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions floorplantool
Submodule floorplantool added at ed9401
39 changes: 39 additions & 0 deletions scripts/build-floorplantool.sh
Original file line number Diff line number Diff line change
@@ -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"
Loading