Previously, the workspace configuration file was found and loaded by individual commands potentially multiple times. This change moves the initial workspace location discovery and loading of the workspace to the CLI startup. It also provides the workspace to each command so that the commands can reuse the already loaded and parsed workspace configuration.
This change removes all direct usage of the `node_modules` directory from the version command. This provides improved support for yarn PnP as well as prevents a crash when a workspace does not have a `node_modules` directory.
Fixes#10474
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)