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

Refactoring of the CLI interface #291

Merged
merged 6 commits into from
Aug 28, 2023
Merged

Conversation

arcanis
Copy link
Contributor

@arcanis arcanis commented Aug 3, 2023

This PR is the first step towards implementing the changes from #274

  • Implements corepack install -g [--all] ...
  • Implements corepack install
  • Implements corepack use [pattern]
  • Implements corepack up
  • Implements corepack pack ...

I added tests for use and up since those are new; install and pack should already covered by the existing tests, which I migrated from prepare / hydrate to the new commands.

The old commands are still there, but I removed their help messages so they don't appear in corepack -h anymore.

@arcanis
Copy link
Contributor Author

arcanis commented Aug 4, 2023

No idea why Node.js 20.0 seems unable to use the Nock files from 16.x, but only on Windows 🤔 I think I'll just remove the 16.x tests, since it's EOL on Sep 11 anyway ...

Edit: Actually it worked after a restart - I think a timeout caused some requests to not run, which messed with how Nock answers the http requests.

@styfle
Copy link
Member

styfle commented Aug 4, 2023

The old commands are still there

Thanks for keeping those! That will help as we migrate support for multiple versions of corepack 👍

Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

Can you please update the doc in the README?

sources/commands/Up.ts Outdated Show resolved Hide resolved
sources/commands/Use.ts Show resolved Hide resolved
tests/Up.test.ts Outdated Show resolved Hide resolved
? stream.pipe(createHash(build[0]))
: null;

const hash = stream.pipe(createHash(build[0] ?? `sha256`));
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest we use sha224 because it's shorter

Suggested change
const hash = stream.pipe(createHash(build[0] ?? `sha256`));
const hash = stream.pipe(createHash(build[0] ?? `sha224`));

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'd have a small preference for sha256 because it's more well-known. I suspect most people seeing sha224 will wonder whether it's less secure and perhaps document themselves about it. sha256 seems less friction for users.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's easy to change if folks complain about it, but I suspect most folks won't pay attention to it – unless they're into software security, in which case I have the feeling they'd know what sha224 is. Until anyone complains sha224 seems a better choice for me, no strong feelings though

Copy link
Member

Choose a reason for hiding this comment

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

sha224 seems a better choice for me

Can you explain why?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because it's shorter, and more than strong enough for what that hash is used for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My intuition is that the extra characters won't change a lot the experience, but sha256 is more well-known. I kept it as-is for this iteration.

sources/corepackUtils.ts Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@arcanis
Copy link
Contributor Author

arcanis commented Aug 26, 2023

Should be good to merge.

@arcanis arcanis merged commit fe3e5cd into main Aug 28, 2023
@arcanis arcanis deleted the mael/corepack-cli-refactoring branch August 28, 2023 20:01
nix6839 added a commit to nix6839/dotfiles-macos that referenced this pull request Aug 30, 2023
aduh95 added a commit to nodejs/node that referenced this pull request Sep 16, 2023
PR-URL: #49486
Refs: nodejs/corepack#291
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
ruyadorno pushed a commit to nodejs/node that referenced this pull request Sep 28, 2023
PR-URL: #49486
Refs: nodejs/corepack#291
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
PR-URL: nodejs#49486
Refs: nodejs/corepack#291
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
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.

3 participants