Merge branch 'main' into fix/fix-lint
Some checks failed
Lint / lint (pull_request) Failing after 5m58s
Some checks failed
Lint / lint (pull_request) Failing after 5m58s
# Conflicts: # main.ts
This commit is contained in:
23
main.ts
23
main.ts
@@ -12,11 +12,12 @@ import { analyzeSwagger } from './src/swagger/analyzer';
|
||||
import { generateCode, organizeFiles, addDtoImports } from './src/generators/dto.generator';
|
||||
import {
|
||||
generateCleanArchitecture,
|
||||
extractTagsFromAnalysis
|
||||
extractTagsWithOperations
|
||||
} from './src/generators/clean-arch.generator';
|
||||
import { generateReport } from './src/generators/report.generator';
|
||||
import { findEnvironmentFile, parseApiKeys } from './src/utils/environment-finder';
|
||||
import { askApiKeysForTags } from './src/utils/prompt';
|
||||
import { askApiKeysForTags, askSelectionFilter } from './src/utils/prompt';
|
||||
import type { SelectionFilter } from './src/types';
|
||||
import type { CliOptions } from './src/types';
|
||||
import packageJson from './package.json';
|
||||
|
||||
@@ -40,6 +41,7 @@ program
|
||||
)
|
||||
.option('--skip-install', 'No instalar dependencias')
|
||||
.option('--dry-run', 'Simular sin generar archivos')
|
||||
.option('-s, --select-endpoints', 'Seleccionar interactivamente qué tags y endpoints generar')
|
||||
.parse(process.argv);
|
||||
|
||||
const options = program.opts<CliOptions>();
|
||||
@@ -88,8 +90,19 @@ async function main(): Promise<void> {
|
||||
|
||||
createDirectoryStructure(options.output);
|
||||
|
||||
// ── SELECTION: tags and endpoints ─────────────────────────────────────────
|
||||
const tagSummaries = extractTagsWithOperations(analysis);
|
||||
let selectionFilter: SelectionFilter = {};
|
||||
|
||||
if (options.selectEndpoints) {
|
||||
selectionFilter = await askSelectionFilter(tagSummaries);
|
||||
}
|
||||
|
||||
const selectedTags = options.selectEndpoints
|
||||
? Object.keys(selectionFilter)
|
||||
: tagSummaries.map((t) => t.tag);
|
||||
|
||||
// ── ENVIRONMENT API KEY SELECTION ──────────────────────────────────────────
|
||||
const tags = extractTagsFromAnalysis(analysis);
|
||||
const envFile = findEnvironmentFile(process.cwd());
|
||||
let apiKeys: ReturnType<typeof parseApiKeys> = [];
|
||||
|
||||
@@ -112,13 +125,13 @@ async function main(): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
const tagApiKeyMap = await askApiKeysForTags(tags, apiKeys);
|
||||
const tagApiKeyMap = await askApiKeysForTags(selectedTags, apiKeys);
|
||||
// ──────────────────────────────────────────────────────────────────────────
|
||||
|
||||
const tempDir = generateCode(options.input, options.templates);
|
||||
organizeFiles(tempDir, options.output);
|
||||
addDtoImports(options.output);
|
||||
generateCleanArchitecture(analysis, options.output, options.templates, tagApiKeyMap);
|
||||
generateCleanArchitecture(analysis, options.output, options.templates, tagApiKeyMap, selectionFilter);
|
||||
cleanup(tempDir);
|
||||
|
||||
const report = generateReport(options.output, analysis);
|
||||
|
||||
Reference in New Issue
Block a user