Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use tsx instead of ts-node #6214

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

roninjin10
Copy link
Contributor

@roninjin10 roninjin10 commented Jun 30, 2023

  • use tsx instead of tsnode

Why?

Tsx is much much much faster

At the core, tsx is powered by esbuild for blazing fast TypeScript compilation, whereas ts-node (by default) uses the TypeScript compiler. Because esbuild doesn't type check, tsx is similar to ts-node --esm --swc (which uses the SWC compiler).

Tsx is much lower maintenence cost

Compared to alternatives things tend to "just work" when it comes to tsx. As an concrete example, if we added viem to any of our packages and tried to use ts-node things would fall over until a JavaScript nerd who understands ESM modules fixed it.

image

@roninjin10 roninjin10 requested review from a team and smartcontracts as code owners June 30, 2023 01:31
@changeset-bot
Copy link

changeset-bot bot commented Jun 30, 2023

⚠️ No Changeset found

Latest commit: 167373b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented Jun 30, 2023

Deploy Preview for opstack-docs canceled.

Name Link
🔨 Latest commit 167373b
🔍 Latest deploy log https://app.netlify.com/sites/opstack-docs/deploys/64bb087048d23c0007c1b093

@roninjin10
Copy link
Contributor Author

roninjin10 commented Jun 30, 2023

@mergify mergify bot added the common-ts label Jun 30, 2023
@roninjin10
Copy link
Contributor Author

Looks broken atm but this pr is still open because feedback on the approach is still important

@roninjin10 roninjin10 force-pushed the 06-29-feat_Use_tsx_instead_of_ts-node branch from 4abd518 to 810ea14 Compare June 30, 2023 14:40
@roninjin10
Copy link
Contributor Author

hmm not sure why this is broke these are wierd failures draft for now

@roninjin10 roninjin10 marked this pull request as draft June 30, 2023 16:01
@tynes
Copy link
Contributor

tynes commented Jun 30, 2023

seems like a versioning thing? could prob drop ledger support if necessary

@github-actions
Copy link
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jul 15, 2023
@roninjin10
Copy link
Contributor Author

This pr failing is odd gonna rebase and try again

@roninjin10 roninjin10 force-pushed the 06-29-feat_Use_tsx_instead_of_ts-node branch from 810ea14 to 8c6e521 Compare July 17, 2023 16:23
@mergify
Copy link
Contributor

mergify bot commented Jul 17, 2023

Hey @roninjin10! This PR has merge conflicts. Please fix them before continuing review.

@mergify mergify bot added the conflict label Jul 17, 2023
@tynes
Copy link
Contributor

tynes commented Jul 17, 2023

@roninjin10 I think 1 more rebase should fix the issues we were seeing previously

@tynes tynes force-pushed the 06-29-feat_Use_tsx_instead_of_ts-node branch from 8c6e521 to 5bddd3a Compare July 17, 2023 23:07
@mergify mergify bot removed the conflict label Jul 17, 2023
@tynes tynes marked this pull request as ready for review July 17, 2023 23:09
@tynes tynes removed the Stale label Jul 17, 2023
@roninjin10
Copy link
Contributor Author

hardhat is very fragile it appears. Will need to pull pr down locallyt to debug. The failures are unrelated to tsx and have to do more with how type resolution changed after uninstalling ts-node.

@roninjin10 roninjin10 marked this pull request as draft July 17, 2023 23:36
@mergify
Copy link
Contributor

mergify bot commented Jul 19, 2023

Hey @roninjin10! This PR has merge conflicts. Please fix them before continuing review.

@mergify mergify bot added the conflict label Jul 19, 2023
@mergify mergify bot added the sdk label Jul 21, 2023
@mergify
Copy link
Contributor

mergify bot commented Jul 21, 2023

Hey @roninjin10! This PR has merge conflicts. Please fix them before continuing review.

@mergify mergify bot added the conflict label Jul 21, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2023

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Aug 5, 2023
@roninjin10
Copy link
Contributor Author

Got catching up to do likely will get to this pr next week. I think by now it might "just work". If I remember correctly it was failing before because hardhat types depended on some peer deps installed by ts-node. The failures were actually good failures in the sense of typescript was correctly being conservative where before it was too loose

@tynes tynes removed the Stale label Aug 7, 2023
@tynes
Copy link
Contributor

tynes commented Aug 9, 2023

Got catching up to do likely will get to this pr next week. I think by now it might "just work". If I remember correctly it was failing before because hardhat types depended on some peer deps installed by ts-node. The failures were actually good failures in the sense of typescript was correctly being conservative where before it was too loose

thanks for thinking of this PR will, would be nice to get this in, it still throws errors for me but i haven't rebased

@refcell
Copy link
Contributor

refcell commented Aug 15, 2023

Just a bump on this PR @roninjin10

@roninjin10 roninjin10 force-pushed the 06-29-feat_Use_tsx_instead_of_ts-node branch from 167373b to 8fb9f70 Compare August 15, 2023 11:01
@mergify mergify bot removed the conflict label Aug 15, 2023
@roninjin10 roninjin10 force-pushed the 06-29-feat_Use_tsx_instead_of_ts-node branch 5 times, most recently from 15dc954 to c36c1f1 Compare August 15, 2023 11:44
@roninjin10 roninjin10 marked this pull request as ready for review August 15, 2023 12:00
@roninjin10 roninjin10 requested a review from tynes August 15, 2023 12:00
@roninjin10 roninjin10 force-pushed the 06-29-feat_Use_tsx_instead_of_ts-node branch from c36c1f1 to 47a077e Compare August 15, 2023 12:51
@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #6214 (5a214f7) into develop (c1dfb95) will decrease coverage by 0.01%.
Report is 2 commits behind head on develop.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #6214      +/-   ##
===========================================
- Coverage    44.77%   44.76%   -0.01%     
===========================================
  Files          375      375              
  Lines        29468    29476       +8     
  Branches      1688     1692       +4     
===========================================
+ Hits         13194    13195       +1     
- Misses       14832    14841       +9     
+ Partials      1442     1440       -2     
Flag Coverage Δ
bedrock-go-tests 47.77% <ø> (+<0.01%) ⬆️
cannon-go-tests 64.18% <ø> (ø)
chain-mon-tests 26.95% <ø> (ø)
common-ts-tests 26.82% <ø> (ø)
contracts-bedrock-tests ∅ <ø> (∅)
contracts-ts-tests 6.88% <ø> (ø)
core-utils-tests 44.24% <ø> (ø)
sdk-next-tests 41.75% <0.00%> (-0.22%) ⬇️
sdk-tests 41.75% <0.00%> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...ages/common-ts/src/base-service/base-service-v2.ts 9.09% <ø> (ø)
packages/sdk/tasks/finalize-withdrawal.ts 12.06% <0.00%> (-1.94%) ⬇️

... and 1 file with indirect coverage changes

@roninjin10 roninjin10 force-pushed the 06-29-feat_Use_tsx_instead_of_ts-node branch from 47a077e to 5a214f7 Compare August 15, 2023 13:32
@tynes tynes merged commit 018726c into develop Aug 15, 2023
74 checks passed
@tynes tynes deleted the 06-29-feat_Use_tsx_instead_of_ts-node branch August 15, 2023 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants