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

Option to enable corepack #651

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

SayakMukhopadhyay
Copy link

Description:
Adds the corepack option, which if true will run corepack enable to enable corepack. This option is by default false which ensures that there is no breaking change. Moreover, we can use a string of package manager names in place of true which will indicate to run corepack enable <string of package manager names>.

Related issue:
Closes #531

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@SayakMukhopadhyay SayakMukhopadhyay requested a review from a team as a code owner December 26, 2022 17:17
Copy link

@beeequeue beeequeue left a comment

Choose a reason for hiding this comment

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

Looks good to me, no bad changes from my branch 😎

@markandrus
Copy link

This worked perfectly on my self-hosted runner 👍 Thanks!

action.yml Outdated Show resolved Hide resolved
docs/advanced-usage.md Outdated Show resolved Hide resolved
docs/advanced-usage.md Outdated Show resolved Hide resolved
src/installer.ts Outdated Show resolved Hide resolved
Co-authored-by: Steven <steven@ceriously.com>
@SayakMukhopadhyay SayakMukhopadhyay requested a review from a team as a code owner January 17, 2023 08:44
@SayakMukhopadhyay
Copy link
Author

SayakMukhopadhyay commented Jan 17, 2023

Seems like there are merge conflicts so I will rebase. Hopefully this gets accepted soon.

EDIT: wait, the code has changed significantly. The installer.ts has been removed. Ugh, I will need to rewrite this huh?

@amacneil
Copy link

👍 this would be very helpful

@yarinsa
Copy link

yarinsa commented Apr 4, 2023

Would be amazing if that was merged :)

@SayakMukhopadhyay
Copy link
Author

Seems like I will need to rewrite this pr since the codebase has changed significantly. Since no maintainer is responding, I don't know if I should even rework my code.

@yarinsa
Copy link

yarinsa commented Apr 4, 2023

Seems like I will need to rewrite this pr since the codebase has changed significantly. Since no maintainer is responding, I don't know if I should even rework my code.

Maybe @DanRigby from the team can help us?

@neolectron
Copy link

works like a charm on my self-host, thanks !

Copy link

@styfle styfle left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@SayakMukhopadhyay
Copy link
Author

@styfle the PR has merge conflicts since setup-node had an update. Will you be able to merge the PR if I fix these issues?

@styfle
Copy link

styfle commented Aug 1, 2023

@SayakMukhopadhyay I don't have permission.

But the merge conflicts will need to be fixed before anyone can merge.

I also posted in #531 to get more feedback.

@SayakMukhopadhyay
Copy link
Author

@styfle I don't want to put the effort for rewriting the PR unless I get some confirmation from the maintainers that they intend to accept this.

@brianespinosa
Copy link

@SayakMukhopadhyay I may have some time this weekend to go through and rework your solution to match how the code has been restructured. Since you already have some good tests and a reasonable API, I plan on forking your branch and doing the work from there. I can submit a PR back to your branch if you'd like so we can leave this PR open.

@neolectron
Copy link

Thanks @brianespinosa , if in the end it turns out you have less time that planned, I would eventually like to help. Kind regards.

@brianespinosa
Copy link

@neolectron my concern here is that I have not heard from the initial author of this PR, so I am not sure forking the fork and submitting a PR back to the fork is the right path as that means we are waiting on action from the initial author, plus hoping the core maintainers actually decide to to anything with this (they have been silent so far).

I suspect nothing will ever happen with this as I have seen multiple folks try to get a thumbs up or down from a maintainer and nothing... so I think I would be wasting my time.

If you wanted to take a shot at this, I would fork this branch that has great testing from @SayakMukhopadhyay and use that testing to validate the refactor, then submit a new PR. Good luck!

@neolectron
Copy link

Ok thank you, I will make a new PR and take a shot at this.

@SayakMukhopadhyay
Copy link
Author

@brianespinosa @neolectron I would be happy for people to upgrade my PR to work with the latest codebase. Unfortunately I don't have the bandwidth right now to work on this. I might get some time on my hands in a couple of weeks and if nothing comes off till then, I will look into updating.

@JP250552 JP250552 mentioned this pull request Nov 21, 2023
2 tasks
@JP250552
Copy link

New PR updated with main branch - #901

@anonrig
Copy link

anonrig commented Dec 20, 2023

Is there a blocker for this PR?


export async function enableCorepack(input: string): Promise<void> {
let corepackArgs = ['enable'];
if (input.length > 0 && input !== 'false') {
Copy link
Contributor

Choose a reason for hiding this comment

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

It is enough to check if (input.length && input !== 'false')

@@ -604,3 +605,16 @@ export function parseNodeVersionFile(contents: string): string {
function isLatestSyntax(versionSpec): boolean {
return ['current', 'latest', 'node'].includes(versionSpec);
}

export async function enableCorepack(input: string): Promise<void> {
let corepackArgs = ['enable'];
Copy link
Contributor

Choose a reason for hiding this comment

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

It is unnecessary to initialize this variable before the if condition.

const packageManagers = input.split(' ');
corepackArgs.push(...packageManagers);
}
await exec.getExecOutput('corepack', corepackArgs, {
Copy link
Contributor

Choose a reason for hiding this comment

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

please, use getCommandOutput or getCommandOutputNotEmpty instead of directly calling exec.getExecOutput

@@ -49,6 +49,9 @@ export async function run() {
auth.configAuthentication(registryUrl, alwaysAuth);
}

const corepack = core.getInput('corepack') || 'false';
Copy link
Contributor

Choose a reason for hiding this comment

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

In order the input to be recognized it must be defined in action.yml

@dsame
Copy link
Contributor

dsame commented Dec 20, 2023

Hi @SayakMukhopadhyay, I've reviewed the PR but i am not ready to approve it, mainly because of it lacks e2e tests. Moreover, i added few changes requests which must be resolved prior to further actions.

@dsame dsame self-assigned this Dec 20, 2023
@JP250552
Copy link

JP250552 commented Feb 6, 2024

@dsame Thank you for the review.

This PR has been abandoned and I have opened a newer one here - #901

I have applied the changes you requested in this PR. Would you be able to take a look?

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.

Corepack Support