[No QA] chore: consolidate script execution on Bun (drop ts-node and tsx)#95890
Open
roryabraham wants to merge 8 commits into
Open
[No QA] chore: consolidate script execution on Bun (drop ts-node and tsx)#95890roryabraham wants to merge 8 commits into
roryabraham wants to merge 8 commits into
Conversation
Adds root bunfig.toml wiring scripts/stubReactNative.js as a preload so Bun scripts don't choke on Flow-typed React Native packages. Rewrites the stub to use Bun.plugin's virtual-module API instead of a CJS require() hook, since Bun's native ES `import` resolution bypasses Module.prototype.require entirely (the old hook only ever covered `require()` calls). Also dedupes @types/bun from the victory-chart-renderer workspace onto the root. Co-authored-by: Cursor <cursoragent@cursor.com>
Swaps every ts-node/tsx invocation across package.json scripts, shell wrappers (lint.sh, knip-changed.sh), GitHub workflow run: steps, and script shebangs to bun. Updates generateTranslations.ts and translationDryRun.yml to run under bun with an output-file assertion, rewrites octokit.ts's REPL preload for Bun's REPL, and updates comments/help text that referenced ts-node or tsx. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Drops the now-unused ts-node/tsx/tsconfig-paths devDependencies, deletes the obsolete `ts-node` config blocks from the root and scripts/ tsconfig.json files, removes tsconfig-paths from knip's ignoreDependencies, and refreshes package-lock.json. Co-authored-by: Cursor <cursoragent@cursor.com>
Satisfies unicorn/no-array-for-each caught by lint-changed. Co-authored-by: Cursor <cursoragent@cursor.com>
…g 'bun' Explicitly importing the "bun" module pulls @types/bun's global augmentations (which redeclare `require` as non-generic NodeJS.Require) into the whole root TS program, breaking the generic `require<T>` overload src/types/global.d.ts registers. Using the ambient `Bun` global avoids resolving @types/bun for this file entirely. Co-authored-by: Cursor <cursoragent@cursor.com>
…heck - bunfig.toml: adding root `preload` had dropped the existing [test] section that scopes `bun test` to server/ (Jest owns src/ and tests/). Restore it alongside preload. - translationDryRun.yml: assert src/languages/it.ts's checksum actually changed, in addition to the existing content checks, so a silently no-op'd dry-run can't pass by coincidence against the already-committed file. - stubReactNative.js: reference globalThis.Bun instead of the bare Bun global to satisfy eslint's no-undef without any config changes. Co-authored-by: Cursor <cursoragent@cursor.com>
CI runners don't have a global bun binary on PATH the way local dev machines do; only `npm run <script>` steps get node_modules/.bin prepended to PATH automatically. Direct `run: bun ...` steps in workflows failed with "bun: command not found" (exit 127). npx resolves the local bun devDependency, matching how these workflows previously invoked `npx ts-node`. Fixes translationDryRun, unused-styles, and knip CI failures observed on this PR; also fixes generateTranslations, createDeployChecklist, and deployExpensifyHelp which use the same pattern but weren't triggered by this PR's checks. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
A preview of your ExpensifyHelp changes have been deployed to https://873feacb.helpdot.pages.dev ⚡️ |
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.
Explanation of Change
Consolidates all developer/CI script execution in Expensify/App onto Bun, removing
ts-nodeandtsxentirely. This unblocks us to upgrade@actionsand@octokitpackages to their newer versions, which are ESM-only, whichts-nodedoesn't really support. Bun is also significantly faster than either alternative.ts-nodeandtsxinvocation tobun.bunfig.tomlthat preloadsscripts/stubReactNative.js, rewritten to use Bun'sBun.plugin().module()API so bothimportandrequire()of Flow-typed React Native packages (react-native,react-native-onyx, etc.) are intercepted for scripts that don't need real RN at runtime. This was necessary for ESM runtime.translationDryRun.ymlto rungenerateTranslations --dry-run --locales itunderbunand assert the generatedsrc/languages/it.tscontains the expected banner and[it]prefix, so the workflow still fails loudly if the script breaks.ts-node,tsx, andtsconfig-pathsfromdevDependencies, deleted the now-unusedts-nodeblocks fromtsconfig.jsonandscripts/tsconfig.json, and deduped@types/bunout ofserver/victory-chart-renderer/package.json(already present at the root).ts-node/tsxto reflect Bun.No behavior change for anything other than which runtime executes these scripts.
Fixed Issues
$ N/A — internal tooling/CI consolidation, no linked issue
PROPOSAL: N/A
Tests
npm install && bun --versionnpm run compress-svg— completes without errornpm run react-compiler-compliance-check -- check src/App.tsx— reportsCOMPILEDnpm run eslint-report -- --no-open— writes.eslint-reports/eslint-report.htmlUSE_WEB_PROXY=false npm run web-proxy— exits cleanlynpm run gh-actions-unused-styles— completes without errornpm run build— production build completes and writesdist/merged-source-map.js.map(exercises thetsx→bunrsbuild +combine-web-sourcemaps.tspath)bun scripts/generateTranslations.ts --dry-run --locales it— writessrc/languages/it.tswith the generated banner and[it]prefix (then revert the file)npm test— full Jest suite passes (anyHomePage.test.tsxfailure only reproduces under full-suite parallel runs and also occurs onmain; passes in isolation on both branches — pre-existing flake, unrelated to this change)npm run typecheck— 0 errorsrg 'ts-node|(?<![./])tsx(?![./])' . --glob '!node_modules/**' --glob '!package-lock.json' --glob '!**/*.tsx' --pcre2— no remaining runtime invocations (only.tsxfile-extension globs/markdown fences/unrelated third-party patch remain)npm ls ts-node tsx tsconfig-paths— only present as transitive deps of third-party packages (eslint-config-expensify,jest-config,typeorm,storybook-react-rsbuild), never our own devDependenciesnpm run test:bun— still scoped toserver/only (3 files, 16 tests) after restoringbunfig.toml's[test]sectionnpm run knip-changed— resolves 2 pre-existing findings (tsxdevDependency + binary), introduces 0 new findingsOffline tests
N/A — this PR only changes which local/CI runtime executes developer and build scripts; no app runtime or network behavior changes.
QA Steps
N/A — no app-facing change. This is a "[No QA]" tooling/CI chore.
PR Author Checklist
### Fixed Issuessection above (N/A — no issue for this internal tooling chore)TestssectionOffline stepssection (N/A)QA stepssection (N/A — no app-facing change)generateTranslations,combine-web-sourcemaps,rsbuildbuild,checkOnyxConnectBypass,compareKnipReports,findUnusedStyles,eslint-report,react-compiler-compliance-check,compressSvg,octokit, andweb/proxy.tsall still work under Bun)generateTranslationsTest.tsupdated to reflectprocess.argv[0]now being'bun')mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
N/A — no UI change.