-
Notifications
You must be signed in to change notification settings - Fork 30
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
Confirm we're using Corepack in preinstall hook #9791
Conversation
Size Change: 0 B Total Size: 730 kB ℹ️ View Unchanged
|
Rebasing on/merging |
941eb04
to
95fdf9c
Compare
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.
Very elegant and helpful messages.
Could we make it clearer that the leading dash is not part of the command to run?
95fdf9c
to
b330a2f
Compare
updated the logging, and added a screen shot to the description |
8fcc54f
to
5e4bb5b
Compare
5e4bb5b
to
b15a422
Compare
and provide some guidance if not Co-authored-by: Charlotte Emms <[email protected]>
b15a422
to
717ea8f
Compare
I'm not having much joy with this setup. Can anyone think what might be happening?
|
Hi @georgeblahblah - I'll give you a shout |
if (process.env.npm_execpath?.includes('node_modules')) | ||
command(`npm uninstall -g ${packageManager}`); | ||
if (process.env.npm_execpath?.includes('brew')) | ||
command(`brew uninstall ${packageManager}`); |
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.
Could this cause confusion for developers who work on other projects other than dotcom-rendering? If you uninstall the global package manager then it would be removed for other projects that the user might be relying on.
When I ran this on dotcom-rendering I then also had to run corepack enable
in the commercial repo, I assume because it was on a different node version (?).
Perhaps some comms might help to explain that once you've removed the global package manager you (might) need to run corepack enable
in all other repos that use the same package manager?
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.
yeah you'd need to run it for each version of node you use. i'll raise a PR adding a note to that effect to the message.
ideally this would be in the recommendations repo too but i'd like to confirm it works well enough in DCR before getting to that next stage
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.
What does this change?
preinstall
script (@cemms1's idea) to make sure the current installation is being done by a corepack-managed package managerpreinstall
script from wherever you runyarn
Why?
it turns out a lot of people manually run
yarn
from the root, rather than relying on themakefile
to manage deps for them. this means simply checking in themakefile
is not enough.the preinstall hook will catch any
yarn
call, whatever its origin.also, some earlier versions of
yarn
are not overridden by runningcorepack enable
, which means that the current advice (to just enable corepack) does not help people with affected versions of yarn already globally installed.addresses issue that arose after merging #9466...
Screenshots