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

feat: migrate to ESM #968

Merged
merged 5 commits into from
Feb 14, 2024
Merged

feat: migrate to ESM #968

merged 5 commits into from
Feb 14, 2024

Conversation

wolfy1339
Copy link
Member

BREAKING CHANGE: Migrate to ESM builds

@wolfy1339 wolfy1339 added Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR Type: Breaking change Used to note any change that requires a major version bump labels Feb 11, 2024
Copy link
Contributor

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@@ -8,6 +8,9 @@
}
},
"compilerOptions": {
"lib": ["ESNext"],
Copy link
Member Author

Choose a reason for hiding this comment

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

These can be moved to @octokit/tsconfig later on

@@ -43,14 +44,13 @@
"@octokit/request-error": "^5.0.0",
"@octokit/webhooks-methods": "^4.0.0",
"@wolfy1339/openapi-webhooks-types": "5.1.3",
"aggregate-error": "^3.1.0"
"aggregate-error": "^5.0.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

While AggregateError was introduced natively in NodeJS v15, it isn't generic. So the types cannot be extended to use our custom error

@@ -75,20 +76,3 @@ export interface WebhookEventHandlerError<TTransformed = unknown>
? EmitterWebhookEvent
: EmitterWebhookEvent & TTransformed;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

The types were fixed in version 3.0.1 and these are out of date versus v5 of aggregate-error

@@ -91,12 +91,12 @@ describe("when a handler throws an error", () => {
} catch (error: any) {
expect(error.message).toMatch(/oops/);

const errors = Array.from(error);
const errors = Array.from(error.errors);
Copy link
Member Author

Choose a reason for hiding this comment

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

The AggregateError class doesn't extend Iterable<T> anymore, you have to use the .errors property

There is currently a bug in ts-node where it completely ignores the `module` and `moduleResolution` options
kulshekhar/ts-jest#4198
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.

All of this looks good @wolfy1339 - thank you for pushing this forward ❤️. Just a clarifying question - are you planning a follow along set of changes in octokit.js and app.js for imports and such since those are still cjs modules?

@wolfy1339
Copy link
Member Author

Yes, I will be doing the other modules as well.

@wolfy1339 wolfy1339 merged commit 5518092 into beta Feb 14, 2024
3 checks passed
@wolfy1339 wolfy1339 deleted the esm branch February 14, 2024 13:58
Copy link
Contributor

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

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 on @beta Type: Breaking change Used to note any change that requires a major version bump 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.

2 participants