This module provides a gitzip
command that creates zip file ignoring files from .gitignore
file.
If the source folder doesn't contain .gitignore
then all files will be zipped.
💡 Useful to share the current changes while working on git repository. It complements the git archive where you don't need to commit or stash the changes to create untracked changed file.
npm install -g gitzip
go to the folder you want to zip and run
gitzip
This will generate submission.zip
npm install --save-dev gitzip
package.json:
{
//...
"scripts": {
"build" "...",
"zip": "gitzip -d bundle.zip -s build/*",
"upload": "....",
"deploy": "npm run build && npm run zip && npm run upload"
}
}
var zip = require('gitzip');
zip({
source: 'build/*',
destination: './destination.zip',
exclude: ['destination.zip'],
include: ['.git']
}).then(function() {
console.log('all done!');
}).catch(function(err) {
console.error(err.stack);
process.exit(1);
});
* Type: `string`
* Default: `.` current directory
Path to files and folders to include in the zip file. String or Array of Strings. Defaults to current path.
* Type: `string`
* Default: `submission.zip` at current directory
Path to generated .zip file. Defaults to submission.zip in current path.
* Type: `string[]`
Array of strings of file pattern to exclude from zip
* Type: `string[]`
Array of strings of file pattern to include in zip.
Note, include has more precedence than exclude
Node 8 or greater
This software is released under the terms of the MIT license.