mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Build/grunt: Switch to adm-zip. Use addFile method until addLocalFile is implemented.
This commit is contained in:
parent
15eb3ac8f1
commit
98fc87a5d7
28
grunt.js
28
grunt.js
@ -75,29 +75,15 @@ task.registerBasicTask('zip', 'Create a zip file for release', function(data) {
|
|||||||
var files = file.expand(data.src);
|
var files = file.expand(data.src);
|
||||||
log.writeln("Creating zip file " + data.dest);
|
log.writeln("Creating zip file " + data.dest);
|
||||||
|
|
||||||
var done = this.async();
|
|
||||||
|
|
||||||
var zipstream = require('zipstream');
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
var AdmZip = require('adm-zip');
|
||||||
var out = fs.createWriteStream(data.dest);
|
var zip = new AdmZip();
|
||||||
var zip = zipstream.createZip({ level: 1 });
|
files.forEach(function(file) {
|
||||||
|
|
||||||
zip.pipe(out);
|
|
||||||
|
|
||||||
function addFile() {
|
|
||||||
if (!files.length) {
|
|
||||||
zip.finalize(function(written) {
|
|
||||||
log.writeln(written + ' total bytes written');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var file = files.shift();
|
|
||||||
log.verbose.writeln('Zipping ' + file);
|
log.verbose.writeln('Zipping ' + file);
|
||||||
zip.addFile(fs.createReadStream(file), { name: file }, addFile);
|
zip.addFile(file, fs.readFileSync(file));
|
||||||
}
|
});
|
||||||
addFile();
|
zip.writeZip(data.dest);
|
||||||
|
log.writeln("Wrote " + files.length + " files to " + data.dest);
|
||||||
});
|
});
|
||||||
|
|
||||||
task.registerTask('default', 'lint qunit');
|
task.registerTask('default', 'lint qunit');
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "0.2.x",
|
"grunt": "0.2.x",
|
||||||
"zipstream": "0.2.x"
|
"adm-zip": "0.1.x"
|
||||||
},
|
},
|
||||||
"keywords": []
|
"keywords": []
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user