fix(workspaces): Passes arguments follwing "--" when running a workspace script #7785
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #7776
Summary
Passes arguments following
--
when running a workspace script (for exampleyarn workspace pkg run command -- arg
).Previously these parameters were being trimmed off and ignored.
It seems that in
src/cli/index.js
we were trimming all params after and including the--
, and assigning the remainder toflags.originalArgs
which theworkspace
command was using.Instead, this PR changes the
workspace
command to use theargs
parameter that was already being passed to the command, which includes the args after the--
.The
args
parameter to the command is also what theyarn run
command uses, so it makes sense foryarn run
andyarn workspace run
to both useargs
instead of one usingargs
and the other usingflags.originalArgs
.Test plan
Since yarn parameter passing in
src/cli/index.js
is not tested, there are no additional tests.A manual test can be performed by setting up a basic workspace project:
package.json
packages/pkg1/package.json
packages/pkg1/start.sh
then run the yarn command
The output from the script should be
one two three