Skip to content

Instantly share code, notes, and snippets.

@vsavkin
Created March 25, 2021 15:16
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 vsavkin/321f9ccbf2e0a4df58620a505c7521e9 to your computer and use it in GitHub Desktop.
Save vsavkin/321f9ccbf2e0a4df58620a505c7521e9 to your computer and use it in GitHub Desktop.
// Nx Devkit
export default async function (tree: Tree, options: Schema) {
generateFiles(
tree,
join(__dirname, 'files'),
join('tools/generators', options.name),
options
);
await formatFiles(tree);
}
// Angular Devkit
export default function (options: Schema): Rule {
const templateSource = apply(url('./files'), [
template({
dot: '.',
tmpl: '',
...(options as any),
}),
move(join('tools/generators', options.name)),
]);
return chain([
branchAndMerge(chain([mergeWith(templateSource)])),
formatFiles(options),
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment