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)
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`
Some commands (like schematics) need to have custom reporting for
analytics. Schematics and Architect commands need to verify if the
schematic/architect builder run is in the safelist, for example.
Angular 5.0+ has a full peer dependencies setup (with 6.0+ also having a configurable runtime error check) to ensure that an appropriate version of typescript is available for compilation. Angular CLI 8.0+ does not support Angular versions prior to these and therefore the warning is redundant. For the case where the developer wishes to use an unsupported TypeScript version, the developer would need to adjust two similar but differently name settings in two different configuration files.
ng-add checks if a specified collection is installed, and if not it'd
proceed to install the package. However, `isPackageInstalled` would, by
default, resolve the main field or the index of the package. Not all NPM
packages specify the main field or provide an index file. It should
be sufficient to just check the presence of `package.json` to detect
whether a package is installed or not.
For example, `ng add @angular/bazel` should not install the package if
it's already installed locally. `@angular/bazel` does not specify a main
field not an index file in its `package.json`.
If no version specifier is supplied `ng add` will now try to find the most recent version of the package that has peer dependencies that match the package versions supplied in the project's package.json