When testing a local CLI build with `npm link @angular/cli`, if you run `ng version`,
you currently see:
Angular CLI: local (v8.1.0-beta.2+24.3bb67d8.with-local-changes, branch: version)
if the Git branch is `fix/version`.
Whit this PR, `ng version` now displays the proper Git branch name:
Angular CLI: local (v8.1.0-beta.2+24.3bb67d8.with-local-changes, branch: fix/version)
Whenever an unhandled exception during command processing occurs, the message and stack trace will be saved to a debug log located in a temporary directory. The user will be informed of the log location as well as the exception message and instructions to file a bug report at the GitHub repository.
Node.js 10+ provides built-in functionality to test for color support based on chalk's `supports-color` package as well as several others. This alleviates the need for custom code or third-party packages to determine color support. In addition for this PR, the `ansi-colors` package is added to the CLI which provides color, cross-platform symbol, and style/color removal support. The package is light-weight, contains typings, and has no dependencies. The removal support is leveraged to remove all styling from logger messages when color is not supported. This removes a current defect in which color/styling is still displayed if generated manually or via methods that do not perform supportability checks. Finally, the typically used console functions are overriden to leverage the logger to ensure that the color processing is applied to third-party code (e.g., webpack internally as well as some of its loaders and plugins) which output to the console directly.
With this commit, we can now specify a `version`
for the `ng doc` command
ng doc --version 6
ng doc -v 6
and this will open `v6.angular.io` instead of `angular.io`.
The default domain is still used
if no version is specified.
Refs #12365
This ensures that migration fields that reference other packages use the package version specified in the migrating package's dependencies and not the version that a package manager happens to hoist to the root of the workspace.
If not asking for update status then this change checks for a clean git repository before proceeding. This allows the user to easily reset any changes from the update and avoid any developer code changes from being mixed with update changes.
Node.js 12.0 contains a defect which will cause the command to crash. This is due to the locale support in Node.js 12.0 (ICU). ref: https://github.com/nodejs/node/issues/27379
This adds extensive option checking and error handling with the goal to catch user errors as early in the process as possible. Bad option combinations and/or values will result in actionable information and stop the process before network access and processing occurs.
Currently, upon execution `ng` will load all description files AND code for all available commands. This requires a large amount of unnecessary file access and processing since only at most one command will be executed. This change limits the loading to only command being executed in the common case and a subset of commands in the event an alias is used. The help command now loads all commands during its execution which is needed to gather command description information. Further improvements are possible by only loading the necessary metadata instead of the execution code (and its dependencies) as well.
This change allows for savings of ~250ms per execution.
Examples:
Before -- `./node_modules/.bin/ng version 0.99s user 0.17s system 113% cpu 1.020 total`
After -- `./node_modules/.bin/ng version 0.70s user 0.13s system 110% cpu 0.749 total`
Before -- `./node_modules/.bin/ng g c a 1.91s user 0.30s system 111% cpu 1.996 total`
After -- `./node_modules/.bin/ng g c a 1.62s user 0.27s system 110% cpu 1.715 total`