char 1.0.9 → 1.0.11
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/install.js +26 -0
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -29,6 +29,7 @@ if (!existsSync(binDir)) {
|
|
|
29
29
|
|
|
30
30
|
const dest = join(binDir, "char");
|
|
31
31
|
if (existsSync(dest)) {
|
|
32
|
+
downloadCliUI();
|
|
32
33
|
process.exit(0);
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -38,3 +39,28 @@ execSync(`curl -fsSL -o "${tmp}" "${url}"`, { stdio: "inherit" });
|
|
|
38
39
|
execSync(`tar -xf "${tmp}" -C "${binDir}"`, { stdio: "inherit" });
|
|
39
40
|
execSync(`rm -f "${tmp}"`);
|
|
40
41
|
execSync(`chmod +x "${dest}"`);
|
|
42
|
+
|
|
43
|
+
downloadCliUI();
|
|
44
|
+
|
|
45
|
+
function downloadCliUI() {
|
|
46
|
+
if (process.platform !== "darwin") return;
|
|
47
|
+
|
|
48
|
+
const uiDest = join(binDir, "char-cli-ui");
|
|
49
|
+
if (existsSync(uiDest)) return;
|
|
50
|
+
|
|
51
|
+
const uiArchive = `char-cli-ui-${version}-${target}.tar.xz`;
|
|
52
|
+
const uiUrl = `https://github.com/${REPO}/releases/download/${tag}/${uiArchive}`;
|
|
53
|
+
|
|
54
|
+
console.error(`Downloading char-cli-ui from ${uiUrl}`);
|
|
55
|
+
try {
|
|
56
|
+
const uiTmp = join(require("node:os").tmpdir(), uiArchive);
|
|
57
|
+
execSync(`curl -fsSL -o "${uiTmp}" "${uiUrl}"`, { stdio: "inherit" });
|
|
58
|
+
execSync(`tar -xf "${uiTmp}" -C "${binDir}"`, { stdio: "inherit" });
|
|
59
|
+
execSync(`rm -f "${uiTmp}"`);
|
|
60
|
+
execSync(`chmod +x "${uiDest}"`);
|
|
61
|
+
} catch {
|
|
62
|
+
console.error(
|
|
63
|
+
"Warning: failed to download char-cli-ui (shortcut will not work)",
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|