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

Strip out deprecated "--" for Yarn #3

Open
difelice opened this issue Jun 15, 2018 · 7 comments
Open

Strip out deprecated "--" for Yarn #3

difelice opened this issue Jun 15, 2018 · 7 comments

Comments

@difelice
Copy link

Consider to stripping out the "--" for yarn, looks like it's been deprecated:

warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded.
In a future version, any explicit "--" will be forwarded as-is to the scripts.
@BendingBender
Copy link
Owner

BendingBender commented Jan 10, 2021

Could you please elaborate on this? What is the script that you're trying to run? @difelice @roydukkey

@roydukkey
Copy link

For example, with npm run test -- --arg1 and yarn run test --arg1.

@BendingBender
Copy link
Owner

And it doesn't work without the -- in your case? Could you please give me a real example?

Did you read the section https://github.com/BendingBender/yarpm#what-this-tool-is-not? I'm inclined to see this issue as an instance of this problem. Although I see that this is kind of an edge case.

@roydukkey
Copy link

Yes. I remember reading that before liking this issue. I don't remember exactly the "real" example that produced the warning, but I do remember it was something like I have already suggested. I believe yarpm run test -- --arg1 will reproduce the issue for yarn.

In a future version, any explicit "--" will be forwarded as-is to the scripts.

Once yarn makes this change, any plugin that uses positional arguments will fail.

@BendingBender
Copy link
Owner

Not really sure what to do here. yarn doesn't require the run command to be explicitly marked as such in the CLI. So to detect the run commands, I'd have to basically keep a list of all possible commands to yarn to make sure that I don't strip -- should any of the other commands require it. An approximation would be to check whether the second parameter after run or the first parameter if there's no run is a -- and to then strip it.

Any thoughts or objections?

@roydukkey
Copy link

yarpm test -- --arg1

But, npm does require run, so how could this command ever be viable for npm?

@BendingBender
Copy link
Owner

BendingBender commented Jan 12, 2021

It's not about npm, it's about a vague possibility that some other yarn command (apart from run) might need the -- parameter (not sure whether that's the case). Then, stripping out -- without checking for the actual command being executed would be an error.

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

No branches or pull requests

3 participants