Skip to content

Publish versioned CodeMirror 5 and CodeMirror 6 homepages and demos #53

Description

@haoranyu

Summary

Outcome update (2026-08-25): #62 superseded the prominent header switcher with quieter contextual version links in each homepage and demo hero. The routes, one-action generation change, and version-local Home behavior remain unchanged.

Publish a maintained CodeMirror 5 homepage and real demo alongside the default CodeMirror 6 site, with a clear version switcher between them.

GitHub Pages supports a maximum of one project site per repository, and a branch-based publishing source selects only one branch/folder. Therefore, main and v1 cannot each expose independent Pages roots from this repository at the same time. The supported solution is one custom GitHub Actions deployment that assembles both versioned sites into a single static artifact.

Official references:

This work is deliberately separate from #49. Issue #49 remains the runtime, wire-compatibility, and v2 release gate; this issue owns the multi-version documentation and demo deployment.

Decision

Keep one Pages site and preserve all current CM6 URLs:

Public route Content Source
/ CodeMirror 6 / package v2 homepage exact deployed main commit
/demo/ real CodeMirror 6 demo exact deployed main commit
/migration/ CM5 → CM6 migration guide exact deployed main commit
/v1/ CodeMirror 5 / package v1 homepage pinned full commit SHA from v1
/v1/demo/ real CodeMirror 5 demo the same pinned v1 commit

The root site remains canonical for CM6. We should not move it to /v2/, because that would break the existing homepage, demo, migration, and inbound links. Lightweight /v2/ and /v2/demo/ redirects may be added later for symmetry, but must canonicalize to the existing root URLs.

Goals

  • Let a CM5 user reach version-correct installation guidance and a working CM5 demo without reading CM6 instructions.
  • Let users switch between the CM5 and CM6 homepages or corresponding demos in one action.
  • Keep the v1 website source maintained on the v1 branch while retaining main as the only production deployment authority.
  • Make every deployment reproducible from two exact source commits and safe to roll back.
  • Preserve the exact public author credit: Haoran Yu & Jisuanke Team.

Non-goals

  • A second custom domain or an independent Pages site for the same repository.
  • A new gh-pages branch; the permanent repository branches remain main and v1.
  • Combining CodeMirror 5 and CodeMirror 6 in one demo runtime.
  • Changing the recording format or converting stored recordings.
  • Making v1 deploy directly from a floating branch head.
  • Publishing npm packages; registry release work remains in Add a transaction-native CodeMirror 6 recorder and player #49.

User stories

  • As an existing CM5 user, I can open a maintained CM5 homepage, copy a v1-safe install command, and run a genuine CM5 record/replay demo.
  • As a prospective user, I can compare the supported editor generations and switch to the right homepage or demo without going through GitHub.
  • As a migrating user, I can move from the CM5 site to the CM6 site and migration guide while keeping stored recordings unchanged.
  • As a maintainer, I can identify the exact main and v1 commits behind the live site and reproduce or roll back the artifact.

P0 requirements

Version navigation

  • Add a visible, keyboard-operable CM5/CM6 switcher to both homepages and both demo headers.
  • The homepage switcher maps CM6 / ↔ CM5 /v1/.
  • The demo switcher maps CM6 /demo/ ↔ CM5 /v1/demo/.
  • Each demo has a visible Home link that stays within its editor generation.
  • Expose the active choice with aria-current; version identity must not rely on color alone.
  • Keep a direct migration link from the CM5 experience to /migration/.

Correct the v1 site before publishing it

The current v1 static site is complete enough to reuse, but it must be corrected in the v1 source itself rather than rewritten during deployment:

  • self-canonicalize and set Open Graph URLs to /v1/ and /v1/demo/;
  • replace stale v1.1.6 labels/cache keys with maintained v1 metadata;
  • replace bare npm install codemirror-record with codemirror-record@^1 codemirror@^5 and show codemirror-record@cm5 as the explicit maintenance selector;
  • point source/API links to the v1 branch, not default main;
  • add the CM6 homepage and migration links;
  • add the exact meta/footer author credit Haoran Yu & Jisuanke Team;
  • add the missing Home link to the CM5 demo;
  • retain a real CM5 runtime and the committed v1 bundle.

Deterministic Pages assembly

  • Replace the current legacy main:/ Pages source with a custom Actions workflow.
  • Keep the workflow and assembler owned by main.
  • Store a full pinned v1 commit SHA in a main-tracked source manifest. The assembler must fail unless that commit is reachable from origin/v1 and its package major is 1.
  • Check out the exact triggering main commit and the exact pinned v1 commit.
  • Treat the v1 checkout as static input: never execute scripts from it in the deployment job.
  • Copy an explicit allowlist rather than either whole repository. At minimum, v1 may contribute index.html, homepage.css, and the required demo/ HTML/CSS/JS/license assets.
  • Keep custom-domain ownership at the Pages repository setting. Do not copy v1's CNAME or any second root metadata.
  • Publish a provenance file or deployment summary containing both exact source SHAs.
  • Reject symlinks/hardlinks, missing required assets, unexpected copied files, duplicate root ownership, and path/case mismatches.
  • Give the deploy job only contents: read, pages: write, and id-token: write; keep the github-pages environment restricted to main.
  • Serialize production deployments with a Pages concurrency group.
  • Pull requests may build and upload a review artifact but must never deploy. Only a merged main commit or an authorized manual run from main may deploy.

Release-accurate copy

The live site must not claim that v2 is installable from latest or cm6 until #49 has verified those npm tags and codemirror-record@2.0.0. If this issue deploys first, use accurate release-candidate wording and update it after the registry gate. CM5 instructions must always remain explicitly on ^1 or cm5.

P1 requirements

  • Add self-canonicalized /v2/ and /v2/demo/ redirects for symmetric bookmarks.
  • Add versioned entries to a sitemap.
  • Add a small, human-readable “source commits” link or deployment summary.
  • Share the version-switcher styling without coupling the two editor runtimes.

Acceptance criteria

  • /, /demo/, /migration/, /v1/, and /v1/demo/ return 200 on the custom domain; every referenced local CSS/JS asset returns 200.
  • Existing CM6 URLs and anchors remain valid.
  • Both homepages and both demos have correct bidirectional contextual version guidance (the prominent header switcher was superseded by Move version guidance out of the site headers #62) and version-local Home behavior.
  • The CM5 and CM6 demos each complete a browser smoke path: edit → serialize → load → play, with the expected final document and no page, console, or network errors.
  • Static checks cover version-specific install commands, npm/branch links, titles, descriptions, canonical/Open Graph URLs, version markers, and the exact author credit.
  • Accessibility checks cover keyboard navigation, visible focus, landmarks, labels/status output, and reasonable narrow-screen behavior.
  • Artifact tests prove the allowlist, exactly one site root/custom-domain policy, no links or copied files outside the approved set, and provenance for both source SHAs.
  • The pinned v1 SHA is a full commit reachable from v1; changing it requires a reviewed main pull request.
  • A pull request cannot deploy, and a production deploy cannot start until existing main CI has passed.
  • A post-deploy check validates all five live routes, both real demos, canonical URLs, version links, and both source SHAs.
  • A rollback procedure is documented and exercised: redeploy the previous known-good artifact or restore legacy main:/ Pages without changing DNS.

Delivery sequence

  1. Merge an issue-numbered PR into v1 that corrects and links its homepage/demo and adds v1-side content tests.
  2. Merge an issue-numbered PR into main that adds the switcher, pinned-source manifest, allowlisted assembler, artifact tests, browser checks, and Pages workflow.
  3. Pin the reviewed v1 merge commit in the main PR.
  4. Change Pages from legacy branch publishing to GitHub Actions while preserving codemirror-record.haoranyu.com.
  5. Deploy, run the live smoke gate, and record both source SHAs on this issue.
  6. Close only after the acceptance checklist is complete.

Success measures

  • All five canonical routes and their local assets pass automated and live link checks.
  • Both real demos pass the same record/replay smoke contract.
  • A user can change editor generation from any homepage or demo with one direct navigation.
  • Every production deployment identifies two immutable source SHAs and can be rolled back without branch-history changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: documentationDocumentation and maintainer runbooksarea: websiteHomepage, demos, migration pages, and GitHub Pagespriority: P1High-impact work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions