Skip to content

Cache workspace typechecks with Vite+ - #2

Draft
wan9chi wants to merge 7 commits into
mainfrom
agent/vite-plus-typecheck-cache
Draft

Cache workspace typechecks with Vite+#2
wan9chi wants to merge 7 commits into
mainfrom
agent/vite-plus-typecheck-cache

Conversation

@wan9chi

@wan9chi wan9chi commented Jul 13, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

Adds Vite+ as a workspace development dependency and uses its task runner to cache package, demo, and template typechecks. Astro checks are split into astro sync and astro check --noSync so the generated project state is tracked separately from the check.

The package typecheck runner uses parallel scheduling to tolerate the repository's existing emdash / @emdash-cms/auth-atproto workspace cycle. For this fork-only PR, non-typecheck jobs in the CI workflow are skipped outside emdash-cms/emdash, leaving Typecheck as the only active CI job.

The Typecheck job follows the official Vite+ GitHub Actions cache guide: after the existing pnpm install, it restores node_modules/.vite/task-cache with a per-run key and OS/architecture restore prefix, then saves the updated cache after a successful run. The repository's existing pnpm and Node setup remains unchanged; voidzero-dev/setup-vp is not used.

Cross-run cache validation

Experiment Commit Run GitHub cache Vite Task result
Generate baseline cache d1fd84aa 29229148136 No matching cache; saved vite-task-Linux-X64-29229148136-1 Packages 0/27, demos 0/4, templates 0/18 hits
Change a related typechecked source file a07f1ee4 29229372659 Restored baseline; saved updated cache plugin-types and dependents missed; packages 10/27, demos 0/4, templates 0/18 hits
Revert the related source change 2599313a 29229587787 Restored previous run; saved updated cache Reverted source and dependents still missed; packages 10/27, demos 0/4, templates 0/18 hits
Change only a workflow comment d5544aeb 29229809658 Restored previous run; saved updated cache Partial hit: packages 18/27 with 32.46s saved; demos 0/4, templates 0/18 hits

The GitHub cache layer works: every run after the baseline restores the newest cache for the pull request and saves a new immutable entry. Vite Task correctly invalidates related inputs and reuses some unchanged package tasks. Cross-run reuse is not yet stable for every task: the uncached pnpm build changes or removes hashed dist files consumed by typechecks, while Astro tasks track generated node_modules/.vite paths that are absent on fresh runners. This matches the guide's warning that cross-run Vite Task caching is experimental and should be measured per project.

Closes: N/A — fork-only CI experiment.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...

pnpm format was not run across the whole repository; targeted Prettier checks pass for every changed JSON/YAML file. Tests, i18n, changeset, and Discussion requirements are not applicable because this is fork-only CI/tooling work affecting private workspace packages. The targeted package, demo, and template typechecks all pass.

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: GPT-5 Codex

Screenshots / test output

  • pnpm install --frozen-lockfile
  • pnpm typecheck — passes; immediate local warm run has 27/27 cache hits
  • pnpm typecheck:demos:ci — passes; immediate local warm run has 4/4 cache hits
  • pnpm typecheck:templates — passes; immediate local warm run has 18/18 cache hits
  • Four successful GitHub Actions cache experiments linked above
  • pnpm lint
  • pnpm lint:quick
  • Targeted prettier --check
  • git diff --check

@github-actions

Copy link
Copy Markdown

Scope check

This PR changes 1,127 lines across 24 files. Large PRs are harder to review and more likely to be closed without review.

If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs.

See CONTRIBUTING.md for contribution guidelines.

@github-actions

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant