@mirinjs/cli 0.0.1-alpha.2 → 0.0.1-alpha.3

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/artifacts.ts +10 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirinjs/cli",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.0.1-alpha.3",
4
4
  "description": "CLI for mirin apps: dev, build, init.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -27,10 +27,10 @@
27
27
  "bun": ">=1.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "create-mirinjs": "0.0.1-alpha.0"
30
+ "create-mirinjs": "0.0.1-alpha.3"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@mirinjs/darwin-arm64": "0.0.1-alpha.0"
33
+ "@mirinjs/darwin-arm64": "0.0.1-alpha.3"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
package/src/artifacts.ts CHANGED
@@ -118,13 +118,17 @@ async function ensureCef(): Promise<string> {
118
118
  const url = `https://github.com/${REPO_SLUG}/releases/download/v${version}/${asset}`;
119
119
  console.log(`[mirin] downloading CEF for ${platformTag()} (one-time, ~hundreds of MB)…`);
120
120
 
121
- const res = await fetch(url);
122
- if (!res.ok) {
123
- throw new Error(`mirin: failed to download CEF from ${url} (HTTP ${res.status}).`);
124
- }
121
+ // Download with curl, not `Bun.write(file, await fetch(url))`: the latter
122
+ // pins a core at 100% CPU and never completes on large gzip responses
123
+ // (the streaming write path). curl is fast and ubiquitous.
125
124
  const archive = join(tmpdir(), asset);
126
- await Bun.write(archive, res);
127
- await $`tar -xzf ${archive} -C ${cacheDir}`;
125
+ try {
126
+ await $`curl -fSL --retry 3 -o ${archive} ${url}`;
127
+ await $`tar -xzf ${archive} -C ${cacheDir}`;
128
+ } catch (err) {
129
+ rmSync(archive, { force: true });
130
+ throw new Error(`mirin: failed to download CEF from ${url} (${err}).`);
131
+ }
128
132
  rmSync(archive, { force: true });
129
133
  return cacheDir;
130
134
  }