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

Issue 1394 adding no bin links option #4036

Conversation

tdfranklin
Copy link

Sorry about so many commit's. I forgot to set autocrlf to false (I'm working in Windows) so went back and set that which looks like it changed the whole file to fix the line endings. I'll just note below what lines I actually added code to for your review:

Line 79 - added option for --no-bin-links
Line 163 - passed program.binLinks to createApp()
Line 167 - added binLinks as arg to createApp()
Line 228 - passed binLinks to run()
Line 249 - added binLinks as arg to install()
Lines 289-291 - if statement to push --no-bin-links to npm args
Line 311 - added binLinks as arg to run()
Line 342 - passed binLinks to install()

I added a few console.log's when testing to make sure argument was only being passed when it was called. Running create-react-app my-app should have no changes. You would need to run create-react-app my-app --use-npm --no-bin-links which should then pass the --no-bin-links command to npm. When I tested those flags, the process completed without any errors.

Please let me know if there are any further changes you would like me to make or if I did not do something correctly. Thank you!

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@iansu
Copy link
Contributor

iansu commented Feb 17, 2018

The diffs looked fine until your last commit. Please change the line endings back or revert your last commit so we can review this properly.

@tdfranklin tdfranklin force-pushed the issue-1394-adding-no-bin-links-option branch from 7884905 to 3ab2e86 Compare February 17, 2018 01:43
@tdfranklin
Copy link
Author

tdfranklin commented Feb 17, 2018

@iansu
Ok, I just removed the last commit so hopefully that resolves the issue!

Edit
Yay! Looks like CI tests passed! I'm really sorry about that. Hopefully all is resolved now!

@@ -275,6 +286,10 @@ function install(root, useYarn, dependencies, verbose, isOnline) {
args.push('--verbose');
}

if (binLinks === false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this conditon. Should we not be checking that the binLinks option was passed before adding the argument?

Copy link
Author

Choose a reason for hiding this comment

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

Hey @bondz !

Great question! I was trying to follow the same pattern that you use for --use-npm and --verbose, so I was passing the option down the same way that they were. The reason for checking for it to be false is because of the way commander checks args; if any arg is passed with the --no flag, it will set that process to false by default.

So the way it was requested, it looks like the request was to be able to pass an option to create-react-app for --no-bin-links. So if that option is passed, then it will set process.binLinks to false (which is why I specifically checked for it to be false).

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, okay. I understand now. Thanks for clarifying.

Copy link
Author

Choose a reason for hiding this comment

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

No problem! Just let me know if I can help or explain anything else!

@bondz
Copy link
Contributor

bondz commented Feb 18, 2018

What happens if someone specifies --no-bin-links without --use-npm? Should CRA default to use npm or issue a warning?

@tdfranklin
Copy link
Author

@bondz

Another great question! And one I was going to mention myself... Unless I'm mistaken, if someone passes --no-bin-links without also passing --use-npm, then nothing will happen as that check will never happen (since it appears to me that yarn is used unless the --use-npm flag is specifically passed). I know the original request is for the ability run the command create-react-app my-app --no-bin-links, so I could easily add an additional if statement to say that if it was passed to set useNpm to true, but I didn't want to add that functionality without it being requested. As it stands now, if both --use-npm AND --no-bin-links are not passed, then it should have no effect.

If you would like me to change it to use NPM if that option is passed, I'll be glad to make that change!

@bondz
Copy link
Contributor

bondz commented Feb 18, 2018

@tdfranklin I suppose if yarn is used, users wouldn't run into the problem caused by bin links in the first place. I'll defer to the maintainers for what the default behaviour should be but this works, thanks.

@iansu
Copy link
Contributor

iansu commented Feb 20, 2018

--no-bin-links is a valid option for yarn as well as npm so we should pass it in both cases.

@tdfranklin
Copy link
Author

@iansu
Sure thing! I'll get that updated ASAP. One quick question, just to make sure I'm adding in the correct place. Would you just want to push the arg to yarnpkg the way I added it to NPM right below that or is there another place you want to push it to?

@iansu
Copy link
Contributor

iansu commented Feb 20, 2018

I looks like it will apply to both currently. It determines which command to use above and then the --no-bin-links flag gets added afterwards. Just test it with and without the --use-npm flag to make sure it works.

@tdfranklin
Copy link
Author

@iansu
Yes, you are correct! Just tested with and without --use-npm and it appears to be working for me.

@Timer Timer closed this Sep 26, 2018
@Timer Timer reopened this Sep 26, 2018
@gaearon gaearon closed this Nov 1, 2018
@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants