nx/packages/node/src/generators/application/lib/normalized-schema.ts
Colum Ferry 8daad98992
chore(node): refactor application generator for more clarity (#31523)
## Current Behavior

The Node.js application generator
(`packages/node/src/generators/application/application.ts`) is
implemented as a single large file containing ~469 lines of code. All
generator logic is mixed together in one file including:

- Option normalization and validation
- Project configuration creation  
- File generation
- Build/serve target setup
- Dependency management
- ESLint configuration
- Proxy setup

This makes the code harder to maintain, test, and understand as the file
handles multiple responsibilities.

## Expected Behavior

The generator is now refactored into smaller, focused modules organized
in a `lib/` directory:

- `normalize-options.ts` - handles option normalization and validation
- `normalized-schema.ts` - defines the normalized schema interface  
- `create-project.ts` - handles project configuration creation (exported
as `addProject`)
- `create-files.ts` - handles file generation (exported as
`addAppFiles`)
- `create-targets.ts` - handles build/serve target configuration
- `add-dependencies.ts` - handles dependency management (exported as
`addProjectDependencies`)
- `add-linting.ts` - handles ESLint setup (exported as
`addLintingToApplication`)
- `add-proxy.ts` - handles proxy configuration (exported as `addProxy`)
- `index.ts` - exports all the functions

The main `application.ts` file is now much cleaner at ~15 lines,
focusing on orchestrating the generator workflow by calling the
extracted functions. This separation of concerns improves:

- **Maintainability**: Each file has a single responsibility
- **Testability**: Individual functions can be tested in isolation
- **Readability**: Easier to understand what each part does
- **Reusability**: Functions can be potentially reused by other
generators
2025-06-10 16:57:46 +01:00

10 lines
243 B
TypeScript

import { Schema } from '../schema';
export interface NormalizedSchema extends Omit<Schema, 'useTsSolution'> {
appProjectRoot: string;
parsedTags: string[];
outputPath: string;
importPath: string;
isUsingTsSolutionConfig: boolean;
}