-
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: Better npm_config_argv emulation #4479
Conversation
**Summary** Fixes #2226. Better emulates `npm_config_argv` by passing `process.argv.slice(2)` as the `original` portion and both the command name and the script name in `cooked` portion. **Test case** Added integration tests.
Will actually add these soon. |
Thanks @BYK, this helps #2226 a little as you commented over there. However, if I understand correctly (I've only recently started using yarn), You could go one better than npm and make that |
@indiescripter thanks for the feedback! So here's what happens:
The aim here is to make this variable more useful but not achieve 100% npm compatibility since that's not possible and is overly limiting. TL;DR |
Thank you so much @BYK for taking such an interest in my situation. So long as one way or another we end up with at least
that is useful to/better for me. This means my use case will work if the user types It would be nice, though, as I suggested, if the user typed just the shorthand |
Oh, I already fixed some of this part :) When you run |
Fantastic, correct, thank you @BYK, that was the core issue! I have a new project in development which I humbly feel quite excited about as it a somewhat novel approach to monorepo setups (i.e. multiple subpackages under a master, top-level, development package). As you have taken a special interest in "Better npm_config_argv emulation", I would like to show my appreciation for your effort by giving you a heads-up well ahead of making any social media announcements about it. The project, called buildverse is on npmjs.com at https://www.npmjs.com/package/buildverse The "novelty" of my approach is in the executable program If you check out the GitHub repo for buildverse you will find that the With your fix, I hope to be able to say "Works with yarn as well as npm" in the package README! |
@indiescripter that's great, congrats! And I'm happy to be able to help :) Looks like you may also contribute to yarn in the future since you seem to be interested in these kinds of things ;) |
This change will decrease the build size from 9.69 MB to 9.69 MB, a decrease of 250 bytes (0%)
|
**Summary** Fixes yarnpkg#2226. Better emulates `npm_config_argv` by passing `process.argv.slice(2)` as the `original` portion and both the command name and the script name in `cooked` portion. **Test case** Added integration tests.
Summary
Fixes #2226. Better emulates
npm_config_argv
by passingprocess.argv.slice(2)
as theoriginal
portion and both thecommand name and the script name in
cooked
portion.Test case
Added integration tests.