arcana-ai 0.1.3 → 0.1.4
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/bin/arcana.js +8 -4
- package/package.json +1 -1
package/bin/arcana.js
CHANGED
|
@@ -32,11 +32,15 @@ const CACHE_DIR = process.env.ARCANA_CACHE || path.join(os.homedir(), ".arcana",
|
|
|
32
32
|
const CACHED_BINARY = path.join(CACHE_DIR, entry.binary)
|
|
33
33
|
|
|
34
34
|
async function downloadAndExtract() {
|
|
35
|
-
|
|
35
|
+
const ext = entry.asset.endsWith(".tar.gz") ? ".tar.gz" : ".zip"
|
|
36
|
+
const zipName = `arcana-${platform}${ext}`
|
|
37
|
+
|
|
38
|
+
// Clean up any stale temp files from previous failed attempts
|
|
39
|
+
try { unlinkSync(path.join(CACHE_DIR, zipName)) } catch {}
|
|
36
40
|
try { unlinkSync(path.join(CACHE_DIR, entry.asset)) } catch {}
|
|
37
41
|
|
|
38
42
|
const url = `https://github.com/${REPO}/releases/download/${VERSION}/${entry.asset}`
|
|
39
|
-
console.error(`arcana: downloading ${
|
|
43
|
+
console.error(`arcana: downloading ${zipName}...`)
|
|
40
44
|
|
|
41
45
|
mkdirSync(CACHE_DIR, { recursive: true })
|
|
42
46
|
|
|
@@ -46,10 +50,10 @@ async function downloadAndExtract() {
|
|
|
46
50
|
process.exit(1)
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
const tmp = path.join(CACHE_DIR,
|
|
53
|
+
const tmp = path.join(CACHE_DIR, zipName)
|
|
50
54
|
const buf = Buffer.from(await res.arrayBuffer())
|
|
51
55
|
writeFileSync(tmp, buf)
|
|
52
|
-
console.error(`arcana: ${(buf.length / 1e6).toFixed(1)}MB
|
|
56
|
+
console.error(`arcana: ${(buf.length / 1e6).toFixed(1)}MB, extracting...`)
|
|
53
57
|
|
|
54
58
|
try {
|
|
55
59
|
if (entry.asset.endsWith(".tar.gz")) {
|