webpack-cleanup-plugin icon indicating copy to clipboard operation
webpack-cleanup-plugin copied to clipboard

Add `keepReleases` option

Open stream7 opened this issue 9 years ago • 8 comments

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!

stream7 avatar Jul 19 '16 13:07 stream7

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 😄

gpbl avatar Sep 18 '16 14:09 gpbl

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?

stream7 avatar Sep 18 '16 14:09 stream7

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 n webpack stats (actually, its assets object) from a releases subdirectory and add the assets path contained in it to the exclude option
  • 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.

gpbl avatar Sep 18 '16 15:09 gpbl

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

stream7 avatar Sep 18 '16 15:09 stream7

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 avatar Jan 04 '17 22:01 davegonzalez

@davegonzalez @stream7 could fix the conflicts and add tests! then I can merge this 👍

gpbl avatar Feb 12 '17 14:02 gpbl

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 avatar Mar 24 '17 09:03 cbarratt

@cbarratt please do 👍🏽🙏🏽

gpbl avatar Mar 24 '17 15:03 gpbl