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`.
This commit fixes an issue where when `ng update` was ran using `yarn` (`yarn ng update`) the registry was always being overridden to `https://registry.yarnpkg.com`.
This is because yarn will set the `npm_config_registry` env variable to `https://registry.yarnpkg.com` even when an RC file is present with a different repository.
* fix(@angular/cli): exclude `@angular/localize@<10.0.0` from ng add package discovery
`@angular/localize@<10.0.0` has no peer dependencies. This can cause `ng add` to pick these versions of the package if the newer versions.
See: https://app.circleci.com/pipelines/github/angular/angular-cli/27402/workflows/faa64532-541a-4bea-b599-3c53afe42019/jobs/364822
```
Test Process error Error: Process exit error - "ng add @angular/localize --skip-confirmation": 1...
STDOUT:
STDERR:
npm version 7.4.0 detected. When using npm 7 with the Angular CLI, npm version 7.5.6 or higher is recommended.
- Determining package manager...
ℹ Using package manager: npm
- Searching for compatible package version...
✔ Found compatible package version: @angular/localize@10.0.0-next.7.
- Loading package information from registry...
✔ Package information loaded.
- Installing packages...
✔ Packages successfully installed.
NOT SUPPORTED: keyword "id", use "$id" for schema ID
```
* fixup! fix(@angular/cli): exclude `@angular/localize@<10.0.0` from ng add package discovery
Co-authored-by: Charles <19598772+clydin@users.noreply.github.com>
Co-authored-by: Charles <19598772+clydin@users.noreply.github.com>
When the CLI is a prerelease version, the `ng add` command will now consider the
use of prerelease versions of requested packages. Without this behavior, attempting
to install a package without a version specifier (e.g., `ng add @angular/material`)
will install an older stable version of the requested package instead of the expected
prerelease version compatible with the prerelease Angular project.
`@angular/material@7.x` uses unbounded ranges for its framework peer dependencies.
This can cause `ng add` to pick these versions of the package if the newer versions
are not compatible since the peer dependency ranges would match any newer stable
framework version.
This causes sub broken DX
```
ng bui[TAB]Your global Angular CLI version (14.2.6) is greater than your local version (14.1.3). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
ld --conf[TAB]Your global Angular CLI version (14.2.6) is greater than your local version (14.1.3). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
iguration dev[TAB]Your global Angular CLI version (14.2.6) is greater than your local version (14.1.3). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
elopment
```
Closes#24133
With this change we add a long description to analytics command with the information that is currently contained in https://angular.io/analytics which will be deleted at a later stage.
With this change we collect 3 additional metrics
- `all_projects_count` Count of all project in a workspace
- `libs_projects_count` Count of library projects in a workspace
- `apps_projects_count` Count of application projects in a workspace
Needed as otherwise if the parameter is longer we are unable to map this in GA4.
GA4 has a limit of:
- 24 characters for custom user dimension parameter names
- 40 characters for custom event dimension parameter names
- 40 characters for custom metric dimension parameter names
This change updates the analytics collector collector to use GA4 instead of UA. The motivation behind this change is that UA will stop collecting data in 2023.
BREAKING CHANGE:
`analyticsSharing` option in the global angular configuration has been
removed without replacement. This option was used to configure the Angular CLI to access to your own users' CLI usage data.
If this option is used, it can be removed using `ng config --global cli.analyticsSharing undefined`.