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

chore: Prepare code for ESM #1921

Merged
merged 5 commits into from
Nov 20, 2023
Merged

chore: Prepare code for ESM #1921

merged 5 commits into from
Nov 20, 2023

Conversation

AaronDewes
Copy link
Member

This prepares the code to compile properly in ESM to keep the code changes for full ESM later minimal. This does not convert Probot to ESM.

This prepares the code to compile properly in ESM to keep the code changes for full ESM later minimal.
This does not convert Probot to ESM.
@AaronDewes AaronDewes requested a review from a team as a code owner November 16, 2023 20:37
@AaronDewes
Copy link
Member Author

Not sure about the test failures, I'll still have to look at that (These seem to happen randomly)

@AaronDewes
Copy link
Member Author

Oh, smee.io seems to be down, and that causes the tests to hang. @gr2m Are you maintaining this or is it someone else?

@AaronDewes AaronDewes mentioned this pull request Nov 16, 2023
@AaronDewes
Copy link
Member Author

Oh, smee.io seems to be down, and that causes the tests to hang. @gr2m Are you maintaining this or is it someone else?

Apparently, it works, but seems to reply incredibly slow for me. If you're maintaining it: Is it my internet connection (But actions seem to be affected too), DDoS, high load or another issue?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 16, 2023

Annoying. Currently refactoring the smee client.

@gr2m
Copy link
Contributor

gr2m commented Nov 16, 2023

smee.io is a big headache, unfortunately 😭 GitHub now has webhooks via websockets in beta: https://github.blog/changelog/2022-11-16-webhook-forwarding-in-the-github-cli-public-beta/ and I built a library that made it possible to use it for GitHub App development: https://github.com/gr2m/github-app-webhook-relay/

My plan was to use with Probot and deprecate smee.io. However I recently learned that GitHub is considering to deprecate webhook forwarding due to low usage and high maintenance overhead.

I'm not sure what to do. I don't know what the timeline is to deprecate it, if it will be replaced with something else, etc. But the situation with smee is not much better, and I think we should probably use the local webhook relay anyway. At least we can gather some user feedback that way to inform a decision within github what to do about them.

An alternative would be to create a replacement service for smee.io 🤷🏼

GitHub
Receive webhooks from a GitHub repository using websockets amended with an installation key for usage with GitHub Apps - GitHub - gr2m/github-app-webhook-relay: Receive webhooks from a GitHub repos...

@AaronDewes
Copy link
Member Author

AFAIK, GitHub themselves use smee.io in their automated tests (There is a certain smee.io endpoint hardcoded which is still getting requests), so I guess they also don't want that to be deprecated...

@AaronDewes AaronDewes mentioned this pull request Nov 17, 2023
3 tasks
@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 17, 2023

I guess smee.io could be rewritten using faster frameworks like fastify and maybe having optimizations in redis, like using enableAutoPipelining.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 17, 2023

@gr2m

I refactored the smee client. I can also have a look in smee.io code and try to improve the performance.

But i would only do it, if it has a chance to get merged. I somehow feel that improving smee.io could be rejected...

@gr2m
Copy link
Contributor

gr2m commented Nov 17, 2023

I've inquired about the latest state of smee.io and will keep you posted.

import type { PushEvent } from "@octokit/webhooks-types";

const pushEventPayload = (
WebhookExamples.filter(
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's going on here? Doesn't typescript pick up the index.d.ts?

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't when ESM mode is enabled. Probably because the main file of @octokit/webhook-types is in JSON, and JSON imports in ESM aren't supported yet. They work at runtime, because Node.js has backwards-compatibility with non-ESM packages.

I assume this is a bug in TypeScript.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 18, 2023

I personally am not convinced by ESM and that we have to name the import files to be .js suffixed.

At fastify our modules are able to be required and imported. So i would wish we could do this for probot too.

I am not blocking it, but I am not able to approve it, because I have avoided esm till now :))).

But i am looking on this PR interest ;)

Copy link
Contributor

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

I think it's odd, too. I'm all in on ESM and hope we can conclude the transition of @octokit to ESM, but I'm not optimistic that this will happen anytime soon.

But I'm also not opposed to the change, if we change our preference, we can change it again, no big deal.

@AaronDewes AaronDewes merged commit f5ee0de into beta Nov 20, 2023
19 checks passed
@AaronDewes AaronDewes deleted the esm-ready branch November 20, 2023 05:28
Copy link

🎉 This PR is included in version 13.0.0-beta.12 🎉

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants