fix(opencode): Allow compatible Bun versions in packageManager field (#9597)

Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
Michael Banucu
2026-01-20 18:34:00 +01:00
committed by GitHub
parent 7170983ef2
commit 17c4202ea8
5 changed files with 12 additions and 3 deletions

View File

@@ -3,7 +3,8 @@
"name": "@opencode-ai/script",
"license": "MIT",
"devDependencies": {
"@types/bun": "catalog:"
"@types/bun": "catalog:",
"@types/semver": "catalog:"
},
"exports": {
".": "./src/index.ts"

View File

@@ -1,5 +1,6 @@
import { $ } from "bun"
import path from "path"
import { satisfies } from "semver"
const rootPkgPath = path.resolve(import.meta.dir, "../../../package.json")
const rootPkg = await Bun.file(rootPkgPath).json()
@@ -9,7 +10,7 @@ if (!expectedBunVersion) {
throw new Error("packageManager field not found in root package.json")
}
if (process.versions.bun !== expectedBunVersion) {
if (!satisfies(process.versions.bun, expectedBunVersion)) {
throw new Error(`This script requires bun@${expectedBunVersion}, but you are using bun@${process.versions.bun}`)
}