Skip to content

Commit

Permalink
Avoid clearing stale type folders when used with --single-path flag (
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-c-martin authored Sep 10, 2024
1 parent 34048ce commit e2687f0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/generator/src/cmd/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ ${err}
// build the type index
await buildTypeIndex(defaultLogger, outputBaseDir);

// log if there are any type dirs with no corresponding readme (e.g. if a swagger directory has been removed).
const shouldRebuildTypeIndex = await clearStaleTypeFolders(defaultLogger, outputBaseDir, specsPath, readmePaths);

if (shouldRebuildTypeIndex) {
await buildTypeIndex(defaultLogger, outputBaseDir);
// we only want to clear stale type folders if re-generating the full directory
if (!singlePath) {
// log if there are any type dirs with no corresponding readme (e.g. if a swagger directory has been removed).
const shouldRebuildTypeIndex = await clearStaleTypeFolders(defaultLogger, outputBaseDir, specsPath, readmePaths);

if (shouldRebuildTypeIndex) {
await buildTypeIndex(defaultLogger, outputBaseDir);
}
}
});

Expand Down

0 comments on commit e2687f0

Please sign in to comment.