-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(schematics): wrap angular schematic for component and workspace …
…generation
- Loading branch information
1 parent
f4af481
commit 67cee3d
Showing
8 changed files
with
79 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
{ | ||
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json", | ||
"schematics": { | ||
"custom-angular-schematics": { | ||
"description": "A blank schematic.", | ||
"factory": "./custom-angular-schematics/index#customAngularSchematics" | ||
"component": { | ||
"description": "A schematic for component generation", | ||
"factory": "./component/index#component" | ||
}, | ||
"workspace": { | ||
"description": "A schematic for workspace generation", | ||
"factory": "./workspace/index#workspace" | ||
|
||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {chain, externalSchematic, Rule, SchematicContext, Tree} from '@angular-devkit/schematics'; | ||
|
||
|
||
// You don't have to export the function as default. You can also have more than one rule factory | ||
// per file. | ||
export function component(_options: any): Rule { | ||
return (_tree: Tree, _context: SchematicContext) => { | ||
return chain([ | ||
externalSchematic('@schematics/angular', 'component', {}) | ||
]); | ||
}; | ||
} |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {chain, externalSchematic, Rule, SchematicContext, Tree} from '@angular-devkit/schematics'; | ||
|
||
|
||
// You don't have to export the function as default. You can also have more than one rule factory | ||
// per file. | ||
export function workspace(_options: any): Rule { | ||
return (_tree: Tree, _context: SchematicContext) => { | ||
return chain([ | ||
externalSchematic('@schematics/angular', 'ng-new', {version: '^13.0.0'}) | ||
]); | ||
}; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Tree } from '@angular-devkit/schematics'; | ||
import { SchematicTestRunner } from '@angular-devkit/schematics/testing'; | ||
import * as path from 'path'; | ||
|
||
const collectionPath = path.join(__dirname, '../collection.json'); | ||
|
||
describe('workspace', () => { | ||
it('works', async () => { | ||
const runner = new SchematicTestRunner('schematics', collectionPath); | ||
const tree = await runner | ||
.runSchematicAsync('workspace', {}, Tree.empty()) | ||
.toPromise(); | ||
|
||
expect(tree.files).toEqual([]); | ||
}); | ||
}); |