Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonbcampos/57f6c03f77904a8ecf0af9ae0f298972 to your computer and use it in GitHub Desktop.
Save jonbcampos/57f6c03f77904a8ecf0af9ae0f298972 to your computer and use it in GitHub Desktop.
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