I'm using grunt-contrib-compress to zip up my deployment package. I have the following config:
// Zip up the distribution folder and give it a build name. The folder can then be uploaded to the Chrome Web Store.
grunt.registerTask('compress-extension', 'compress the files which are ready to be uploaded to the Chrome Web Store into a .zip', function () {
// There's no need to cleanup any old version because this will overwrite if it exists.
grunt.config.set('compress', {
dist: {
options: {
archive: 'Streamus v' + grunt.option('version') + '.zip'
},
files: [{
src: ['dist/**'],
dest: '',
}]
}
});
grunt.task.run('compress');
});
This results in one additional level of directory structure which I would like to avoid. After zipping, the structure looks like:
'Streamus v0.xxx.zip' -> 'dist' -> '[sub directories]'
and I'm hoping for just:
'Streamus v0.xxx.zip' -> '[sub directories]'
What's the simplest way to go about doing this? Can I just express that desire in the "files" configuration section of compress? Maybe with a flatten?
Oh, I see. If you set "cwd" to the folder you want to exclude and then your "src" to take into account your new cwd, it works as desired: