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 | |
| 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
| -rw-r--r-- | .github/actions/setup-bun/action.yml | 2 | ||||
| -rw-r--r-- | packages/script/src/index.ts | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/.github/actions/setup-bun/action.yml b/.github/actions/setup-bun/action.yml index 108a53df2..b637ee7b7 100644 --- a/.github/actions/setup-bun/action.yml +++ b/.github/actions/setup-bun/action.yml @@ -5,6 +5,8 @@ runs: steps: - name: Setup Bun uses: oven-sh/setup-bun@v2 + with: + bun-version-file: package.json - name: Cache ~/.bun id: cache-bun 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 = |
