1
0
mirror of https://github.com/angular/angular-cli.git synced 2025-05-17 02:54:21 +08: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 
2022-03-22 09:37:57 -07:00
..
2022-01-31 11:36:53 -08:00
2021-04-28 16:05:49 -07:00

/docs Folder

This folder is used for all documentation. It contains a number of subfolders with short descriptions here.

/docs/design

Design documents on GitHub, in Markdown format. The number of design documents available is limited.

/docs/process

Description of various caretaker and workflow processes.

/docs/specifications

Specifications for support of Angular CLI features. These are meant to be read directly on GitHub by developers of libraries who want to integrate with the Angular CLI.