webpack-cleanup-plugin
webpack-cleanup-plugin copied to clipboard
Add `keepReleases` option
This PR implements the keepReleases options similarly to keep_releases in capistrano
Please let me know if you think this should be merged and I'll add some documentation. Thanks!
Hi @stream7, thanks for this PR! Sorry for the late answer – but as I'm not familiar with capistrano's keep_releases, would you mind to explain better what a keepReleases option should do? So I can review your PR 😄
Hey @gpbl, it tracks the files of the last n (keep_releases) releases and keeps them in the filesystem so that for example users of a SPA that are on an old version (haven't refreshed the page and thus haven't received the latest version) don't get 404s when a new version is deployed.
Does that make sense to you?
Yes now I understand the principle, thanks 👍 Actually, this was something I'd liked to implement from the begin.
I'd like to discuss better the implementation with your help:
- read the last
nwebpack stats (actually, itsassetsobject) from a releases subdirectory and add the assets path contained in it to theexcludeoption - save the current stats in a JSON timestamp file in the releases subdirectory
- the releases subdirectory should be excluded as default
- (should the "older" stats in the releases subdir removed as well?)
Would be this correct? I've cleaned up a bit the code and added a test suite so we can work better on this feature.
That is 100% correct, thanks! 👍
(should the "older" stats in the releases subdir removed as well?)
I believe that's the case already in my implementation. See here
What's the status of this feature? We're migrating from using the Rails asset pipeline to Webpack and I'd love to use this in our config. Is it something that could use some help?
@davegonzalez @stream7 could fix the conflicts and add tests! then I can merge this 👍
Also after this feature! :) Would be happy to look into the conflicts and create another PR if this is not showing signs of progression
@cbarratt please do 👍🏽🙏🏽