-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix global add linking issue #1889
Conversation
ab8e173
to
03e6f85
Compare
I'll do a 0.17.3 today |
Conflicts: __tests__/commands/global.js
await config.init({cwd: config.globalFolder}); | ||
await config.init({ | ||
cwd: config.globalFolder, | ||
binLinks: true, |
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.
Shouldn't we take the value of config.binLinks instead of hard coding the value of binLinks to true.
What about all other option, config.init will set all other Boolean options to false, or to the default value from constants.
diff --git a/src/cli/commands/global.js b/src/cli/commands/global.js
--- a/src/cli/commands/global.js
+++ b/src/cli/commands/global.js
@@ -32,10 +32,15 @@ class GlobalAdd extends Add {
const path = require('path');
async function updateCwd(config: Config): Promise<void> {
- await config.init({
- cwd: config.globalFolder,
- binLinks: true,
- });
+ const options = {};
+ for (const key of Object.keys(config)) {
+ const val = config[key];
+ if (typeof val == 'string' || typeof val == 'boolean') {
+ options[key] = val;
+ }
+ }
+ options.cwd = config.globalFolder;
+ await config.init(options);
}
async function getBins(config: Config): Promise<Set<string>> {
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.
Shouldn't we take the value of config.binLinks instead of hard coding the value of binLinks to true.
That would be awesome but for some reason config.binLinks
is false here. Since this is a major blocker for lots of people so I decided to fix it with true
for the time being.
What about all other option, config.init will set all other Boolean options to false, or to the default value from constants.
I tried what you are trying to do but it will break some other things. For example prefix
. I have already asked @kittens about it. We might need some refactoring here.
This is odd, for me The configuration is confusing, it should take the configuration in this order
|
Summary
~/.config/yarn/global/node_modules/.bin
was not creating.Fixes #1886