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

Added arethetypeswrong to check built outputs #569

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mattpocock
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Aug 20, 2024

⚠️ No Changeset found

Latest commit: 734f695

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

"build": "npm run clean && rollup --config && mv tmp/*.js dist",
"prepack": "npm run build",
"build": "npm run clean && rollup --config && mv tmp/*.js dist && attw --pack .",
"prepublishOnly": "npm run build",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to prepublishOnly, since this only runs on publish instead of on pack.

attw --pack calls npm pack, so you end up in a nice infinite loop.

@mattpocock mattpocock mentioned this pull request Aug 20, 2024
10 tasks
Copy link
Contributor

@dmmulroy dmmulroy left a comment

Choose a reason for hiding this comment

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

Hey @mattpocock - could you explain what attw is and why it's a useful tool for library authors as context? 🙏

@mattpocock
Copy link
Contributor Author

@dmmulroy attw was built by Andrew Branch of the TS team, the doyen of modules and exports. It's extremely useful for checking if the exported types are correct in the package.json. I wanted to add it to make sure that my tsup changes weren't breaking anything.

@supermacro
Copy link
Owner

supermacro commented Sep 6, 2024

This package / pr is still not clicking with respect to the bigger picture PR of #570

In my head I am asking myself, "why do I need @arethetypeswrong/cli if we already have tsc doing typechecking that short-circuits on a typeerror".

It's extremely useful for checking if the exported types are correct in the package.json. I wanted to add it to make sure that my tsup changes weren't breaking anything.

So this makes me think that this PR is purely here to ascertain that the change from rollup --> tsup is working as expected and nothing else, correct?


Edit: Would there be value in keeping this longer term or would this just be useful in the near-term as a tool to help with a smooth transition.

@mattpocock
Copy link
Contributor Author

@supermacro

tsc and attw do different things. tsc checks that your code type checks. attw checks that other packages consuming your code can consume it. It prevents errors like mis-configuring exports.

More info in this article.

You're right, it is partially a bridging PR to ensure that tsup makes no meaningful changes.

But it does have its own utility. In the future, you may want to consider adding multiple entrypoints to neverthrow to prevent the downsides of barrel files. attw would ensure that exports would still be configured correctly.

Overall, I like as much of the user experience as possible to be testable via CI. Checking that users can consume the code feels important. But if you don't want it checked on every CI run, I can understand that.

@dmmulroy
Copy link
Contributor

dmmulroy commented Oct 9, 2024

I think that this is positive change - @supermacro and @m-shaka could we adopt this and merge it to unblock #570?

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