@mistydemeo/cargodisttest 0.2.344 → 0.2.350

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
@@ -13,7 +13,7 @@ const error = (msg) => {
13
13
  };
14
14
 
15
15
  class Package {
16
- constructor(name, url, filename, zipExt, binaries) {
16
+ constructor(platform, name, url, filename, zipExt, binaries) {
17
17
  let errors = [];
18
18
  if (typeof url !== "string") {
19
19
  errors.push("url must be a string");
@@ -47,6 +47,8 @@ class Package {
47
47
  '\n\nCorrect usage: new Package("my-binary", "https://example.com/binary/download.tar.gz", {"my-binary": "my-binary"})';
48
48
  error(errorMsg);
49
49
  }
50
+
51
+ this.platform = platform;
50
52
  this.url = url;
51
53
  this.name = name;
52
54
  this.filename = filename;
@@ -122,12 +124,30 @@ class Package {
122
124
  );
123
125
  }
124
126
  } else if (this.zipExt == ".zip") {
125
- const result = spawnSync("unzip", [
126
- "-q",
127
- tempFile,
128
- "-d",
129
- this.installDirectory,
130
- ]);
127
+ let result;
128
+ if (this.platform.artifactName.includes("windows")) {
129
+ // Windows does not have "unzip" by default on many installations, instead
130
+ // we use Expand-Archive from powershell
131
+ result = spawnSync("powershell.exe", [
132
+ "-NoProfile",
133
+ "-NonInteractive",
134
+ "-Command",
135
+ `& {
136
+ param([string]$LiteralPath, [string]$DestinationPath)
137
+ Expand-Archive -LiteralPath $LiteralPath -DestinationPath $DestinationPath -Force
138
+ }`,
139
+ tempFile,
140
+ this.installDirectory,
141
+ ]);
142
+ } else {
143
+ result = spawnSync("unzip", [
144
+ "-q",
145
+ tempFile,
146
+ "-d",
147
+ this.installDirectory,
148
+ ]);
149
+ }
150
+
131
151
  if (result.status == 0) {
132
152
  resolve();
133
153
  } else if (result.error) {
package/binary.js CHANGED
@@ -96,7 +96,7 @@ const getPackage = () => {
96
96
  const url = `${artifactDownloadUrl}/${platform.artifactName}`;
97
97
  let filename = platform.artifactName;
98
98
  let ext = platform.zipExt;
99
- let binary = new Package(name, url, filename, ext, platform.bins);
99
+ let binary = new Package(platform, name, url, filename, ext, platform.bins);
100
100
 
101
101
  return binary;
102
102
  };
@@ -23,7 +23,7 @@
23
23
  "hasInstallScript": true,
24
24
  "license": "MIT OR Apache-2.0",
25
25
  "name": "@mistydemeo/cargodisttest",
26
- "version": "0.2.344"
26
+ "version": "0.2.350"
27
27
  },
28
28
  "node_modules/@isaacs/balanced-match": {
29
29
  "engines": {
@@ -896,5 +896,5 @@
896
896
  }
897
897
  },
898
898
  "requires": true,
899
- "version": "0.2.344"
899
+ "version": "0.2.350"
900
900
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "artifactDownloadUrl": "https://github.com/mistydemeo/cargodisttest/releases/download/v0.2.344",
2
+ "artifactDownloadUrl": "https://github.com/mistydemeo/cargodisttest/releases/download/v0.2.350",
3
3
  "bin": {
4
4
  "axolotlsay": "run-axolotlsay.js"
5
5
  },
@@ -90,7 +90,7 @@
90
90
  "zipExt": ".tar.xz"
91
91
  }
92
92
  },
93
- "version": "0.2.344",
93
+ "version": "0.2.350",
94
94
  "volta": {
95
95
  "node": "18.14.1",
96
96
  "npm": "9.5.0"