chad-code 1.3.8 → 1.3.10
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/chad-code +19 -17
- package/package.json +8 -1
package/bin/chad-code
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { spawnSync } from "child_process"
|
|
4
|
+
import { existsSync, readdirSync, realpathSync } from "fs"
|
|
5
|
+
import { dirname, join } from "path"
|
|
6
|
+
import { platform as osPlatform, arch as osArch } from "os"
|
|
7
|
+
import { fileURLToPath } from "url"
|
|
7
8
|
|
|
8
9
|
function run(target) {
|
|
9
|
-
const result =
|
|
10
|
+
const result = spawnSync(target, process.argv.slice(2), {
|
|
10
11
|
stdio: "inherit",
|
|
11
12
|
})
|
|
12
13
|
if (result.error) {
|
|
@@ -22,8 +23,9 @@ if (envPath) {
|
|
|
22
23
|
run(envPath)
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
-
const
|
|
26
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
27
|
+
const scriptPath = realpathSync(__filename)
|
|
28
|
+
const scriptDir = dirname(scriptPath)
|
|
27
29
|
|
|
28
30
|
const platformMap = {
|
|
29
31
|
darwin: "darwin",
|
|
@@ -36,13 +38,13 @@ const archMap = {
|
|
|
36
38
|
arm: "arm",
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
let platform = platformMap[
|
|
41
|
+
let platform = platformMap[osPlatform()]
|
|
40
42
|
if (!platform) {
|
|
41
|
-
platform =
|
|
43
|
+
platform = osPlatform()
|
|
42
44
|
}
|
|
43
|
-
let arch = archMap[
|
|
45
|
+
let arch = archMap[osArch()]
|
|
44
46
|
if (!arch) {
|
|
45
|
-
arch =
|
|
47
|
+
arch = osArch()
|
|
46
48
|
}
|
|
47
49
|
const base = "chad-code-" + platform + "-" + arch
|
|
48
50
|
const binary = platform === "windows" ? "chad-code.exe" : "chad-code"
|
|
@@ -50,20 +52,20 @@ const binary = platform === "windows" ? "chad-code.exe" : "chad-code"
|
|
|
50
52
|
function findBinary(startDir) {
|
|
51
53
|
let current = startDir
|
|
52
54
|
for (;;) {
|
|
53
|
-
const modules =
|
|
54
|
-
if (
|
|
55
|
-
const entries =
|
|
55
|
+
const modules = join(current, "node_modules")
|
|
56
|
+
if (existsSync(modules)) {
|
|
57
|
+
const entries = readdirSync(modules)
|
|
56
58
|
for (const entry of entries) {
|
|
57
59
|
if (!entry.startsWith(base)) {
|
|
58
60
|
continue
|
|
59
61
|
}
|
|
60
|
-
const candidate =
|
|
61
|
-
if (
|
|
62
|
+
const candidate = join(modules, entry, "bin", binary)
|
|
63
|
+
if (existsSync(candidate)) {
|
|
62
64
|
return candidate
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
|
-
const parent =
|
|
68
|
+
const parent = dirname(current)
|
|
67
69
|
if (parent === current) {
|
|
68
70
|
return
|
|
69
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.10",
|
|
4
4
|
"name": "chad-code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -101,5 +101,12 @@
|
|
|
101
101
|
"yargs": "18.0.0",
|
|
102
102
|
"zod": "4.1.8",
|
|
103
103
|
"zod-to-json-schema": "3.24.5"
|
|
104
|
+
},
|
|
105
|
+
"optionalDependencies": {
|
|
106
|
+
"chad-code-darwin-arm64": "1.3.4",
|
|
107
|
+
"chad-code-darwin-x64": "1.3.4",
|
|
108
|
+
"chad-code-linux-arm64": "1.3.4",
|
|
109
|
+
"chad-code-linux-x64": "1.3.4",
|
|
110
|
+
"chad-code-windows-x64": "1.3.4"
|
|
104
111
|
}
|
|
105
112
|
}
|