12 Commits

Author SHA1 Message Date
Charles Lyding
741cf7fe1e test: enable @typescript-eslint/await-thenable lint rule
The `@typescript-eslint/await-thenable` rule is now enabled and all failures
have been addressed within the code.
2024-06-25 16:57:03 -04:00
Ash Ramirez
434a3740f0 refactor(@angular/cli): update aio links -> adev links
Updates for all angular.io links to the new angular.dev domain. Additionally, adjustment to new resources where the equivalent does not exist on the new site (e.g. Tour of Heroes tutorial)
2024-06-06 11:12:06 +02:00
Alan Agius
17ffedc3ec refactor(@angular/cli): remove legacy NPM compatibility check
This check should no longer be needed as on supported versions of Node.js NPM 7.5 is no longer installed by default.
2023-09-01 15:17:52 +02:00
Alan Agius
5b62074ec2 perf(@angular/cli): register CLI commands lazily
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.
2023-04-13 16:24:01 +00:00
Alan Agius
143fc68adc docs(@angular/cli): add ng new long description
This appears to have been deleted by mistake when we switched to Yargs.
2023-01-11 15:56:52 +00:00
Alan Agius
5a012b5fce fix(@angular/cli): correctly handle --collection option in ng new
Previously, this option was ignored due to an incorrect deconstruction.

Closes #23414
2022-06-27 09:09:13 -04:00
Alan Agius
82ec1af4e1 fix(@angular/cli): show more actionable error when command is ran in wrong scope
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.
2022-06-13 19:22:56 +02:00
Alan Agius
3d77846dd7 refactor(@angular/cli): create a memoize decorator
With this change we clean up repeated caching code by creating a `memoize` decorator that can be used on get accessors and methods.
2022-04-01 12:16:34 -04:00
Alan Agius
1bbabb24ca refactor(@angular/cli): create package manager util class
Apart from better code quality, this helps reduce the time of CLI bootstrapping time, as retrieving the package manager name is a rather expensive operator due to the number of process spawns.

The package manager name isn't always needed until we run a command and therefore in some cases we can see an improvement of around `~600ms`. Ex: `ng b --help`. From ` 1.34s` to `0.76s`.

This will be important when we eventually introduce auto complete as users will get faster loopback.
2022-03-30 17:33:37 +02:00
Alan Agius
366cabc66c feat(@angular/cli): add support for multiple schematics collections
The `schematicCollections` can be placed under the `cli` option in the global `.angular.json` configuration, at the root or at project level in `angular.json` .

```jsonc
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "cli": {
    "schematicCollections": ["@schematics/angular", "@angular/material"]
  }
  // ...
}
```

**Rationale**
When this option is not configured and a user would like to run a schematic which is not part of `@schematics/angular`,
the collection name needs to be provided to `ng generate` command in the form of `[collection-name:schematic-name]`. This make the `ng generate` command too verbose for repeated usages.

This is where `schematicCollections` comes handle. When adding `@angular/material` to the list of `schematicCollections`, the generate command will try to locate the schematic in the specified collections.

```
ng generate navigation
```

is equivalent to:

```
ng generate @angular/material:navigation
```

**Conflicting schematic names**
When multiple collections have a schematic with the same name. Both `ng generate` and `ng new` will run the first schematic matched based on the ordering (as specified) of `schematicCollections`.

DEPRECATED:

The `defaultCollection` workspace option has been deprecated in favor of `schematicCollections`.

Before
```json
"defaultCollection": "@angular/material"
```

After
```json
"schematicCollections": ["@angular/material"]
```

Closes #12157
2022-03-22 09:37:57 -07:00
Alan Agius
d560e23d67 refactor(@angular/cli): remove old CommandModule and SchematicCommand implementations
Use the newly implemented `CommandModule` and `SchematicsCommandModule`.
2022-03-16 10:07:44 -04:00
Alan Agius
10cce2c86e refactor(@angular/cli): re-organize the Angular CLI package folder structure 2022-03-09 17:18:53 +01:00