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

fix(build): switch to esbuild and tsc instead of pika #644

Merged
merged 13 commits into from
Jun 7, 2023

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 Any dependency, housekeeping, and clean up Issue or PR label Jun 5, 2023
nickfloyd
nickfloyd previously approved these changes Jun 5, 2023
Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

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

❤️

@wolfy1339
Copy link
Member

Make sure to explicitly mark every type import and export.

@kfcampbell kfcampbell changed the title Switch to esbuild and tsc instead of pika fix(build): switch to esbuild and tsc instead of pika Jun 5, 2023
@wolfy1339
Copy link
Member

I don't think it's the best idea to move @octokit/types to devDependencies.

There was a reasoning of putting it in regular dependencies

If it's not in regular dependencies, then people using this package may not have types in their IDE

@kfcampbell
Copy link
Member Author

Explicit imports/exports and the previously discussed --verbatimModuleSyntax flag have been added. I'm not quite sure what's going on with the Node 14 errors, though I can reproduce them locally.

Copy link
Member

@wolfy1339 wolfy1339 left a comment

Choose a reason for hiding this comment

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

Octokit is only being used as a type here

src/endpoints-to-methods.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
@wolfy1339
Copy link
Member

I think I see the problem, the problem is the lockfile here. It's using version 3 which isn't backwards compatible with older versions of npm

Can you regenerate it with Node v14?

kfcampbell and others added 4 commits June 6, 2023 12:24
Co-authored-by: wolfy1339 <4595477+wolfy1339@users.noreply.github.com>
Co-authored-by: wolfy1339 <4595477+wolfy1339@users.noreply.github.com>
@kfcampbell
Copy link
Member Author

Thanks for the tip! Done.

wolfy1339
wolfy1339 previously approved these changes Jun 6, 2023
@kfcampbell
Copy link
Member Author

@wolfy1339 I've updated this PR with the latest version of octokit/tsconfig. Please take another look when you get a moment!

package.json Outdated Show resolved Hide resolved
Co-authored-by: wolfy1339 <4595477+wolfy1339@users.noreply.github.com>
@kfcampbell kfcampbell merged commit 917af29 into main Jun 7, 2023
@kfcampbell kfcampbell deleted the switch-to-esbuild branch June 7, 2023 22:14
@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2023

🎉 This PR is included in version 7.1.3 🎉

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 Any dependency, housekeeping, and clean up Issue or PR
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants