@cascode/cascode-cli 0.1.0-rc2 → 0.1.0-rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cascode/cascode-cli",
3
- "version": "0.1.0-rc2",
3
+ "version": "0.1.0-rc3",
4
4
  "description": "Cascode CLI installer wrapper. Installs a prebuilt cascode binary for your platform.",
5
5
  "homepage": "https://github.com/daniellovell/cascode",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "tar": "^6.2.1",
39
- "unzipper": "^0.10.14"
39
+ "extract-zip": "^2.0.1"
40
40
  },
41
41
  "files": [
42
42
  "bin/",
@@ -2,11 +2,12 @@
2
2
 
3
3
  const fs = require("fs");
4
4
  const path = require("path");
5
+ const os = require("os");
5
6
  const https = require("https");
6
- const { pipeline } = require("stream");
7
+ const { pipeline } = require("stream/promises");
7
8
  const zlib = require("zlib");
8
9
  const tar = require("tar");
9
- const unzipper = require("unzipper");
10
+ const extractZip = require("extract-zip");
10
11
 
11
12
  function rid() {
12
13
  const p = process.platform;
@@ -62,11 +63,15 @@ async function main() {
62
63
 
63
64
  console.log(`cascode: downloading ${asset} ...`);
64
65
  try {
65
- const res = await dl(url);
66
66
  if (isWin) {
67
- await pipeline(res, unzipper.Extract({ path: destDir }), (e) => (e ? Promise.reject(e) : Promise.resolve()));
67
+ const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "cascode-"));
68
+ const zipPath = path.join(tmpDir, asset);
69
+ const res = await dl(url);
70
+ await pipeline(res, fs.createWriteStream(zipPath));
71
+ await extractZip(zipPath, { dir: destDir });
68
72
  } else {
69
- await pipeline(res, zlib.createGunzip(), tar.x({ cwd: destDir }), (e) => (e ? Promise.reject(e) : Promise.resolve()));
73
+ const res = await dl(url);
74
+ await pipeline(res, zlib.createGunzip(), tar.x({ cwd: destDir }));
70
75
  }
71
76
  // Normalize executable name to 'cascode[.exe]'
72
77
  const altExe = path.join(destDir, altName);