Replaced adm-zip with node-archiver

This commit is contained in:
Sarhan Aissi
2019-05-13 03:55:05 +01:00
parent ffef7ffc57
commit ad94f9ef08
3 changed files with 14 additions and 7 deletions
+1 -1
View File
@@ -79,7 +79,7 @@
"@babel/preset-react": "^7.0.0",
"@reach/menu-button": "^0.1.17",
"@reach/tooltip": "^0.2.0",
"adm-zip": "^0.4.7",
"archiver": "^3.0.0",
"babel-core": "^7.0.0-bridge",
"babel-eslint": "^9.0.0",
"babel-jest": "^24.7.1",
+12 -5
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env node
const AdmZip = require('adm-zip');
const archiver = require('archiver');
const { execSync } = require('child_process');
const { readFileSync, writeFileSync } = require('fs');
const { readFileSync, writeFileSync, createWriteStream } = require('fs');
const { copy, ensureDir, move, remove } = require('fs-extra');
const { join } = require('path');
const { getGitCommit } = require('../../utils');
@@ -70,9 +70,16 @@ const build = async (tempPath, manifestPath, manifestVersion) => {
writeFileSync(copiedManifestPath, JSON.stringify(manifest, null, 2));
// Pack the extension
const zip = new AdmZip();
zip.addLocalFolder(zipPath);
zip.writeZip(join(tempPath, 'packed.zip'));
const archive = archiver('zip', { zlib: { level: 9 } });
const zipStream = createWriteStream(join(tempPath, 'packed.zip'));
await new Promise((resolve, reject) => {
archive
.directory(zipPath, false)
.on('error', err => reject(err))
.pipe(zipStream);
archive.finalize();
zipStream.on('close', () => resolve());
});
};
const postProcess = async (tempPath, destinationPath) => {
+1 -1
View File
@@ -1474,7 +1474,7 @@ addons-linter@1.6.1:
optionalDependencies:
fsevents "2.0.1"
adm-zip@^0.4.7, adm-zip@~0.4.x:
adm-zip@~0.4.x:
version "0.4.13"
resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.13.tgz#597e2f8cc3672151e1307d3e95cddbc75672314a"
integrity sha512-fERNJX8sOXfel6qCBCMPvZLzENBEhZTzKqg6vrOW5pvoEaQuJhRU4ndTAh6lHOxn1I6jnz2NHra56ZODM751uw==