From 70e9f1849710dbd549295046bf6c6eee15ec6830 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Wed, 18 Feb 2026 19:49:24 -0600 Subject: [PATCH] feat(api): add showDryRunPreview function --- api-docs/scripts/generate-openapi-articles.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/api-docs/scripts/generate-openapi-articles.ts b/api-docs/scripts/generate-openapi-articles.ts index bdb19d269..e2efc3bc9 100644 --- a/api-docs/scripts/generate-openapi-articles.ts +++ b/api-docs/scripts/generate-openapi-articles.ts @@ -251,6 +251,36 @@ function cleanProductOutputs(productKey: string, config: ProductConfig): void { } } +/** + * Display dry-run preview of what would be cleaned + * + * @param productKey - Product identifier + * @param config - Product configuration + */ +function showDryRunPreview(productKey: string, config: ProductConfig): void { + const { directories, files } = getCleanupPaths(productKey, config); + + console.log(`\nDRY RUN: Would clean the following for ${productKey}:\n`); + + if (directories.length > 0) { + console.log('Directories to remove:'); + directories.forEach((dir) => console.log(` - ${dir}`)); + } + + if (files.length > 0) { + console.log('\nFiles to remove:'); + files.forEach((file) => console.log(` - ${file}`)); + } + + if (directories.length === 0 && files.length === 0) { + console.log(' (no files to clean)'); + } + + console.log( + `\nSummary: ${directories.length} directories, ${files.length} files would be removed` + ); +} + /** * Generate Hugo data files from OpenAPI specification *