diff --git a/package.json b/package.json index 9f3ba27b2e..03d44c3931 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/shells/browser/shared/build.js b/shells/browser/shared/build.js index fb1037f7a8..fcfc757ac0 100644 --- a/shells/browser/shared/build.js +++ b/shells/browser/shared/build.js @@ -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) => { diff --git a/yarn.lock b/yarn.lock index 040e1782d5..8e3eccc5fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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==