generator.ts
import { formatFiles, Tree } from '@nx/devkit';
import { libraryGenerator as ngLibraryGenerator } from '@nx/angular/generators';
import { LibraryGeneratorSchema } from './schema';

export async function libraryGenerator(
  tree: Tree,
  options: LibraryGeneratorSchema
) {
  await ngLibraryGenerator(tree, {
    name: options.name,
    directory: `libs/${options.layer}`,
    tags: [`layer:${options.layer}`, options.tags].filter(Boolean).join(','),
  });
  await formatFiles(tree);
}

export default libraryGenerator;