-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce complexity of src/cli/index.js (#2887)
* clarify initial part of src/cli/index.js when we extracting arguments; flags and arguments after -- * change test if we do not provide any command name and specify a flag because the previous one was flaky * fix silent error in test when we expect an error from a yarn command * enrich commands with aliases * simplify if statement: if no command we set install as default * simplify if statement: we always have command with value undefined * put every logic related to help in help command * use deconstructuring instead of concat and some shift/unshit command * remove useless invariant on commandName: we are sure that is always defined * if command is not recognized set default to run; if command is run we set commandName as the first arg for npm_config_argv * add some tests cases when we do not recognize command * we use commander.js only to parse flags, remove every logic to put commandName and place only a placeholder * implement hasWrapper function for help command * display correct help link for aliases * display documentation link correctly in every case * add some console.asserts to ensure that we early crash if something is not expected * fix erronous case: yarn constructor
- Loading branch information
Showing
5 changed files
with
163 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.