nksaraf / vinxi

The Full Stack JavaScript SDK
https://vinxi.vercel.app
MIT License
2.22k stars 80 forks source link

idea: a `clean` subcommand to clear vinxi's build cache #361

Open trusktr opened 3 months ago

trusktr commented 3 months ago

There's no command to clear vinxi's build cache.

For now, I run this in my Solid Start app:

rm -rf .output node_modules/.vinxi .vinxi

This is useful because sometimes one might apply a patch to node_modules (for example, with patch-package) and if vinxi already cached the node_modules build, the changes will not show up in the app.

The current workaround (rm -rf .output node_modules/.vinxi .vinxi) is a little cumbersome because I have to quite and restartvinxi dev` every time.

clean subcommand

Usage of a new clean subcommand would be:

vinxi clean

--clean option for other commands

Vinxi could also benefit from a --clean option that when used would first clear the cache, then build or run without the cache. For example:

vinxi dev --clean
vinxi start --clean
vinxi build --clean

I'm not sure if all of those sub commands use the cache, the --clean option would be for any subcommands that do rely on the cache.

In the case of vinxi dev --clean, it would also be convenient for the app to auto-restart on changes to node_modules files that were used in the app (because they are no longer being cached), the same as with changes to local app files.

Additionally, if the server does any sort of HTTP caching, it would be nice for that to also be skipped while the --clean option is enabled.