fix(windows): force npm cmd shim generation and update install docs (#2558)

Co-authored-by: Dax <mail@thdxr.com>
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Mani Sundararajan
2025-09-16 03:40:19 -04:00
committed by GitHub
parent 02e492f6eb
commit 15df2710fa
4 changed files with 88 additions and 9 deletions

View File

@@ -13,13 +13,25 @@ function main() {
return
}
const binDir = path.join(__dirname, "bin")
const unixScript = path.join(binDir, "opencode")
console.log("Windows detected: Modifying package.json bin entry")
console.log("Windows detected: Configuring bin scripts for Windows")
// Read package.json
const packageJsonPath = path.join(__dirname, "package.json")
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"))
// Modify bin to point to .cmd file on Windows
packageJson.bin = {
opencode: "./bin/opencode.cmd",
}
// Write it back
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
console.log("Updated package.json bin to use opencode.cmd")
// Now you can also remove the Unix script if you want
const unixScript = path.join(__dirname, "bin", "opencode")
if (fs.existsSync(unixScript)) {
console.log("Removing Unix shell script from bin/")
console.log("Removing Unix shell script")
fs.unlinkSync(unixScript)
}
}