refactor: replace bun run with tsx/pnpm across scripts and CI#999
Merged
Conversation
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 45bbbf6. Configure here.
bb8cd22 to
4ee0ffd
Compare
Contributor
|
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 4286 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 81.64% 81.64% —%
==========================================
Files 328 328 —
Lines 23344 23343 -1
Branches 15111 15111 —
==========================================
+ Hits 19058 19057 -1
- Misses 4286 4286 —
- Partials 1613 1613 —Generated by Codecov Action |
d4451d2 to
4f737be
Compare
- Convert 12 script files from Bun APIs to Node equivalents (Bun.file/write/Glob → readFile/writeFile/tinyglobby) - Update shebangs: bun → tsx in all scripts except build.ts - Update package.json: bun run → tsx/pnpm run - Update CI: remove setup-bun from all jobs except build-binary - build.ts intentionally kept on Bun (uses Bun.build compiler)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Phase 4: Replace
bun runwithtsx/pnpm runPart of the Bun → Node.js migration. Removes Bun as the TypeScript runner for scripts and CI, replacing with
tsxandpnpm run.Changes
Script files (14 converted):
Bun.file().text()→readFile()fromnode:fs/promisesBun.write()→writeFile()Bun.file().exists()→access()Bun.file().json()→JSON.parse(readFile())new Bun.Glob()→tinyglobby#!/usr/bin/env bun→#!/usr/bin/env tsxgenerate-api-schema.ts: replacedrequire.resolve("@sentry/api/package.json")withimport.meta.resolve+fileURLToPath(avoidsERR_PACKAGE_PATH_NOT_EXPORTEDandERR_AMBIGUOUS_MODULE_SYNTAX)ESM require shim (
script/require-shim.mjs):require()for lazy loading (circular dep breaking, optional features). This works natively in Bun and CJS bundles, but fails under tsx/Node ESM (since"type": "module"is set).globalThis.requireviacreateRequire, anchored at the project root (package.json).require()calls insrc/are behind runtime-only code paths (DB init, telemetry) that do not execute during tsx script runs.Worker source refactor (
src/lib/scan/grep-worker-source.ts):import ... with { type: "text" }(Bun-specific) with a wrapper module that usesreadFileSyncat dev time.text-import-pluginintercepts the module and inlinesgrep-worker.jsas a string constant.textImportPluginfromvitest.config.ts.package.json:
"tsx"script alias:tsx --import ./script/require-shim.mjspnpm tsx(which invokes the alias)build/build:allretainbun run(needsBun.build()compiler)CI (
.github/workflows/ci.yml):setup-bunfrom all jobs exceptbuild-binarybun run→pnpm runin non-build stepsDocumentation:
README.md,DEVELOPMENT.md,contributing.mdto usepnpm runinstead ofbun runbench.ts,bench-sweep.tsdocs/pnpm-lock.yamlfor docs site build (was usingbun.lock)Tests:
bundle.test.tsandlibrary.test.tsE2E tests:spawn("bun", ...)→spawn("pnpm", ...)concurrent-worker.tsshebang and usage commentsIntentionally kept on Bun
script/build.ts— usesBun.build()(compiler) which has no Node equivalentbuild-binaryCI job retainssetup-bunTesting