@mistydemeo/cargodisttest 0.2.248 → 0.2.249

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/binary-install.js CHANGED
@@ -1,10 +1,11 @@
1
- const { existsSync, mkdirSync } = require("fs");
2
- const { join } = require("path");
1
+ const { createWriteStream, existsSync, mkdirSync, mkdtemp } = require("fs");
2
+ const { join, sep } = require("path");
3
3
  const { spawnSync } = require("child_process");
4
+ const { tmpdir } = require("os");
4
5
 
5
6
  const axios = require("axios");
6
- const tar = require("tar");
7
7
  const rimraf = require("rimraf");
8
+ const tmpDir = tmpdir();
8
9
 
9
10
  const error = (msg) => {
10
11
  console.error(msg);
@@ -12,7 +13,7 @@ const error = (msg) => {
12
13
  };
13
14
 
14
15
  class Package {
15
- constructor(name, url, binaries) {
16
+ constructor(name, url, filename, zipExt, binaries) {
16
17
  let errors = [];
17
18
  if (typeof url !== "string") {
18
19
  errors.push("url must be a string");
@@ -48,6 +49,8 @@ class Package {
48
49
  }
49
50
  this.url = url;
50
51
  this.name = name;
52
+ this.filename = filename;
53
+ this.zipExt = zipExt;
51
54
  this.installDirectory = join(__dirname, "node_modules", ".bin_real");
52
55
  this.binaries = binaries;
53
56
 
@@ -90,11 +93,59 @@ class Package {
90
93
  return axios({ ...fetchOptions, url: this.url, responseType: "stream" })
91
94
  .then((res) => {
92
95
  return new Promise((resolve, reject) => {
93
- const sink = res.data.pipe(
94
- tar.x({ strip: 1, C: this.installDirectory }),
95
- );
96
- sink.on("finish", () => resolve());
97
- sink.on("error", (err) => reject(err));
96
+ mkdtemp(`${tmpDir}${sep}`, (err, directory) => {
97
+ let tempFile = join(directory, this.filename);
98
+ const sink = res.data.pipe(createWriteStream(tempFile));
99
+ sink.on("error", (err) => reject(err));
100
+ sink.on("close", () => {
101
+ if (/\.tar\.*/.test(this.zipExt)) {
102
+ const result = spawnSync("tar", [
103
+ "xf",
104
+ tempFile,
105
+ // The tarballs are stored with a leading directory
106
+ // component; we strip one component in the
107
+ // shell installers too.
108
+ "--strip-components",
109
+ "1",
110
+ "-C",
111
+ this.installDirectory,
112
+ ]);
113
+ if (result.status == 0) {
114
+ resolve();
115
+ } else if (result.error) {
116
+ reject(result.error);
117
+ } else {
118
+ reject(
119
+ new Error(
120
+ `An error occurred untarring the artifact: stdout: ${result.stdout}; stderr: ${result.stderr}`,
121
+ ),
122
+ );
123
+ }
124
+ } else if (this.zipExt == ".zip") {
125
+ const result = spawnSync("unzip", [
126
+ "-q",
127
+ tempFile,
128
+ "-d",
129
+ this.installDirectory,
130
+ ]);
131
+ if (result.status == 0) {
132
+ resolve();
133
+ } else if (result.error) {
134
+ reject(result.error);
135
+ } else {
136
+ reject(
137
+ new Error(
138
+ `An error occurred unzipping the artifact: stdout: ${result.stdout}; stderr: ${result.stderr}`,
139
+ ),
140
+ );
141
+ }
142
+ } else {
143
+ reject(
144
+ new Error(`Unrecognized file extension: ${this.zipExt}`),
145
+ );
146
+ }
147
+ });
148
+ });
98
149
  });
99
150
  })
100
151
  .then(() => {
package/binary.js CHANGED
@@ -94,7 +94,9 @@ const getPlatform = () => {
94
94
  const getPackage = () => {
95
95
  const platform = getPlatform();
96
96
  const url = `${artifactDownloadUrl}/${platform.artifactName}`;
97
- let binary = new Package(name, url, platform.bins);
97
+ let filename = platform.artifactName;
98
+ let ext = platform.zipExt;
99
+ let binary = new Package(name, url, filename, ext, platform.bins);
98
100
 
99
101
  return binary;
100
102
  };
@@ -11,8 +11,7 @@
11
11
  "axios-proxy-builder": "^0.1.2",
12
12
  "console.table": "^0.10.0",
13
13
  "detect-libc": "^2.0.3",
14
- "rimraf": "^5.0.8",
15
- "tar": "^7.4.3"
14
+ "rimraf": "^5.0.8"
16
15
  },
17
16
  "devDependencies": {
18
17
  "prettier": "^3.3.3"
@@ -24,7 +23,7 @@
24
23
  "hasInstallScript": true,
25
24
  "license": "MIT OR Apache-2.0",
26
25
  "name": "@mistydemeo/cargodisttest",
27
- "version": "0.2.248"
26
+ "version": "0.2.249"
28
27
  },
29
28
  "node_modules/@isaacs/cliui": {
30
29
  "dependencies": {
@@ -43,18 +42,6 @@
43
42
  "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
44
43
  "version": "8.0.2"
45
44
  },
46
- "node_modules/@isaacs/fs-minipass": {
47
- "dependencies": {
48
- "minipass": "^7.0.4"
49
- },
50
- "engines": {
51
- "node": ">=18.0.0"
52
- },
53
- "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
54
- "license": "ISC",
55
- "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
56
- "version": "4.0.1"
57
- },
58
45
  "node_modules/@pkgjs/parseargs": {
59
46
  "engines": {
60
47
  "node": ">=14"
@@ -129,15 +116,6 @@
129
116
  "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
130
117
  "version": "2.0.1"
131
118
  },
132
- "node_modules/chownr": {
133
- "engines": {
134
- "node": ">=18"
135
- },
136
- "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
137
- "license": "BlueOak-1.0.0",
138
- "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
139
- "version": "3.0.0"
140
- },
141
119
  "node_modules/clone": {
142
120
  "engines": {
143
121
  "node": ">=0.8"
@@ -414,34 +392,6 @@
414
392
  "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
415
393
  "version": "7.1.2"
416
394
  },
417
- "node_modules/minizlib": {
418
- "dependencies": {
419
- "minipass": "^7.0.4",
420
- "rimraf": "^5.0.5"
421
- },
422
- "engines": {
423
- "node": ">= 18"
424
- },
425
- "integrity": "sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==",
426
- "license": "MIT",
427
- "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.1.tgz",
428
- "version": "3.0.1"
429
- },
430
- "node_modules/mkdirp": {
431
- "bin": {
432
- "mkdirp": "dist/cjs/src/bin.js"
433
- },
434
- "engines": {
435
- "node": ">=10"
436
- },
437
- "funding": {
438
- "url": "https://github.com/sponsors/isaacs"
439
- },
440
- "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
441
- "license": "MIT",
442
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
443
- "version": "3.0.1"
444
- },
445
395
  "node_modules/path-key": {
446
396
  "engines": {
447
397
  "node": ">=8"
@@ -634,22 +584,6 @@
634
584
  "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
635
585
  "version": "5.0.1"
636
586
  },
637
- "node_modules/tar": {
638
- "dependencies": {
639
- "@isaacs/fs-minipass": "^4.0.0",
640
- "chownr": "^3.0.0",
641
- "minipass": "^7.1.2",
642
- "minizlib": "^3.0.1",
643
- "mkdirp": "^3.0.1",
644
- "yallist": "^5.0.0"
645
- },
646
- "engines": {
647
- "node": ">=18"
648
- },
649
- "integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==",
650
- "resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz",
651
- "version": "7.4.3"
652
- },
653
587
  "node_modules/tunnel": {
654
588
  "engines": {
655
589
  "node": ">=0.6.11 <=0.7.0 || >=0.7.3"
@@ -774,17 +708,8 @@
774
708
  "license": "MIT",
775
709
  "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
776
710
  "version": "6.0.1"
777
- },
778
- "node_modules/yallist": {
779
- "engines": {
780
- "node": ">=18"
781
- },
782
- "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
783
- "license": "BlueOak-1.0.0",
784
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
785
- "version": "5.0.0"
786
711
  }
787
712
  },
788
713
  "requires": true,
789
- "version": "0.2.248"
714
+ "version": "0.2.249"
790
715
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "artifactDownloadUrl": "https://mistydemeo.artifacts.axodotdev.host/axolotlsay/ax_-mY3Lo8JouI5ZouW1doru",
2
+ "artifactDownloadUrl": "https://mistydemeo.artifacts.axodotdev.host/axolotlsay/ax_i5eHdMynHaZRNC42FPsCF",
3
3
  "bin": {
4
4
  "axolotlsay": "run-axolotlsay.js"
5
5
  },
@@ -8,8 +8,7 @@
8
8
  "axios-proxy-builder": "^0.1.2",
9
9
  "console.table": "^0.10.0",
10
10
  "detect-libc": "^2.0.3",
11
- "rimraf": "^5.0.8",
12
- "tar": "^7.4.3"
11
+ "rimraf": "^5.0.8"
13
12
  },
14
13
  "description": "💬 a CLI for learning to distribute CLIs in rust",
15
14
  "devDependencies": {
@@ -77,7 +76,7 @@
77
76
  "zipExt": ".tar.gz"
78
77
  }
79
78
  },
80
- "version": "0.2.248",
79
+ "version": "0.2.249",
81
80
  "volta": {
82
81
  "node": "18.14.1",
83
82
  "npm": "9.5.0"