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

Switch to esbuild and tsc instead of pika #603

Merged
merged 6 commits into from
Jun 7, 2023
Merged

Conversation

kfcampbell
Copy link
Member

Replicating octokit/request.js#584 to another repo.


Pika has been deprecated for a while now, and the project has now been archived, and because of that the released npm package is missing most of the files generated by the build step.

Uses esbuild to transpile the TS source code into an ESM source, NodeJs bundle, and a browser bundle

Uses the TypeScript compiler to generate the types.

Behavior

Before the change?

  • Uses pika for the build system
  • The released npm package is missing most of the files generated by the build step. dist-node, dist-types, dist-web... even though they are generated correctly.

After the change?

  • Uses esbuild to generate the JS bundles
  • Uses the TypeScript compiler to generate the type definitions
  • The correct file matching patterns are used so we publish all the necessary files again.

Additional info

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Added the appropriate label for the given change

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes (Please add the Type: Breaking change label)
  • No

If Yes, what's the impact:

  • N/A

Pull request type

Please add the corresponding label for change this PR introduces:

  • Bugfix: Type: Bug
  • Dependencies/code cleanup: Type: Maintenance

@kfcampbell kfcampbell added the Type: Maintenance Tests, Refactorings, Automation, etc label Jun 5, 2023
@wolfy1339
Copy link
Member

Don't forget to explicitly mark type imports and exports.

Whenever an imported value, that is also JS code, is only used as a type, it should be imported as a type, to make sure that it doesn't show up in the build output.

All typescript types (except for enum) need to be imported using type imports, and exports need to use the type export syntax.

@kfcampbell
Copy link
Member Author

@wolfy1339 I've updated this PR to correctly import types, bumped to the latest version of octokit/tsconfig, and fixed the merge conflict! Hopefully this is good to go now.

@kfcampbell
Copy link
Member Author

Hmm...locally I'm seeing:

image

and:

image

Even after many reloads here, I'm not seeing the new commits:

image

I wonder if we're having issues.

@kfcampbell
Copy link
Member Author

Yep, looks like that's it:

image

@kfcampbell
Copy link
Member Author

Looks like we're all good now!

scripts/build.mjs Outdated Show resolved Hide resolved
Co-authored-by: wolfy1339 <4595477+wolfy1339@users.noreply.github.com>
wolfy1339
wolfy1339 previously approved these changes Jun 7, 2023
package.json Outdated Show resolved Hide resolved
Co-authored-by: wolfy1339 <4595477+wolfy1339@users.noreply.github.com>
@wolfy1339 wolfy1339 merged commit 52f74d8 into main Jun 7, 2023
@wolfy1339 wolfy1339 deleted the switch-to-esbuild branch June 7, 2023 22:16
@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2023

🎉 This PR is included in version 6.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Type: Maintenance Tests, Refactorings, Automation, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants