Slide 19
Slide 19 text
import { addProjectConfiguration, formatFiles, generateFiles, Tree } from '@nx/devkit';
import * as path from 'path';
import { MyGeneratorGeneratorSchema } from './schema';
export async function myGeneratorGenerator(tree: Tree, options: MyGeneratorGeneratorSchema) {
const projectRoot = `libs/${options.name}`;
addProjectConfiguration(tree, options.name, {
root: projectRoot, projectType: 'library', sourceRoot: `${projectRoot}/src`, targets: {}
});
generateFiles(tree, path.join(__dirname, 'files'), projectRoot, options);
await formatFiles(tree);
}
export default myGeneratorGenerator;
Generator Concepts
Scaffolding mit Nx Local Generators