Previously, when using an older version of the Angular CLI, during `ng update`, we download the temporary `latest` version to run the update. The ensured that when running that the runner used to run the update contains the latest bug fixes and improvements.
This however, can be problematic in some cases. Such as when there are API breaking changes, when running a relatively old schematic with the latest CLI can cause runtime issues, especially since those schematics were never meant to be executed on a CLI X major versions in the future.
With this change, we improve the logic to determine which version of the Angular CLI should be used to run the update.
Below is a summarization of this.
- When using the `--next` command line argument, the `@next` version of the CLI will be used to run the update.
- When updating an `@angular/` or `@nguniversal/` package, the target version will be used to run the update. Example: `ng update @angular/core@12`, the update will run on most recent patch version of `@angular/cli` of that major version `@12.2.6`.
- When updating an `@angular/` or `@nguniversal/` and no target version is specified. Example: `ng update @angular/core` the update will run on most latest version of the `@angular/cli`.
- When updating a third-party package, the most recent patch version of the installed `@angular/cli` will be used to run the update. Example if `13.0.0` is installed and `13.1.1` is available on NPM, the latter will be used.
The CLI contains a helper class instance that provides the version of the executing CLI. By using this helper throughtout the code, repeat `require` calls are no longer necessary.
All TypeScript files have been updated to pass the new eslint-based linting checks. eslint compatible disabling comments have also been added in place of the previous tslint comments.
This allows improvements and bugfixes in later versions of the update command to be used in projects with older versions of the Angular CLI that do not have bootstrapping (<8.3.13).
Set the `BROWSERSLIST_IGNORE_OLD_DATA` enviorment variable to disable Browserslist old data warning
`Browserslist: caniuse-lite is outdated. Please run next command `npm update`
See: 819c433745/node.js (L324)
With this change we now check if the current CLI version is the latest published version. If it is not, we install a temporary version to run the `ng update` with.
Replace the v8-profiler dependency with v8-profiler-node8 as the first one
doesn't support node 8 and 10, and that @angular/cli support only node 8
and 10.