evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Create a custom Nx generator that adds a new library to a workspace and write comprehensive tests for it using Nx testing utilities.
Implement a generator named library that:
name option (string, required) for the library namedirectory option (string, optional) for the library locationWrite tests for the generator that:
The generator should create:
src/index.ts file with a basic exported functionproject.json file with appropriate configurationimport { Tree } from '@nx/devkit';
export interface LibraryGeneratorSchema {
name: string;
directory?: string;
}
export async function libraryGenerator(
tree: Tree,
options: LibraryGeneratorSchema
): Promise<void>;Provides tree manipulation, configuration utilities, and testing utilities for Nx plugin development.