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`.
Pacote version 14 does requires `14.17.x` or `16.13.x`.
BREAKING CHANGE: The Angular CLI no longer supports `16.10.x`, `16.11.x` and `16.12.x`. Current supported versions of Node.js are `14.20.x`, `16.13.x` and `18.10.x`.
In the case when `ng update` is ran without a package name, an update is not be performed. In this case using the current installed version of the CLI is good enough.
Closes#24024
With this commit the builder and schematic names are added as page title to page events.
Also, we address a bug where during a watch or error in some cases analytics where not flushed. Examples when the builder has a watch mode.
The global require function is not present in Node.js ESM mode. To support
the eventual transition of the `@angular/cli` package to ESM, usage of the
`require.resolve` function has been converted to use locally created `require`
functions via `createRequire` from the `module` builtin.
Prior to this change during update deprecated packages that satisfied the version range constrain where being favored over the non-deprecated versions if the version of the deprecated version is greater. Ex: if `14.3.1` is deprecated and `14.3.0` is not the former was being installed.
With this change we now change the logic to favor non deprecated version of the package and only use the deprecated package when no satisfying version is found.
This fix is needed as in some cases a package which cannot be unpublished from NPM will gave to be to be deprecated, if the version is for a reason or another broken.
BREAKING CHANGE: The 'path' option in schematics schema no longer has a special meaning. Use 'workingDirectory' smart default provider should be used instead.
Prefixing options with `no` in schema definitions appears to be used more widely than initially thought.
The `noOption` can also be provided in the `angular.json` which makes this property definition less ambiguous, since boolean options don't get prefixed with `no` in the JSON config. Therefore, in order to reduce the community changes we remove the deprecation warning for such options and change the interim solution to permanent one.
None-the-less, it's still recommended that options are defined without the `no` prefix.
Previously when having completion enabled and the current workspaces has an older version of the Angular CLI installed in the terminal the below errors is show. This is because the older versions of the CLI do not implement this command. Now we exit gracefully.
```
The specified command ("completion") is invalid. For a list of available options,
run "ng help".
Did you mean "analytics"?
```
Closes#23518
With this change we improve the error message when a project for command cannot be determined
```
Error: Cannot determine project for command.
This is a multi-project workspace and more than one project supports this command. Run "ng build [project]" to execute the command for a specific project or change the current working directory to a project directory.
Available projects are:
- project-name-0
- project-name-1
- project-name-2
- project-name-3
- project-name-4
- project-name-5
- project-name-6
- project-name-7
- project-name-8
- project-name-9
```
Closes#23481
- Prevent additional properties being set in cli subproperties (i.e. cli.warnings.zzzz).
- Create cliGlobalOptions definition and reference in the global.cli schema.
- Use global.cli schema to validate changes made with --global flag.
- Add test coverage for validating global/local-only changes.
- Add test coverage for setting invalid properties and sub-properties.
With this commit we introduce an interim solution for options prefixed with `no` in `schema.json`
Previously, such options were handled as normal boolean option, but yargs handles options prefixed with `no` as negatations of the original option. Example with yargs, an option `noWatch` is will registered as `watch`.
Closes#23397
Running autocompletion with `14.0.1` installed globally in a `14.0.0` project logs the version warning in a very annoying fashion:
```
$ ng verYour global Angular CLI version (14.0.1) is greater than your local version (14.0.0). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
sion
```
This adds an exception for `ng completion` commands to avoid this edge case.
Currently, we don't register all available commands. For instance, when the CLI is ran inside a workspace the `new` command is not registered. Thus, this will cause a confusing error message when `ng new` is ran inside a workspace.
Example:
```
$ ng new
Error: Unknown command. Did you mean e?
```
With this commit we change this by registering all the commands and valid the command scope during the command building phase which is only triggered once the command is invoked but prior to the execution phase.
Prepares the `@angular/cli` package for the eventual change of enabling the
TypeScript `useUnknownInCatchVariables` option. This option provides additional
code safety by ensuring that the catch clause variable is the proper type before
attempting to access its properties. Similar changes will be needed in the other
packages in the repository prior to enabling `useUnknownInCatchVariables`.