From b31a34c76216c6186a90f3da83a8236919d7f47a Mon Sep 17 00:00:00 2001 From: Christian Liebel Date: Mon, 7 Oct 2024 10:18:15 -0400 Subject: [PATCH] Lab #3 --- .../src/generators/my-generator/generator.ts | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tools/my-plugin/src/generators/my-generator/generator.ts b/tools/my-plugin/src/generators/my-generator/generator.ts index 64afd6d..8b2f346 100644 --- a/tools/my-plugin/src/generators/my-generator/generator.ts +++ b/tools/my-plugin/src/generators/my-generator/generator.ts @@ -1,25 +1,17 @@ -import { - addProjectConfiguration, - formatFiles, - generateFiles, - Tree, -} from '@nx/devkit'; -import * as path from 'path'; +import { applicationGenerator } from '@nx/angular/generators'; +import { Tree } from '@nx/devkit'; 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: {}, + await applicationGenerator(tree, { + name: options.name, + routing: true, + prefix: options.name, + style: 'scss', }); - generateFiles(tree, path.join(__dirname, 'files'), projectRoot, options); - await formatFiles(tree); } export default myGeneratorGenerator;