twolfson / grunt-zip

Zip and unzip files via a grunt plugin
MIT License
87 stars 19 forks source link

Zips becoming bigger #50

Closed AliOsseili closed 6 years ago

AliOsseili commented 6 years ago

When I zip my build, it works out fine the first time, everything is all good. But when I zip the second time the size appears to get bigger (goes from a 378 mb zip to an 1.08 gb zip) My theory is it zips the zip folder again adding to the size but when I open the 1.08 GB zip, the 378mb zip doesn't exist...

here is what the task looks like: 'zip': { 'long-format': { cwd:'./build/enhancedFeedLeft'+'-'+os_platform+'-'+arch_model+'/', src: ['*/**'], dest: 'BuildZip/enhancedFeedLeft'+'-'+os_platform+'-'+arch_model+'-'+TimeNow+'.zip' } } this works fine but if I do it twice without deleting the original zip, its gets bigger

twolfson commented 6 years ago

This is the same issue as https://github.com/twolfson/grunt-zip/issues/48

The issue is we built cwd in a counter-intuitive manner where it must be re-specified in src as well. It mostly acts as a router for inside the bundle itself. The following should work:

        'zip': {
            'long-format': {
                cwd:'./build/enhancedFeedLeft'+'-'+os_platform+'-'+arch_model+'/',
                src: ['./build/enhancedFeedLeft'+'-'+os_platform+'-'+arch_model+'/*/**'],
                dest: 'BuildZip/enhancedFeedLeft'+'-'+os_platform+'-'+arch_model+'-'+TimeNow+'.zip'
            }
        }
AliOsseili commented 6 years ago

ah thanks I was just reading that issue rn and felt like a big doof lol

AliOsseili commented 6 years ago

When I tried this leaving the original zip inside, It changed to 1.5 GB now, any ideas why?

twolfson commented 6 years ago

I don't think I follow your last question

AliOsseili commented 6 years ago

So I tried running the task again, with leaving the right sized zip folder of 378 MB where it is, and the output of running the zip task gave me a 1.5gb zip

twolfson commented 6 years ago

Hmm, I'm not sure. Try removing the .zip file and re-running the task?

We also support --verbose to debug what files are being written to the .zip:

grunt --verbose zip