@stonerzju/opencode 1.2.19 → 1.2.20
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 +15 -0
- package/bin/opencode +17 -0
- package/package.json +1 -1
package/README.md
ADDED
package/bin/opencode
CHANGED
|
@@ -31,8 +31,14 @@ if (envPath) {
|
|
|
31
31
|
path.resolve(__dirname, "../node_modules/.bin/bun"),
|
|
32
32
|
path.resolve(__dirname, "../../../.bun/bin/bun"),
|
|
33
33
|
path.resolve(os.homedir(), ".bun/bin/bun"),
|
|
34
|
+
path.resolve(os.homedir(), ".nvm/versions/node/v22.22.0/bin/bun"),
|
|
35
|
+
path.resolve(os.homedir(), ".nvm/versions/node/v22.21.0/bin/bun"),
|
|
36
|
+
path.resolve(os.homedir(), ".nvm/versions/node/v22.20.0/bin/bun"),
|
|
37
|
+
path.resolve(os.homedir(), ".nvm/versions/node/v20.0.0/bin/bun"),
|
|
38
|
+
path.resolve(os.homedir(), ".nvm/versions/node/v18.0.0/bin/bun"),
|
|
34
39
|
"/usr/local/bin/bun",
|
|
35
40
|
"/opt/homebrew/bin/bun",
|
|
41
|
+
"/usr/bin/bun",
|
|
36
42
|
]
|
|
37
43
|
|
|
38
44
|
for (const p of possiblePaths) {
|
|
@@ -45,6 +51,17 @@ if (envPath) {
|
|
|
45
51
|
if (bunPath) {
|
|
46
52
|
run(bunPath)
|
|
47
53
|
} else {
|
|
54
|
+
// Try to find bun using which command
|
|
55
|
+
try {
|
|
56
|
+
const whichResult = childProcess.execSync("which bun", { encoding: "utf-8" }).trim()
|
|
57
|
+
if (whichResult && fs.existsSync(whichResult)) {
|
|
58
|
+
bunPath = whichResult
|
|
59
|
+
run(bunPath)
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
// which command failed, continue to fallback
|
|
63
|
+
}
|
|
64
|
+
|
|
48
65
|
// Fallback: try to run with bun from PATH
|
|
49
66
|
run("bun")
|
|
50
67
|
}
|