Created
September 10, 2018 19:21
-
-
Save jonbcampos/57f6c03f77904a8ecf0af9ae0f298972 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
export function simpleSchematic(options: any): Rule { | |
return (tree: Tree, _context: SchematicContext) => { | |
setupOptions(tree, options); | |
const movePath = (options.flat) ? | |
normalize(options.path) : | |
normalize(options.path + '/' + strings.dasherize(options.name)); | |
const templateSource = apply(url('./files'), [ | |
options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')), | |
template({ | |
...strings, | |
...options, | |
}), | |
move(movePath), | |
]); | |
const rule = mergeWith(templateSource, MergeStrategy.Default); | |
return rule(tree, _context); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment