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 #159

Merged
merged 5 commits into from Jun 5, 2023
Merged

fix(build): switch to esbuild #159

merged 5 commits into from Jun 5, 2023

Conversation

wolfy1339
Copy link
Member

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

@wolfy1339 wolfy1339 added the Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR label Jun 3, 2023
@ghost ghost added this to Maintenance in JS Jun 3, 2023
@wolfy1339
Copy link
Member Author

I'm not sure why the browser tests are failing...

Error: Evaluation failed: ReferenceError: sign is not defined
    at pptr://__puppeteer_evaluation_script__:2:23
    at ExecutionContext._ExecutionContext_evaluate (/home/runner/work/webhooks-methods.js/webhooks-methods.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:258:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (/home/runner/work/webhooks-methods.js/webhooks-methods.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js:146:16)
    at async runTests (/home/runner/work/webhooks-methods.js/webhooks-methods.js/test/browser-test.js:18:33)

They are working fine on main, and aren't working in the lockFile update either #158

gr2m
gr2m previously approved these changes Jun 3, 2023
@gr2m
Copy link
Contributor

gr2m commented Jun 3, 2023

I'm not sure why the browser tests are failing...

I don't know either, but I was able to reproduce it. Sorry I don't know out of what what might be the cause.

When I paste the contents of pkg/dist-web/index.js into a browser console (except the export lines at the end) it all seems to work correctly

@gr2m
Copy link
Contributor

gr2m commented Jun 3, 2023

got it 1a1d089

I wonder if there is a better way to do this, it will likely break again. We remove the exports because we don't want to import the file from another page, instead we want to evaluate all the code directly in the current blank page and then run our assertions.

@wolfy1339 wolfy1339 linked an issue Jun 4, 2023 that may be closed by this pull request
@gr2m
Copy link
Contributor

gr2m commented Jun 5, 2023

aren't working in the lockFile update either #158

That is because puppeteer is no longer compatible with Node 14

screenshot of error

@wolfy1339 wolfy1339 merged commit 3d307b7 into main Jun 5, 2023
9 checks passed
@wolfy1339 wolfy1339 deleted the esbuild branch June 5, 2023 21:39
@github-actions
Copy link

github-actions bot commented Jun 5, 2023

🎉 This PR is included in version 3.0.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
JS
  
Maintenance
Development

Successfully merging this pull request may close these issues.

"module" entry points to web bundle
2 participants