Skip to content

feat(vite-config): fan the dev server hot file out to every theme - #149

Merged
YvetteNikolov merged 2 commits into
mainfrom
feat/vite-hot-file-fanout
Oct 9, 2026
Merged

YvetteNikolov merged 2 commits into
mainfrom
feat/vite-hot-file-fanout

Conversation

@YvetteNikolov

Copy link
Copy Markdown
Contributor

Split from #144.

Dev runs a single Vite server hosted by the default theme, so laravel-vite-plugin writes exactly one hot file. Any other parent theme has no public/hot, and get_parent_theme_file_path('public/hot') on the PHP side comes up empty — which is why standalone themes hardcoded the path to sage's hot file.

  • write-theme-hot-files Vite plugin: copies the hot file into every theme's public/ on server start, removes the copies on shutdown, ignores them in the watcher.
  • yard-toolkit clean: removes leftover hot files after a hard kill.
  • vitest project for vite-config with plugin tests.

Independent of the project layout resolver (#144's main change); only uses themes[].dir, which the current context already exposes.

A single dev server means laravel-vite-plugin writes one hot file, into the
public directory of the theme hosting it. Standalone parent themes had no
public/hot of their own and ended up hardcoding the path to sage's.

The plugin copies the hot file into every theme's public directory on server
start and removes the copies on shutdown. A hard kill leaves them behind, so
the toolkit gains a clean command that removes leftovers.
Copilot AI balanced review requested due to automatic review settings October 9, 2026 06:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation is focused and tested; only a minor README help-list inconsistency remains.

1 open finding
What changed in this PR

Adds Vite hot-file fan-out so every discovered theme can resolve the shared development server.

Changes:

  • Adds hot-file copying, watcher exclusion, shutdown cleanup, and tests.
  • Adds yard-toolkit clean for stale hot files.
  • Documents multi-theme hot-file behavior.
File Description
vitest.config.mjs Registers Vite config tests.
packages/​vite-config/​vitest.config.mjs Configures Vite package tests.
packages/​vite-config/​tests/​write-theme-hot-files.test.js Tests fan-out and plugin configuration.
packages/​vite-config/​src/​plugins/​write-theme-hot-files.js Implements hot-file fan-out and cleanup.
packages/​vite-config/​src/​configs/​brave.js Integrates the new plugin.
packages/​vite-config/​README.md Documents multi-theme hot files.
packages/​toolkit/​src/​config/​help.js Adds the clean action to CLI help.
packages/​toolkit/​src/​config/​actions.js Registers the clean action.
packages/​toolkit/​src/​actions/​clean.js Removes stale theme hot files.
packages/​toolkit/​README.md Documents clean command usage.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +54 to +57
```bash
# Removes leftover Vite hot files after a dev server was killed hard.
yard-toolkit clean
```
@YvetteNikolov
YvetteNikolov merged commit d26fe94 into main Oct 9, 2026
3 checks passed
@YvetteNikolov
YvetteNikolov deleted the feat/vite-hot-file-fanout branch October 9, 2026 07:03
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