@zoralabs/cli 1.0.1 → 1.1.0
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/README.md +25 -17
- package/dist/index.js +2664 -1013
- package/package.json +5 -3
- package/scripts/postinstall.mjs +72 -0
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoralabs/cli",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Zora CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"zora": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"scripts"
|
|
11
12
|
],
|
|
12
13
|
"publishConfig": {
|
|
13
14
|
"access": "public"
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"posthog-node": "^5.28.4",
|
|
26
27
|
"react": "^19.2.4",
|
|
27
28
|
"viem": "2.22.12",
|
|
28
|
-
"@zoralabs/coins-sdk": "0.
|
|
29
|
+
"@zoralabs/coins-sdk": "0.6.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@types/node": "^22.13.0",
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
"node": ">=20"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
46
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
45
47
|
"build": "tsup",
|
|
46
48
|
"build:js": "tsup",
|
|
47
49
|
"zora": "tsx src/index.tsx",
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
if (process.env.npm_config_global !== "true") {
|
|
8
|
+
process.exit(0);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const prefix = process.env.npm_config_prefix;
|
|
12
|
+
if (!prefix) {
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const npmBin =
|
|
17
|
+
process.platform === "win32" ? prefix : path.join(prefix, "bin");
|
|
18
|
+
|
|
19
|
+
const pathDirs = (process.env.PATH || "").split(path.delimiter);
|
|
20
|
+
const resolved = path.resolve(npmBin);
|
|
21
|
+
const inPath = pathDirs.some((dir) => path.resolve(dir) === resolved);
|
|
22
|
+
|
|
23
|
+
if (inPath) {
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const tty = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
28
|
+
const YELLOW = tty ? "\x1b[33m" : "";
|
|
29
|
+
const BOLD = tty ? "\x1b[1m" : "";
|
|
30
|
+
const DIM = tty ? "\x1b[2m" : "";
|
|
31
|
+
const RESET = tty ? "\x1b[0m" : "";
|
|
32
|
+
|
|
33
|
+
const shell = (process.env.SHELL || "").split("/").pop();
|
|
34
|
+
const isFish = shell === "fish";
|
|
35
|
+
|
|
36
|
+
let lines = [];
|
|
37
|
+
lines.push("");
|
|
38
|
+
lines.push(
|
|
39
|
+
`${YELLOW}\u26a0${RESET} ${BOLD}zora${RESET} is not in your PATH.`,
|
|
40
|
+
);
|
|
41
|
+
lines.push("");
|
|
42
|
+
lines.push(`${DIM} To fix, run:${RESET}`);
|
|
43
|
+
lines.push("");
|
|
44
|
+
|
|
45
|
+
if (process.platform === "win32") {
|
|
46
|
+
lines.push(
|
|
47
|
+
` powershell -c "[Environment]::SetEnvironmentVariable('Path',[Environment]::GetEnvironmentVariable('Path','User')+';${npmBin}','User')"`,
|
|
48
|
+
);
|
|
49
|
+
} else if (isFish) {
|
|
50
|
+
lines.push(` fish_add_path ${npmBin}`);
|
|
51
|
+
} else {
|
|
52
|
+
const exportCmd = `export PATH="${npmBin}:$PATH"`;
|
|
53
|
+
|
|
54
|
+
let rcFile;
|
|
55
|
+
if (shell === "zsh") {
|
|
56
|
+
rcFile = "~/.zshrc";
|
|
57
|
+
} else if (shell === "bash") {
|
|
58
|
+
rcFile = os.platform() === "darwin" ? "~/.bash_profile" : "~/.bashrc";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
lines.push(` ${exportCmd}`);
|
|
62
|
+
|
|
63
|
+
if (rcFile) {
|
|
64
|
+
lines.push(` echo '${exportCmd}' >> ${rcFile}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
lines.push("");
|
|
69
|
+
console.log(lines.join("\n"));
|
|
70
|
+
} catch {
|
|
71
|
+
// Never fail the install
|
|
72
|
+
}
|