Skip to content

Commit

Permalink
chore(deps): update extract-zip to version 2 (#5610)
Browse files Browse the repository at this point in the history
extract-zip removed support for callbacks and instead uses promises. Moreover, it has TypeScript support which allows us to remove the @types/extract-zip package.

This update allows downstream users to remove their installation of mkdirp, which uses a vulnerable version of minimist.

For more info, see https://github.com/maxogden/extract-zip/releases/tag/v2.0.0

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
  • Loading branch information
TimvdLippe and mathiasbynens committed Apr 9, 2020
1 parent 0bcc5a7 commit 1ce4fe7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
13 changes: 6 additions & 7 deletions experimental/puppeteer-firefox/lib/BrowserFetcher.js
Expand Up @@ -289,13 +289,12 @@ function downloadFile(url, destinationPath, progressCallback) {
* @param {string} folderPath
* @return {!Promise<?Error>}
*/
function extractZip(zipPath, folderPath) {
return new Promise((fulfill, reject) => extract(zipPath, {dir: folderPath}, err => {
if (err)
reject(err);
else
fulfill();
}));
async function extractZip(zipPath, folderPath) {
try {
await extract(zipPath, {dir: folderPath});
} catch (error) {
return error;
}
}

function httpRequest(url, method, response) {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"@types/mime-types": "^2.1.0",
"debug": "^4.1.0",
"extract-zip": "^1.6.6",
"extract-zip": "^2.0.0",
"https-proxy-agent": "^4.0.0",
"mime": "^2.0.3",
"mime-types": "^2.1.25",
Expand All @@ -48,7 +48,6 @@
},
"devDependencies": {
"@types/debug": "0.0.31",
"@types/extract-zip": "^1.6.2",
"@types/mime": "^2.0.0",
"@types/node": "^10.17.14",
"@types/rimraf": "^2.0.2",
Expand Down
13 changes: 6 additions & 7 deletions src/BrowserFetcher.js
Expand Up @@ -334,13 +334,12 @@ function install(archivePath, folderPath) {
* @param {string} folderPath
* @return {!Promise<?Error>}
*/
function extractZip(zipPath, folderPath) {
return new Promise((fulfill, reject) => extract(zipPath, {dir: folderPath}, err => {
if (err)
reject(err);
else
fulfill();
}));
async function extractZip(zipPath, folderPath) {
try {
await extract(zipPath, {dir: folderPath});
} catch (error) {
return error;
}
}

/**
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Expand Up @@ -3,7 +3,8 @@
"allowJs": true,
"checkJs": true,
"outDir": "./lib",
"target": "ESNext"
"target": "ESNext",
"moduleResolution": "node"
},
"include": [
"src"
Expand Down

0 comments on commit 1ce4fe7

Please sign in to comment.