@getgauge/cli
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -32,5 +32,5 @@ { | ||
"dependencies": { | ||
"unzipper": "^0.9.3" | ||
"adm-zip": "^0.5.10" | ||
}, | ||
"version": "1.5.0" | ||
"version": "1.5.1" | ||
} |
@@ -7,3 +7,3 @@ #!/usr/bin/env node | ||
path = require("path"), | ||
unzip = require('unzipper'), | ||
AdmZip = require('adm-zip'), | ||
https = require('https'), | ||
@@ -13,10 +13,26 @@ packageJsonPath = path.join(__dirname, "..", "package.json"), | ||
var extractZipArchive = function(buffer) { | ||
return new Promise(function(resolve, reject) { | ||
try { | ||
const zip = new AdmZip(buffer); | ||
zip.extractAllTo(path.normalize(binPath), true, true); | ||
resolve(); | ||
} catch (err) { | ||
reject(new Error(`Failed to extract archive from buffer: ${err.message}`)); | ||
} | ||
}) | ||
} | ||
var downloadFollowingRedirect = function(url, resolve, reject) { | ||
https.get(url, { headers: { 'accept-encoding': 'gzip,deflate' } }, res => { | ||
if (res.statusCode >= 300 && res.statusCode < 400) { | ||
downloadFollowingRedirect(res.headers.location, reject, resolve); | ||
} else if (res.statusCode > 400) { | ||
console.error(`Unable to download '${url}' : ${res.statusCode}-'${res.statusMessage}'`); | ||
downloadFollowingRedirect(res.headers.location, resolve, reject); | ||
} else if (res.statusCode >= 400) { | ||
reject(new Error(`Unable to download '${url}' : ${res.statusCode}-'${res.statusMessage}'`)); | ||
} else { | ||
res.pipe(unzip.Extract({ path: path.normalize(binPath) })).on('error', reject).on('end', resolve); | ||
const chunks = []; | ||
res | ||
.on('data', chunk => chunks.push(chunk)) | ||
.on('end', () => resolve(Buffer.concat(chunks))) | ||
.on('error', reject); | ||
} | ||
@@ -37,2 +53,3 @@ }); | ||
}) | ||
.then(extractZipArchive) | ||
}; | ||
@@ -39,0 +56,0 @@ |
@@ -28,3 +28,8 @@ #!/usr/bin/env node | ||
} | ||
resolve(JSON.parse(data).version); | ||
const pkg = JSON.parse(data); | ||
if (pkg.version) { | ||
resolve(pkg.version); | ||
} else { | ||
reject(new Error("Unable to find version in package.json.")); | ||
} | ||
}) | ||
@@ -31,0 +36,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5322
113
+ Addedadm-zip@^0.5.10
+ Addedadm-zip@0.5.16(transitive)
- Removedunzipper@^0.9.3
- Removedbalanced-match@1.0.2(transitive)
- Removedbig-integer@1.6.52(transitive)
- Removedbinary@0.3.0(transitive)
- Removedbluebird@3.4.7(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbuffer-indexof-polyfill@1.0.2(transitive)
- Removedbuffers@0.1.1(transitive)
- Removedchainsaw@0.1.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedduplexer2@0.1.4(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfstream@1.0.12(transitive)
- Removedglob@7.2.3(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedlistenercount@1.0.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedtraverse@0.3.9(transitive)
- Removedunzipper@0.9.15(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwrappy@1.0.2(transitive)