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(env): allow installing and removing multiple NodeJS versions at once #7155

Merged
merged 7 commits into from
Oct 5, 2023

Conversation

ekwoka
Copy link
Contributor

@ekwoka ekwoka commented Oct 1, 2023

This PR:

  • expands env rm to accept multiple versions, removing all of them at once
  • introduces env add to allow installing multiple versions at once without setting them as default (like in the case of env use)

Some refactoring to dedupe code. I could go further with that, but I was trying to preserve as much of the existing structure and style as possible along the way. Not sure how opinionated the team is on that structure, or if a more aggressive sweep could make sense

@ekwoka ekwoka requested a review from zkochan as a code owner October 1, 2023 13:34
@welcome
Copy link

welcome bot commented Oct 1, 2023

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

env/plugin-commands-env/src/env.ts Outdated Show resolved Hide resolved
env/plugin-commands-env/src/envAdd.ts Outdated Show resolved Hide resolved
Comment on lines 13 to 17
const message = await downloadNodeVersion(opts, version)
if (message instanceof Error) {
globalWarn(message.message)
errors.push(message)
}
Copy link
Member

Choose a reason for hiding this comment

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

I think it will make more sense to throw an error in downloadNodeVersion and catch it here. Also less code in envUse

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not partial to exceptions as control flow...

Really bypasses type safety.

But that is already what a lot of this code is doing...

😢

Copy link
Member

Choose a reason for hiding this comment

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

Then return null instead of an error.

@zkochan zkochan changed the title feat(env): Allow installing and removing multiple NodeJS versions at once feat(env): allow installing and removing multiple NodeJS versions at once Oct 5, 2023
@zkochan zkochan merged commit 2e69157 into pnpm:main Oct 5, 2023
6 of 8 checks passed
@welcome
Copy link

welcome bot commented Oct 5, 2023

Congrats on merging your first pull request! 🎉🎉🎉

@ekwoka
Copy link
Contributor Author

ekwoka commented Oct 5, 2023

Thanks for taking the time to wrap it up.

I have other changes I want to make and this first PR really helped get a better feel for the style you'd want.

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.

None yet

2 participants