Skip to content

Add browser-only demo for GitHub Pages - #68

Merged
trainpaths merged 3 commits into
mainfrom
claude/magical-dijkstra-upzcsa
Nov 4, 2026
Merged

trainpaths merged 3 commits into
mainfrom
claude/magical-dijkstra-upzcsa

Conversation

@trainpaths

Copy link
Copy Markdown
Owner

Adds a fully functional browser-based demo of the CMS that runs entirely in the browser with no server backend. The demo is published to GitHub Pages at https://trainpaths.github.io/cms/ and serves as an interactive introduction to the block editor.

Key changes

  • Demo infrastructure (playground/demo/): Complete in-browser implementation including:

    • seed.ts: Seeded demo page with multilingual content (English, German, French, Italian) and site configuration
    • mockApi.ts: In-browser mock of the API that intercepts fetch calls and mirrors the real API's draft/live rules
    • store.ts: localStorage-backed state management for the demo page, with reset capability
    • mockApi.test.ts: Unit tests for the mock API covering publish/draft workflows and storage persistence
  • Demo UI components:

    • DemoApp.vue: Root component with router and UI containers
    • DemoMenu.vue: Floating demo control panel (edit/view toggle, reset, links to GitHub)
    • EditPage.vue: Real editor component pointing to the demo page
    • ViewPage.vue: Public page view with language switching and navigation
    • context.ts: Injection context for demo state and language management
    • main.ts: App initialization with i18n, router, and mock API setup
  • Demo assets:

    • media.ts: Fixed image library (no upload in demo)
    • SVG images: lake.svg, mountains.svg, city.svg, forest.svg, blocks.svg, waves.svg, logo.svg
    • messages.ts: Demo-specific UI strings (English, German, French, Italian)
  • Build configuration:

    • vite.demo.config.ts: Separate Vite config for the demo build with custom plugin to swap out the upload button
    • demo.html: Single-page entry point
    • vitest.config.ts: Test configuration for demo unit tests
  • CI/CD:

    • .github/workflows/pages.yml: New workflow to build and deploy the demo to GitHub Pages on pushes to main
    • Updated ci.yml to run demo tests + build as part of the CI pipeline
  • Configuration updates:

    • package.json: Added build:demo, dev:demo, and test:demo scripts
    • tsconfig.app.json and tsconfig.node.json: Include demo files in TypeScript compilation
    • .gitignore, .dockerignore, eslint.config.js: Exclude dist-demo build artifacts
  • Documentation:

    • Updated playground/CLAUDE.md with demo section explaining the architecture
    • Updated root README.md to link to the cms-starter template

Implementation details

The mock API (mockApi.ts) faithfully reproduces the real API's behavior:

  • Separates draft (working copy) from live (published) versions
  • Enforces slug validation and immutability rules
  • Tracks hasUnpublishedChanges and timestamps
  • Supports multilingual content with fallback localization
  • Persists changes to localStorage with graceful degradation when storage is full

The demo uses the real editor and public view components from the package, ensuring the demo accurately reflects actual CMS behavior. Language switching works across both the editor and public view, with proper locale loading and fallback handling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3v6g2oCeEBQuqUzmh7Hr5
@trainpaths
trainpaths merged commit f104f99 into main Nov 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants