Last active
March 1, 2019 03:47
-
-
Save bniedermeyer/134f92bc28fed5c260613c59efff4fd0 to your computer and use it in GitHub Desktop.
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
import { | |
Rule, | |
SchematicContext, | |
Tree, | |
chain | |
} from '@angular-devkit/schematics'; | |
import { Schema } from './schema.model.ts'; | |
export function myAwesomeSchematic(_options: Schema): Rule { | |
return (tree: Tree, _context: SchematicContext) => { | |
return chain([ | |
addDependencies(options), | |
addRequiredFiles(options) | |
])(tree, _context); | |
}; | |
} | |
function addDependencies(options: Schema): Rule { | |
return (tree: Tree, _context: SchematicContext) => { | |
// this tells the schematic to run the add-dependencies schemtic found in collection.json as a task | |
_context.addTask(new RunSchematicTask('add-dependencies', options)); | |
return tree; | |
}; | |
function addRequiredFiles(options: Schema): Rule { | |
return (tree: Tree, _context: SchematicContext) => { | |
// this tells the schematic to run the add-files schemtic found in collection.json | |
_context.addTask(new RunSchematicTask('add-files', options)); | |
return tree; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment