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
[rush] Add defaultCommand command-line parameter #4236
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree |
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.
One of the motivations for "missingScriptBehavior" being an enumeration instead of adding another boolean to silence missing scripts was that a new value could be added to it for "shell-command" or similar. I don't think I'd consciously realized that the current "shellCommand" field overrides package.json
.
At minimum, I think it makes more sense to add a way to control the priority of the existing "shellCommand" property than to add a second one, since it doesn't make sense to define two separate shell commands in the command definition.
@@ -294,4 +294,30 @@ describe(CommandLineConfiguration.name, () => { | |||
expect(phase.shellCommand).toEqual('echo'); | |||
}); | |||
}); | |||
|
|||
describe('defaultCommand in bulk command', () => { |
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.
Please include a unit test of having it in a phase definition as well.
Hi @dmichon-msft , thanks for your response.
Back to the command priority. Yes, there has a restriction to let "shellCommand" field overrides Agreen with the solution to have a flag to control the priority, I have some proposals:
Which's value so far could be Please feel free to give your own opinion and suggestion! |
Can well call it |
Summary
Add
defaultCommand
command-line parameter to Buld and Phase command kinds.Fixes #1168
Fixes #1797
Details
So far even with
shellCommand
, we still don't have a official way to override or ser a default command.Before I found a workaround like bellow:
But it's quite tricky, accourding to that I suggest to have a
defaultCommand
parameter for this situation,Comapare to
shellCommand
, it has a lower priority than package.json script, so user can use script field as an override, and setdefaultCommands
to prevent verbose set empty script string in each project which need to be skiped.I have considered about using a flag like
priority
to reuse the theshellCommand
, but I think it will become a mess, but it's open for discussion.With this update, we can finally set default command like bellow:
How it was tested
test cases:
Impacted documentation
command-line.json