-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(@angular/cli): add support for multiple schematics collections #22860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alan-agius4
commented
Mar 17, 2022
dgp1130
reviewed
Mar 17, 2022
dgp1130
approved these changes
Mar 18, 2022
dgp1130
approved these changes
Mar 21, 2022
…s` to allow returning hidden schematics. The return value of `listSchematicNames` will include hidden schematics when is invoked with true as first parameter. By default, hidden schematics are not returned.
alxhub
pushed a commit
to angular/angular
that referenced
this pull request
Mar 21, 2022
`defaultCollection` has deprecated in favor of `schematicCollections`. Related to angular/angular-cli#22860 PR Close #45406
clydin
requested changes
Mar 22, 2022
packages/schematics/angular/migrations/update-14/replace-default-collection-option.ts
Outdated
Show resolved
Hide resolved
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
clydin
approved these changes
Mar 22, 2022
PiyushAgrawal1243
pushed a commit
to PiyushAgrawal1243/angular
that referenced
this pull request
Mar 30, 2022
…r#45406) `defaultCollection` has deprecated in favor of `schematicCollections`. Related to angular/angular-cli#22860 PR Close angular#45406
josmar-crwdstffng
pushed a commit
to josmar-crwdstffng/angular
that referenced
this pull request
Apr 8, 2022
…r#45406) `defaultCollection` has deprecated in favor of `schematicCollections`. Related to angular/angular-cli#22860 PR Close angular#45406
2 tasks
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
action: merge
The PR is ready for merge by the caretaker
flag: deprecation
target: major
This PR is targeted for the next major release
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
schematicCollections
can be placed under thecli
option in the global.angular.json
configuration, at the root or at project level inangular.json
.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 theng generate
command too verbose for repeated usages.This is where
schematicCollections
comes handle. When adding@angular/material
to the list ofschematicCollections
, the generate command will try to locate the schematic in the specified collections.is equivalent to:
Conflicting schematic names
When multiple collections have a schematic with the same name. Both
ng generate
andng new
will run the first schematic matched based on the ordering (as specified) ofschematicCollections
.DEPRECATED:
The
defaultCollection
workspace option has been deprecated in favor ofschematicCollections
.Before
After
Closes #12157