-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[10.x] Add --clean
option to vendor:publish
command
#49329
[10.x] Add --clean
option to vendor:publish
command
#49329
Conversation
I'm wondering if we need to consider how this ties in with laravel/vite-plugin#251 to give a holistic framework approach - or at least a consistent naming convention. |
I love this idea. My concern is that the implementation will lead to issues during deployments. Imagine you have a package that has published You update the underlying package and it now has a new file it wants to publish, which will be named The following happens...
I would love if we could solve this issue. Making the switch over more atomic is not the solution, as depending on network speeds, it could be a few seconds before the request for the old asset is made. I could imagine a world where, when publishing assets, we create a Then we can offer a This is something that laravel/vite-plugin#251 has considered and is built for. |
But that means you still will have the old files in your git repository and you have to remember to run that command locally after the deployment process so you can remove the old files from the git repo? (btw, it was awesome meeting you at LaraconAU 😄) |
@gdebrauwer it was awesome getting to hang with you! I'm think more when you wouldn't have these committed to your git repository and instead publish them as part of your deployment process. Will circle back to this shortly and see if I can come up with something. |
@timacdonald
|
I agree this is a good command! We could use it in Forge. Just wanna make sure it supports my concerns outlined. I plan to come back and get this going (unless someone else addresses the issues first) |
Please send this to 11.x instead, thanks. |
Fixes #48964.
I have a package that uses Vite to build assets. When the package is installed in a project, you run the
vendor:publish
command to publish those assets. You might end up with the following assets in your public folder:When the package's assets change, you have to run the
vendor:publish
command again to get the new assets in your project. When you do that, you get the following result:Because the asset filenames change, the existing old files are not deleted and the new files are just added to the existing directory. This is a problem, as the old files will start to accumulate in that folder.
This PR fixes that by introducing a
--clean
option to thevendor:publish
command. When you use that command option, any existing files in a published directory will be deleted. That way, you end up with the correct and new files in your project: