Skip to content

Replace tsup with ts-bridge - #4648

Merged
Mrtenz merged 7 commits into
mainfrom
mrtenz/ts-bridge
Sep 16, 2024
Merged

Replace tsup with ts-bridge#4648
Mrtenz merged 7 commits into
mainfrom
mrtenz/ts-bridge

Conversation

@Mrtenz

Copy link
Copy Markdown
Member

Explanation

ts-bridge finally supports project references. In this PR, I've swapped out tsup for ts-bridge everywhere.

References

Related to MetaMask/metamask-module-template#247, MetaMask/utils#182.
Closes#4333.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@socket-security

socket-securityBot commented Aug 30, 2024

Copy link
Copy Markdown

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

PackageNew capabilitiesTransitivesSizePublisher
npm/@ts-bridge/cli@0.5.1None0314 kBmrten
npm/@ts-bridge/resolver@0.1.2filesystem, unsafe0130 kBmrten

🚮 Removed packages:npm/tsup@8.2.4

View full report↗︎

Comment threadyarn.config.cjs
workspace,
'exports["."].types',
'./dist/types/index.d.ts',
'exports["."].import.types',

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that types must be above default. I don't think Yarn enforces this currently, but we could look into doing so.

],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts-bridge builds with project references if they are set in tsconfig.json by default. To build an individual package, we have to use --no-references here. I may reconsider this to make project references opt-in rather than opt-out, as that's what tsc does.

@MrtenzMrtenz mentioned this pull request Sep 11, 2024
3 tasks
Mrtenz added a commit that referenced this pull request Sep 12, 2024
## Explanation
This bumps all Snaps packages used in the core repo to the latest
version. This is necessary to unblock #4648.
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
@Mrtenz
Mrtenz marked this pull request as ready for review September 12, 2024 14:35
@Mrtenz
Mrtenz requested review from a team as code ownersSeptember 12, 2024 14:35
@Mrtenz
Mrtenz requested a review from a teamSeptember 12, 2024 14:35
Comment threadpackage.json Outdated
Comment threadyarn.config.cjs Outdated
Comment threadyarn.config.cjs Outdated

@MajorLiftMajorLiftSep 13, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would there be a way to add the same rules for something like 'exports.*.import.types'? Some core packages have additional subpaths in the exports field, and we may need to enforce that those expose dual CJS/ESM builds as well.

e.g. https://github.com/MetaMask/core/blob/main/packages/notification-services-controller/package.json

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the minimal modifications to the constraints to have a valid main entry point for now. This would certainly be possible, but I feel like it's out of scope for this PR. What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! We can take that on in a separate ticket along with the necessary fixes to those exports subfields.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a ticket here: #4699

Comment threadyarn.config.cjs Outdated

@MajorLiftMajorLift left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for your work on this, including all the amazing work leading up to this on ts-bridge.

@AugmentedModeAugmentedMode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mrtenz
Mrtenz merged commit 1d12f7e into mainSep 16, 2024
@Mrtenz
Mrtenz deleted the mrtenz/ts-bridge branch September 16, 2024 09:00
@MrtenzMrtenz mentioned this pull request Sep 16, 2024
3 tasks
@GudahttGudahtt mentioned this pull request Jul 16, 2025
4 tasks
Gudahtt added a commit that referenced this pull request Jul 17, 2025
Update the template used by the `create-package` script. The previous
template was no longer compatible with our Yarn constraints.
Here are the PRs related to these specific changes:
* #4648
* #3645
* #1390
* #3668
Gudahtt added a commit that referenced this pull request Jul 17, 2025
## Explanation
Update the template used by the `create-package` script. The previous
template was no longer compatible with our Yarn constraints.
## References
Here are the PRs related to these specific changes:
* #4648
* #3645
* #1390
* #3668
## Changelog
N/A
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [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
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
Sign up for freeto 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.

tsup's code splitting feature makes core packages difficult to debug

5 participants

@Mrtenz@GuillaumeRx@matthewwalsh0@AugmentedMode@MajorLift