When updating to v17, the `@nguniversal/builders` is now ignored when checking peer
dependency ranges. The `@nguniversal/builders` is no longer used and will be removed
in a migration during the update process.
This commit updates the behaviour of `ng update --migrate-only` to remove the need for `--migrate-only` option to be specified. `--migrate-only` will be set internally.
Before
```
ng update @angular/cli --migrate-only --name=migration-name
```
Now
```
ng update @angular/cli --name=migration-name
```
This commit enabled users to opt-in adding SSR and SSG to their application during the `ng new` experience. This can be done either by using the `--ssr` option or answer `Yes` when prompted.
BREAKING CHANGE: Node.js v16 support has been removed
Node.js v16 is planned to be End-of-Life on 2023-09-11. Angular will stop supporting Node.js v16 in Angular v17.
For Node.js release schedule details, please see: https://github.com/nodejs/release#release-schedule
There is a separate, internal version of the Angular CLI which should be used instead. Running this version can lead to unintuitive and unexpected behavior. This commit intentionally does not include an opt-out because there is no supported use case for running the external CLI inside google3. If someone is broken by this and presents a compelling use case, we can reconsider and add an opt-out for this check.
BUILD files for each package have had outdated glob excludes removed.
Additionally, some src args have been reduced to a single file where possible.
The root bazel ignore file has also been expanded to include all node module
directories in each package. The ignore file does not appear to currently support
globs so each path has been individually specified.
For now this just runs ESBuild-er to build test code, Jest is not actually invoked yet.
This uses `glob` to find test files matching the given pattern. I went out of my way to limit `glob` functionality as much as possible in case we change the implementation later.
In newer Node.js versions ng commands do not terminate properly when analytics are enabled.
This is because the request is never closed unless a `data` event listener is attached.
Closes#25034 and closes#25008
Currently there is a lot of overhead coming from requiring external modules when registering commands such as `ng update` and `ng add`.
This is because these commands do not lazily require all the modules causes the resolution of unneeded packages to be part of the critical path.
With this change we "require” only the command that we we need to execute, which reduce the number of node modules resolutions in the critical path.
When running `ng update` we now display optional migrations from packages.
When the terminal is interactive, we prompt the users and ask them to choose which migrations they would like to run.
```
$ ng update @angular/core --from=14 --migrate-only --allow-dirty
Using package manager: yarn
Collecting installed dependencies...
Found 22 dependencies.
** Executing migrations of package '@angular/core' **
▸ Since Angular v15, the `RouterLink` contains the logic of the `RouterLinkWithHref` directive.
This migration replaces all `RouterLinkWithHref` references with `RouterLink`.
Migration completed (No changes made).
** Optional migrations of package '@angular/core' **
This package have 2 optional migrations that can be executed.
Select the migrations that you'd like to run (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
❯◯ Update server builds to use generate ESM output.
◯ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
```
In case the terminal is non interactive, we will print the commands that need to be executed to run the optional migrations.
```
$ ng update @angular/core --from=14 --migrate-only --allow-dirty
Using package manager: yarn
Collecting installed dependencies...
Found 22 dependencies.
** Executing migrations of package '@angular/core' **
▸ Since Angular v15, the `RouterLink` contains the logic of the `RouterLinkWithHref` directive.
This migration replaces all `RouterLinkWithHref` references with `RouterLink`.
Migration completed (No changes made).
** Optional migrations of package '@angular/core' **
This package have 2 optional migrations that can be executed.
▸ Update server builds to use generate ESM output.
ng update @angular/core --migration-only --name esm-server-builds
▸ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
ng update @angular/core --migration-only --name migration-v15-router-link-with-href
```
**Note:** Optional migrations are defined by setting the `optional` property to `true`. Example:
```json
{
"schematics": {
"esm-server-builds": {
"version": "15.0.0",
"description": "Update server builds to use generate ESM output",
"factory": "./migrations/relative-link-resolution/bundle",
"optional": true
}
}
```
Closes#23205