Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

feat(@angular-devkit/schematics): support collection extension #398

Merged
merged 1 commit into from
Feb 2, 2018
Merged

feat(@angular-devkit/schematics): support collection extension #398

merged 1 commit into from
Feb 2, 2018

Conversation

clydin
Copy link
Member

@clydin clydin commented Jan 19, 2018

Example usage (also supports an array of strings):

  "name": "extends-basic-string",
  "extends": "works",
  "schematics": {
    "schematic2": {
      "description": "2",
      "factory": "../null-factory"
    }
  }
}

Closes #34

@filipesilva
Copy link
Contributor

@clydin can you rebase please, and @hansl can you review?

Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 little nits. Nothing major. Good work!

@@ -4,6 +4,11 @@
"title": "Collection Schema for validating a 'collection.json'.",
"type": "object",
"properties": {
"extends": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How hard to add type: [ "array", "string" ] ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added support for both.

@@ -38,6 +38,66 @@ describe('FileSystemEngineHost', () => {
expect(schematic1.description.name).toBe('schematic1');
});

it('extends a collection ', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just add a test for listSchematicNames to avoid regression.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.


private _createCollectionDescription(
name: string,
parentNames?: Set<string>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit but not stopping the approval; parentNames = new Set<string>() then lower just add regardless of whether it's defined or not.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants