diff options
| author | Dax Raad <[email protected]> | 2025-11-02 15:41:32 -0500 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-11-02 15:42:15 -0500 |
| commit | d1cd7d0344f8de03ab6bf222512d4615cbca7ec4 (patch) | |
| tree | f67b6721d01e13f857e62cab5990295cf2ad3460 /packages/script | |
| parent | 06ac1be226555c1d562a26de9c64dd64e3926275 (diff) | |
| download | opencode-d1cd7d0344f8de03ab6bf222512d4615cbca7ec4.tar.gz opencode-d1cd7d0344f8de03ab6bf222512d4615cbca7ec4.zip | |
ci: centralize Bun version to package.json to ensure consistent builds across CI and local development
Diffstat (limited to 'packages/script')
| -rw-r--r-- | packages/script/src/index.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/script/src/index.ts b/packages/script/src/index.ts index 9453c2526..f1f1e4597 100644 --- a/packages/script/src/index.ts +++ b/packages/script/src/index.ts @@ -1,7 +1,18 @@ import { $ } from "bun" +import path from "path" -if (process.versions.bun !== "1.3.1") { - throw new Error("This script requires [email protected]") +const rootPkgPath = path.resolve(import.meta.dir, "../../../package.json") +const rootPkg = await Bun.file(rootPkgPath).json() +const expectedBunVersion = rootPkg.packageManager?.split("@")[1] + +if (!expectedBunVersion) { + throw new Error("packageManager field not found in root package.json") +} + +if (process.versions.bun !== expectedBunVersion) { + throw new Error( + `This script requires bun@${expectedBunVersion}, but you are using bun@${process.versions.bun}`, + ) } const CHANNEL = |
