-
Notifications
You must be signed in to change notification settings - Fork 29
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: use ES modules #1007
feat: use ES modules #1007
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked that all files are correctly imported with seeing no matches for from '\./.*[^js]';
, and runs correctly. thanks!
@@ -1,10 +1,10 @@ | |||
#!/usr/bin/env node | |||
|
|||
require = require('esm')(module); | |||
(async function() { | |||
(async function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about the history but this likely was an async iife to ensure all errors are caught. Not sure that's needed really tbh. Can be changed in a separate PR and release to be just a regular sync module maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm easy with however you want to do it. I was just trying to keep changes to a minimum!
.mockImplementation( | ||
({ formatPullRequestTitle, nextVersion, releaseType }) => { | ||
return [ | ||
formatPullRequestTitle({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change by the way? was the formatting not needed in the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if/how this was ever working!
In createPullRequest.js
formatPullRequestTitle
is never passed to formatPullRequestMessage
and so formatPullRequestTitle
is undefined
and not able to be called. The relevant bit is:
const title = formatPullRequestTitle({ version: nextVersion, releaseType });
const message = formatPullRequestMessage({
repo,
repoURL,
baseBranch,
stagingBranch,
destinationBranch: baseBranch,
releaseType,
diffURL,
currentVersion,
nextVersion,
publishCommands,
title,
});
It doesn't make any sense that it was ever working.
@@ -69,15 +69,8 @@ describe('createPullRequest', () => { | |||
.mockImplementation(({ version, type }) => `# v${version} (${type})`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should actually be:
.mockImplementation(({ version, releaseType }) => `# v${version} (${releaseType})`);
Fixes #1006
BREAKING CHANGE: code is in in ES Modules now and earliest node support is 18