chore(deps): update extract-zip to version 2 (#5610)

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>
This commit is contained in:
Tim van der Lippe 2020-04-09 20:13:25 +01:00 committed by GitHub
parent 0bcc5a7ad8
commit 1ce4fe7169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 17 deletions

View File

@ -289,13 +289,12 @@ function downloadFile(url, destinationPath, progressCallback) {
* @param {string} folderPath * @param {string} folderPath
* @return {!Promise<?Error>} * @return {!Promise<?Error>}
*/ */
function extractZip(zipPath, folderPath) { async function extractZip(zipPath, folderPath) {
return new Promise((fulfill, reject) => extract(zipPath, {dir: folderPath}, err => { try {
if (err) await extract(zipPath, {dir: folderPath});
reject(err); } catch (error) {
else return error;
fulfill(); }
}));
} }
function httpRequest(url, method, response) { function httpRequest(url, method, response) {

View File

@ -35,7 +35,7 @@
"dependencies": { "dependencies": {
"@types/mime-types": "^2.1.0", "@types/mime-types": "^2.1.0",
"debug": "^4.1.0", "debug": "^4.1.0",
"extract-zip": "^1.6.6", "extract-zip": "^2.0.0",
"https-proxy-agent": "^4.0.0", "https-proxy-agent": "^4.0.0",
"mime": "^2.0.3", "mime": "^2.0.3",
"mime-types": "^2.1.25", "mime-types": "^2.1.25",
@ -48,7 +48,6 @@
}, },
"devDependencies": { "devDependencies": {
"@types/debug": "0.0.31", "@types/debug": "0.0.31",
"@types/extract-zip": "^1.6.2",
"@types/mime": "^2.0.0", "@types/mime": "^2.0.0",
"@types/node": "^10.17.14", "@types/node": "^10.17.14",
"@types/rimraf": "^2.0.2", "@types/rimraf": "^2.0.2",

View File

@ -334,13 +334,12 @@ function install(archivePath, folderPath) {
* @param {string} folderPath * @param {string} folderPath
* @return {!Promise<?Error>} * @return {!Promise<?Error>}
*/ */
function extractZip(zipPath, folderPath) { async function extractZip(zipPath, folderPath) {
return new Promise((fulfill, reject) => extract(zipPath, {dir: folderPath}, err => { try {
if (err) await extract(zipPath, {dir: folderPath});
reject(err); } catch (error) {
else return error;
fulfill(); }
}));
} }
/** /**

View File

@ -3,7 +3,8 @@
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,
"outDir": "./lib", "outDir": "./lib",
"target": "ESNext" "target": "ESNext",
"moduleResolution": "node"
}, },
"include": [ "include": [
"src" "src"