@tealstreet/cli 0.10.8 → 0.10.9

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": "@tealstreet/cli",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "description": "Tealstreet CLI - Trade crypto from your terminal",
5
5
  "main": "bin/tealstreet.cjs",
6
6
  "type": "module",
@@ -16,6 +16,7 @@ function resolvePlatform() {
16
16
  const platformMap = {
17
17
  darwin: 'darwin',
18
18
  linux: 'linux',
19
+ win32: 'windows',
19
20
  };
20
21
  const archMap = {
21
22
  arm64: 'arm64',
@@ -40,9 +41,15 @@ function getCacheDir() {
40
41
  return path.join(root, 'tealstreet-cli', packageJson.version);
41
42
  }
42
43
 
44
+ // `bun build --compile` appends `.exe` to a Windows target, so the release asset
45
+ // carries it. The cached copy must too, or Windows refuses to execute it.
46
+ function assetName(target) {
47
+ return target.startsWith('windows') ? `tealstreet-${target}.exe` : `tealstreet-${target}`;
48
+ }
49
+
43
50
  function getBinaryPath() {
44
51
  const target = resolvePlatform();
45
- return path.join(getCacheDir(), `tealstreet-${target}`);
52
+ return path.join(getCacheDir(), assetName(target));
46
53
  }
47
54
 
48
55
  function sha256File(file) {
@@ -181,13 +188,14 @@ function download(url, destination, { expectedSha256 } = {}) {
181
188
  async function fetchExpectedSha256(target) {
182
189
  const sumsUrl = `https://github.com/Tealstreet/cli/releases/download/v${packageJson.version}/SHA256SUMS`;
183
190
  const sums = await fetchText(sumsUrl);
191
+ const wanted = assetName(target);
184
192
  for (const line of sums.split(/\r?\n/)) {
185
193
  const [hash, file] = line.trim().split(/\s+/);
186
- if (file === `tealstreet-${target}` && /^[a-f0-9]{64}$/i.test(hash)) {
194
+ if (file === wanted && /^[a-f0-9]{64}$/i.test(hash)) {
187
195
  return hash;
188
196
  }
189
197
  }
190
- throw new Error(`Missing checksum for tealstreet-${target}`);
198
+ throw new Error(`Missing checksum for ${wanted}`);
191
199
  }
192
200
 
193
201
  function ensureBinary({ optional = false } = {}) {
@@ -198,7 +206,7 @@ function ensureBinary({ optional = false } = {}) {
198
206
  return binary;
199
207
  }
200
208
 
201
- const url = `https://github.com/Tealstreet/cli/releases/download/v${packageJson.version}/tealstreet-${target}`;
209
+ const url = `https://github.com/Tealstreet/cli/releases/download/v${packageJson.version}/${assetName(target)}`;
202
210
 
203
211
  try {
204
212
  const childProcess = require('node:child_process');
@@ -270,6 +278,7 @@ if (require.main === module) {
270
278
  }
271
279
 
272
280
  module.exports = {
281
+ assetName,
273
282
  ensureBinary,
274
283
  getBinaryPath,
275
284
  resolvePlatform,