-
Notifications
You must be signed in to change notification settings - Fork 12k
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
refactor(@angular/cli): replace command line arguments parser #22778
Conversation
Validation failure should be fixed by angular/dev-infra#436 |
packages/angular/cli/src/command-builder/architect-base-command-module.ts
Outdated
Show resolved
Hide resolved
packages/angular/cli/src/command-builder/architect-base-command-module.ts
Outdated
Show resolved
Hide resolved
packages/angular/cli/src/command-builder/architect-base-command-module.ts
Outdated
Show resolved
Hide resolved
packages/angular/cli/src/command-builder/utilities/json-help.ts
Outdated
Show resolved
Hide resolved
.option('migrate-only', { | ||
description: 'Only perform a migration, do not update the installed version.', | ||
type: 'boolean', | ||
}) | ||
.option('name', { | ||
description: 'The name of the migration to run.', | ||
type: 'string', | ||
implies: ['migrate-only'], | ||
conflicts: ['to', 'from'], | ||
}) |
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.
Could the coerce
yargs functionality on migrate-only
be used to allow for a deprecation time period of the --migrate-only <string>
scenario?
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.
Unfortunately not, since the type of the option is boolean, the value will be covered to a boolean by the parser which happens way before coerce
being triggered.
With this change we refactor the Angular CLI and replace the underlying args parser and command builder. We choose to use Yargs as our parser and command builder of choice. The main advantages of Yargs over other command builders are; - Highly configurable. - We already use it in other packages such as the compiler-cli/dev-infra etc.. - Commands and options can be added during runtime. This is a requirement that is needed to support architect and schematics commands. - Outstanding documentation. - The possibility to parse args without parser configuration (Free form). - Commands are built lazily based on the arguments passed. BREAKING CHANGE: Several changes in the Angular CLI commands and arguments handling. - `ng help` has been removed in favour of the `—-help` option. - `ng —-version` has been removed in favour of `ng version` and `ng v`. - Deprecated camel cased arguments are no longer supported. Ex. using `—-sourceMap` instead of `—-source-map` will result in an error. - `ng update`, `—-migrate-only` option no longer accepts a string of migration name, instead use `—-migrate-only -—name <migration-name>`. - `—-help json` help has been removed. Closes #20976, closes #16614 and closes #16241
With this change we update yargs help method to output help in JSON format which is needed to generate the documents that are used to generate AIO man pages.
With this change we update the UA usage script to read schemas directly insteads of relying on JSON help.
This temporary until the old command modules are removed.
…provements This PR brings a number of small refactors to improve code quality in the new args parser implementation.
…er and folder structure (#45225) The underlying parser that the CLI uses changed which caused minor changes in the generated JSON helps especially for subcommands. The folder structure of the Angular CLI repo also changed slightly. More context: angular/angular-cli#22778 PR Close #45225
…er and folder structure (angular#45225) The underlying parser that the CLI uses changed which caused minor changes in the generated JSON helps especially for subcommands. The folder structure of the Angular CLI repo also changed slightly. More context: angular/angular-cli#22778 PR Close angular#45225
…er and folder structure (angular#45225) The underlying parser that the CLI uses changed which caused minor changes in the generated JSON helps especially for subcommands. The folder structure of the Angular CLI repo also changed slightly. More context: angular/angular-cli#22778 PR Close angular#45225
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
With this change we refactor the Angular CLI and replace the underlying args parser and command builder. We choose to use Yargs as our parser and command builder of choice. The main advantages of Yargs over other command builders are;
BREAKING CHANGES:
ng help
has been removed in favour of the—-help
option.ng —-version
has been removed in favour ofng version
andng v
.—-sourceMap
instead of—-source-map
will result in an error.ng update
,—-migrate-only
option no longer accepts a string of migration name, instead use-—migrate-only -—name <migration-name>
.-—help json
help has been removed.Closes #20976, closes #16614 , closes #17191 and closes #16241