Stop tracking workspace/; bundled-demos/ is the canonical demo source
`workspace/` is runtime state (per-user folders, no-auth dev's `code/`) and shouldn't be in git. The same files were previously committed under both `workspace/code/` and `src/static/bundled-demos/`, which forced a Docker `diff -q` sync check and leaked user-scoped paths into version control. - /workspace/ added to .gitignore; all previously tracked files removed via `git rm --cached`. - src/static/bundled-demos/ becomes the single source of truth: panel16 demos, led_tutorial, led_patterns, neopixel demos, and main.py move here alongside the existing canonical demos. - New BUNDLED_DEMOS_DIR config; user_workspace seeders read from it. - main.py lifespan seeds WORKSPACE_ROOT/code/ on startup so a fresh clone running `pipenv run dev` still gets the full sample set (existing files never overwritten — user edits survive restarts). - Dockerfile drops `COPY workspace` and the diff sanity check. - README/LED_TUTORIAL repointed at the new canonical paths. - test_led_patterns loads led_patterns.py from bundled-demos. - test_api uses mkdir(exist_ok=True) for `code/` (startup pre-creates). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -14,17 +14,8 @@ RUN pipenv install --system --deploy
|
||||
COPY src ./src
|
||||
COPY lib ./lib
|
||||
RUN mkdir -p src/static/bundled-lib && cp -f lib/*.py src/static/bundled-lib/
|
||||
COPY workspace ./workspace
|
||||
# Sanity-check: the canonical demos under `src/static/bundled-demos/` (used by
|
||||
# the editor's "Reset demos" button) must stay in sync with `workspace/code/`.
|
||||
# Files in `bundled-demos/` are committed to git and copied via `COPY src`
|
||||
# above; this step just fails the build if a checked-in copy drifted from the
|
||||
# canonical version, so the mismatch is caught here instead of at runtime.
|
||||
RUN for f in pattern_rainbow_demo.py pattern_twinkle_demo.py pattern_chase_demo.py \
|
||||
adc_slider_demo.py pin_demo.py serial_demo.py; do \
|
||||
diff -q "workspace/code/$f" "src/static/bundled-demos/$f" \
|
||||
|| { echo "ERROR: $f out of sync between workspace/code/ and src/static/bundled-demos/" >&2; exit 1; }; \
|
||||
done
|
||||
# `workspace/` is runtime/user state (gitignored) and is created on demand
|
||||
# at app startup — the image does not need to ship it.
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
|
||||
Reference in New Issue
Block a user