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
The deprecated 'defaultCollection' workspace option has been removed
BREAKING CHANGE:
The deprecated `defaultCollection` workspace option has been removed. Use `schematicCollections` instead.
Before
```json
"defaultCollection": "@angular/material"
```
After
```json
"schematicCollections": ["@angular/material"]
```
The deprecated 'defaultProject' workspace option has been removed
BREAKING CHANGE: The deprecated `defaultProject` workspace option has been removed. The project to use will be determined from the current working directory.
G3 is now using RXJS version 7 which makes it possible for the CLI to also be updated to RXJS 7.
NB: this change does not remove all usages of the deprecated APIs.
Closes#24371
BREAKING CHANGE: Node.js v14 support has been removed
Node.js v14 is planned to be End-of-Life on 2023-04-30. Angular will stop supporting Node.js v14 in Angular v16.
Angular v16 will continue to officially support Node.js versions v16 and v18.
Use promise based methods to reduce RXJS usage and boiler-platting.
BREAKING CHANGE: Several changes to the `SchemaRegistry`.
- `compile` method now returns a `Promise`.
- Deprecated `flatten` has been removed without replacement.
When a schematic is executed, it is wrapped in a custom Node context. This context doesn't expose the same set of global variables. This can lead to an error if a schematic is importing the Angular compiler and the app is using i18n, because the `TextEncoder` isn't exposed through the custom context (see https://github.com/angular/angular/issues/48940).
These changes add the `TextEncoder` to the context.
Fixes https://github.com/angular/angular/issues/48940.
* test: run legacy-cli e2e tests via bazel
* fixup! test: run legacy-cli e2e tests via bazel
* fixup! test: run legacy-cli e2e tests via bazel
* fixup! test: run legacy-cli e2e tests via bazel
Previously base collections where not being taken into account and the recent changes caused an exception
```
An unhandled exception occurred: Cannot destructure property 'aliases' of 'collection.description.schematics[schematicName]' as it is undefined.
```
See: https://angular-team.slack.com/archives/CHEEH2LCA/p1674122139247359
Previously, schematic aliases were not registered when a collection name was provided to `ng generate`. Example: `ng generate c` where `c` is an alias for `component` would work, but `ng generate @schematics/angular:c` would fail. This commits fixes the schematic registration to handle the latter case.
Closes#24518
When performing a release via the dev-infra `ng-dev` tooling, the release
builds for the packages that will be published are now performed using bazel.
Prior to this, the release builds were performed using a custom build script
that programmatically invoked TypeScript APIs. The Bazel build and discovery
process for the releasable packages is performed by a script that is based on
the scripts from components and framework repositories. Several small modifications
were performed to match the behavior and structure of the cli repository:
* Use of `packages` as the source root in the bazel query
* Use of `pkg_npm` rule in the bazel query
* Partial transition to native Node.js `fs` APIs instead of `shelljs`
* Directory creation per package when copying output (supports multiple package scopes)
* Copying of archives (tgz) for each package
The snapshot and local build capabilities are not modified as part of this change
but will be merged in a followup as part of a larger transition to use bazel
throughout the package build process.
These async methods are a replacement for the Observable based `runSchematicAsync` and `runExternalSchematicAsync` methods.
DEPRECATED:
The Observable based `SchematicTestRunner.runSchematicAsync` and `SchematicTestRunner.runExternalSchematicAsync` method have been deprecated in favor of the Promise based `SchematicTestRunner.runSchematic` and `SchematicTestRunner.runExternalSchematic`.