From 7d8781d197fe740410792f742d748dbb81400828 Mon Sep 17 00:00:00 2001 From: bompus Date: Mon, 19 Oct 2026 12:14:55 -0600 Subject: [PATCH] build: type-check with bun check typecheck runs the built-in from the temporary directory with an absolute project path (scripts/typecheck.ts), because the package.json check script shadows it and CI also runs on Windows. CI moves from Bun 1.4.2 to 1.4.3, the first release with bun check; the README notes the requirement for contributors. --- .github/workflows/ci.yml | 4 ++-- CONTRIBUTING.md | 3 ++- README.md | 2 ++ package.json | 4 ++-- scripts/typecheck.ts | 15 +++++++++++++++ 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 scripts/typecheck.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4895c0..bcc01b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: 1.4.2 + bun-version: 1.4.3 - run: bun install --frozen-lockfile - name: Install shellcheck and shfmt run: | @@ -44,7 +44,7 @@ jobs: persist-credentials: false - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: - bun-version: 1.4.2 + bun-version: 1.4.3 - run: bun install --frozen-lockfile - name: Install shellcheck and shfmt shell: pwsh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 84018b4..c85780e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -91,7 +91,8 @@ an older result with the version it was measured on. to Sync Server, then Deploy. When the build test passes, click Make Release and enter `X.Y.Z`. The saved build spec (build steps `["npm install -g bun@1.4.2"]`, CMD `["bun", "scripts/glama.ts"]`) needs a - change only when the Bun version CI uses or `scripts/glama.ts` changes. + change only when the Bun version the server needs (`engines.bun` in `package.json`) or + `scripts/glama.ts` changes. CI runs a newer Bun for `bun check`, which the server does not need. 6. Check every accepted listing in the next section. Update by hand any that still shows an older version or outdated details. diff --git a/README.md b/README.md index 951ec94..caf1d9f 100644 --- a/README.md +++ b/README.md @@ -468,6 +468,8 @@ bun test bun run check # format, lint and type check ``` +`bun run check` type-checks with Bun's `bun check`, which needs Bun 1.4.3 or later. + `bun scripts/build.ts --if-stale` rebuilds the binary only when a source file, the dependency manifest or lockfile, the bytecode-order profile, the build script, or the Bun version changed. Restart the unit diff --git a/package.json b/package.json index 3472d30..720d5a6 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,11 @@ "scripts": { "build": "bun scripts/build.ts", "test": "bun test", - "typecheck": "tsc --noEmit -p tsconfig.json", + "typecheck": "bun scripts/typecheck.ts", "lint": "oxlint --deny-warnings .", "fmt": "oxfmt", "check:published": "bun scripts/check-published.ts", - "check": "bun scripts/check-release.ts && oxfmt --check && oxlint --deny-warnings . && tsc --noEmit -p tsconfig.json && bun run check:shell", + "check": "bun scripts/check-release.ts && oxfmt --check && oxlint --deny-warnings . && bun run typecheck && bun run check:shell", "check:shell": "bun scripts/check-shell.ts" }, "devDependencies": { diff --git a/scripts/typecheck.ts b/scripts/typecheck.ts new file mode 100644 index 0000000..1d673de --- /dev/null +++ b/scripts/typecheck.ts @@ -0,0 +1,15 @@ +// Type check with Bun's built-in `bun check` (Bun 1.4.3 or later). A `check` script in +// package.json shadows the built-in in any directory that script belongs to, so the built-in runs +// from the temporary directory with an absolute project path. +import { tmpdir } from "node:os"; +import { resolve } from "node:path"; + +const proc = Bun.spawnSync( + [process.execPath, "check", "-p", resolve(import.meta.dir, "..", "tsconfig.json")], + { + cwd: tmpdir(), + stdout: "inherit", + stderr: "inherit", + }, +); +process.exit(proc.exitCode);