chore(dev): Replace ts-node with tsx#6481
Merged
Merged
Conversation
`tsx` has a couple of advantages over `ts-node`: - Running a script with `tsx` is about 20% faster than with `ts-node`. - `tsx` is also easier to use. I've had problems where `ts-node` doesn't seem to honor the TypeScript config like `tsc` does, but `tsx` "just works".
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring alerts on:
|
Contributor
Author
|
@SocketSecurity ignore npm/esbuild@0.25.9 We have disabled the |
Contributor
Author
|
@SocketSecurity ignore npm/tsx@4.20.5 I reviewed this and I don't think this is an issue. I believe |
Mrtenz
approved these changes
Oct 14, 2025
cryptodev-2s
approved these changes
Oct 14, 2025
4 tasks
cryptodev-2s
added a commit
that referenced
this pull request
Oct 17, 2025
## Explanation ### What is the current state of things and why does it need to change? The `publish-preview.yml` GitHub Actions workflow is still using `ts-node` to execute the `generate-preview-build-message.ts` script. However, the project has recently migrated from `ts-node` to `tsx` [PR](#6481) ## References - N/A ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - No test changes needed for this workflow update - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - No documentation changes needed - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - No changelog needed as this is an internal workflow change - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes - No breaking changes - internal workflow update only <!-- CURSOR_SUMMARY --> --- > [!NOTE] > <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is generating a summary for commit 8aea01095fc161dfd358bfee192528c8b7a2975d. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
15 tasks
georgewrmarshall
added a commit
to MetaMask/metamask-design-system
that referenced
this pull request
Oct 22, 2025
) ## **Description** This change mirrors the successful optimization implemented in [MetaMask/core#6481](https://github.com/MetaMask/core/pull/6481/files) and provides significant performance improvements for TypeScript script execution in large monorepos. ## **Related issues** Fixes: N/A ## **Manual testing steps** - [x] Run `yarn lint` and verify it completes successfully without hanging - [x] Run `yarn lint:eslint` individually to confirm ESLint processing works - [x] Test `yarn create-component:react` to ensure component generation still works - [x] Test `yarn update-readme-content` to verify documentation scripts work - [x] Verify all other scripts using TypeScript execution continue to function ## **Screenshots/Recordings** Not applicable - this is a build/tooling performance optimization without visual changes. ## **Pre-merge author checklist** - [x] I have reviewed the Files changed tab - [x] All CI checks pass (yarn lint now works without hanging) - [x] The same scripts work in all workspace packages - [x] All TypeScript script executions use the faster `tsx` instead of `ts-node` - [x] LavaMoat configuration updated to allow `tsx>esbuild` instead of `ts-node>@swc/core` - [x] Dependency configuration updated in depcheck to ignore `tsx` instead of `ts-node` - [x] Script shebang lines updated in all affected files - [x] I have tested this PR on my local machine ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. ## **Technical Details** **Files Changed:** - **Root package.json**: Updated 3 scripts (`create-package`, `lint:eslint`, `update-readme-content`) - **Dependency updates**: Replaced `ts-node` with `tsx` in devDependencies - **LavaMoat config**: Updated to allow `tsx>esbuild` instead of `ts-node>@swc/core` - **Package scripts**: Updated React and React Native packages to use `tsx` - **Build scripts**: Updated shebang lines and direct script calls - **Depcheck config**: Updated to ignore `tsx` instead of `ts-node` **Performance Impact:** - **Before**: `yarn lint` would hang indefinitely - **After**: `yarn lint` completes successfully in reasonable time - **Benefit**: Enables faster development cycles and unblocks CI/CD pipelines **References:** - Inspired by MetaMask/core optimization: https://github.com/MetaMask/core/pull/6481/files - `tsx` documentation: https://github.com/esbuild-kit/tsx <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Replace ts-node with tsx for TypeScript scripts, updating scripts, configs, shebangs, and dependencies. > > - **Tooling**: > - Migrate TypeScript script runner from `ts-node` to `tsx` across repo. > - Update script invocations in root `package.json` (`create-package`, `lint:eslint`, `update-readme-content`). > - Switch package scripts in `packages/design-system-react` and `packages/design-system-react-native` (`create-component`, `generate-icons`, `generate-icons:index`). > - Update build step in `packages/design-system-react-native/scripts/build.js` to call `tsx`. > - Change shebangs in `scripts/generate-preview-build-message.ts` and `scripts/update-readme-content.ts` to `#!yarn tsx`. > - **Config**: > - Update LavaMoat `allowScripts` from `ts-node>@swc/core` to `tsx>esbuild`. > - Adjust `.depcheckrc.yml` ignores to `tsx`. > - **Dependencies**: > - Remove `ts-node`; add `tsx` and related `esbuild` entries; refresh `yarn.lock`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d403f8d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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
tsxhas a couple of advantages overts-node:tsxis about 20% faster than withts-node.tsxis also easier to use. I've run into problems in the past wherets-nodedoesn't seem to honor the TypeScript config liketscdoes, buttsx"just works".References
(N/A)
Checklist
Note
Switches TypeScript script runner from ts-node to tsx and updates scripts, shebangs, and dependencies accordingly.
ts-nodewithtsxacross script runners inpackage.json(create-package,generate-method-action-types,lint:eslint,lint:teams,update-readme-content).scripts/generate-method-action-types.ts,scripts/generate-preview-build-message.ts, andscripts/update-readme-content.tsto#!yarn tsx.ts-node→tsx; updatelavamoat.allowScriptsto includetsx>esbuild.yarn.lock: removets-node(and related packages) and addtsxwithesbuildplatform binaries and related entries.Written by Cursor Bugbot for commit 2076008. This will update automatically on new commits. Configure here.