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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: esm only version #1825

Closed
wants to merge 8 commits into from
Closed

Conversation

pixelass
Copy link

@pixelass pixelass commented May 26, 2023

This Pull Request attpempts to make probot esm compatible.

The current implementation creates a BREAKING CHANGE as it migrates probot to esm-only

The process is as follows

  • Local prototype to measure the required work
  • Make sure all tests pass
  • Propose esm-only as new major

Local test output

馃挕 It seems that only the test setup needs some tweaking.
The app seems to work as intended.

Test Suites: 6 failed, 10 passed, 16 total
Tests:       10 failed, 2 skipped, 108 passed, 120 total
Snapshots:   1 failed, 5 passed, 6 total
Time:        7.056 s
Ran all test suites.

closes: #1684

switch update-dotenv back to npm package
sort imports
run prettier
update jest to latest
run esm compatible tests
@welcome
Copy link

welcome bot commented May 26, 2023

Thanks for opening this pull request! A contributor should be by to give feedback soon. In the meantime, please check out the contributing guidelines and explore other ways you can get involved.

@request-info
Copy link

request-info bot commented May 26, 2023

Thanks for opening this, but we'd appreciate a little more information. Could you update it with more details?

make previously removed version check esm compatible
@travi
Copy link
Member

travi commented Jun 23, 2023

馃挕 It seems that only the test setup needs some tweaking.
The app seems to work as intended.

i'm curious if the test complications are simply related to jest having trouble within an esm context. related: jestjs/jest#9430

i've had a good experience moving projects from jest to vitest when converting to esm and it is api compatible with jest, so the test changes should be minimal. would a switch between test frameworks be a change that you'd be open to try as part of this effort, @pixelass?

Copy link
Member

@travi travi left a comment

Choose a reason for hiding this comment

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

thanks for your efforts with this @pixelass. i added a few minor comments based on a first-pass review, but looks like this is headed in a great direction.

@@ -1,3 +1,3 @@
#!/usr/bin/env node

require("../lib/bin/probot-receive");
import "../lib/bin/probot-recieve.js";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import "../lib/bin/probot-recieve.js";
import "../lib/bin/probot-receive.js";

i assume this change was accidental since the referenced file is still spelled the previous way, without the typo

pkg = require(path.join(process.cwd(), "package.json"));
pkg = (
await import(path.join(process.cwd(), "package.json"), {
assert: { type: "json" },
Copy link
Member

Choose a reason for hiding this comment

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

import assertions are still considered experimental, even in v20, so i'm curious if we need a different approach with this. does typescript happen to handle this differently somehow?


const pkg = require("../../package");
const pkg = JSON.parse(
fs.readFileSync(path.resolve(__dirname, "../../package.json"), {
Copy link
Member

Choose a reason for hiding this comment

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

this might be the safer option for loading the package file, but wherever we land, it would be best to be consistent

A1yBjz3q2nX+zthk+GLXrJQkYOnIk1ECIHfeFV8TWm5gej1LxZquBTA5pINoqDVq
NKZSuZEHqGEFAiB6EDrxkovq8SYGhIQsJeqkTMO8n94xhMRZlFmIQDokEQIgAq5U
r1UQNnUExRh7ZT0kFbMfO9jKYZVlQdCL9Dn93vo=
MIIJKAIBAAKCAgEAu0E+tR6wfOAJZ4lASzRUmvorCgbI5nQyvZl3WLu6ko2pcEnq
Copy link
Member

Choose a reason for hiding this comment

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

can you clarify the goal of updating this key?

Copy link
Member

Choose a reason for hiding this comment

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

The key is copied from the other PR because a new format was required. #1821

ah. got it. thanks for the link to that other PR. looks like i need to get up to speed with those details as well

@pixelass
Copy link
Author

pixelass commented Jun 24, 2023

Thanks for taking a look. I'll adjust based on your comments. The key is copied from the other PR because a new format was required. #1821

@wolfy1339
Copy link
Collaborator

Hi @pixelass woud you be interested in rebasing this off the beta branch, and continuing your work?

@pixelass
Copy link
Author

pixelass commented Nov 12, 2023

Hi @pixelass woud you be interested in rebasing this off the beta branch, and continuing your work?

Hi, sorry for the silence. I've been very busy lately.
I won't have time to move all tests to vitest since

  1. I'm on a tight schedule
  2. I don't know vitest
  3. Vite is in general not my stack

I can supoport with Jest, ESM and latest/best practices though and am happy to contribute.

@wolfy1339
Copy link
Collaborator

No need to move tests over to vitest.

Jest is completely fine

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

Our beta branch now has nearly all improvements here, and #1921 and #1922 implement full ESM.

@wolfy1339
Copy link
Collaborator

Closing in favour of #1922

@wolfy1339 wolfy1339 closed this Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ESM apps
4 participants