feat: enhance DTO generation and organization by tag
This commit is contained in:
18
main.ts
18
main.ts
@@ -20,7 +20,9 @@ import { analyzeSwagger } from './src/swagger/analyzer';
|
||||
import { generateCode, organizeFiles, addDtoImports } from './src/generators/dto.generator';
|
||||
import {
|
||||
generateCleanArchitecture,
|
||||
extractTagsWithOperations
|
||||
extractTagsWithOperations,
|
||||
buildTagsMapFromAnalysis,
|
||||
buildSchemaTagMap
|
||||
} from './src/generators/clean-arch.generator';
|
||||
import { generateReport } from './src/generators/report.generator';
|
||||
import { lintGeneratedFiles } from './src/generators/lint.generator';
|
||||
@@ -193,14 +195,24 @@ async function main(): Promise<void> {
|
||||
// ──────────────────────────────────────────────────────────────────────────
|
||||
|
||||
const tempDir = generateCode(options.input, options.templates);
|
||||
organizeFiles(tempDir, options.output);
|
||||
|
||||
// Compute schema→tag map before organizeFiles so DTOs land in the right subfolder
|
||||
const tagsMapForSchema = buildTagsMapFromAnalysis(analysis, selectionFilter);
|
||||
const schemaTagMap = buildSchemaTagMap(
|
||||
(analysis.swagger as { components?: { schemas?: Record<string, unknown> } }).components
|
||||
?.schemas || {},
|
||||
tagsMapForSchema
|
||||
);
|
||||
|
||||
organizeFiles(tempDir, options.output, schemaTagMap);
|
||||
addDtoImports(options.output);
|
||||
generateCleanArchitecture(
|
||||
analysis,
|
||||
options.output,
|
||||
options.templates,
|
||||
tagApiKeyMap,
|
||||
selectionFilter
|
||||
selectionFilter,
|
||||
schemaTagMap
|
||||
);
|
||||
cleanup(tempDir);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user