Skip to content

Commit 1d35007

Browse files
update deletion logic to account for unannotated files
1 parent 3a5a739 commit 1d35007

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/convert/private-types.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,3 @@ describe("transform type annotations", () => {
7070
});
7171
});
7272
});
73-
74-

src/runner/run-primary-async.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,15 @@ export async function runPrimaryAsync(options: ConvertCommandCliArgs) {
197197
logger.info("Deleting all the Flow files.");
198198
const toRemoveCalls = [];
199199
for (const flowFilePath of flowFilePaths) {
200-
toRemoveCalls.push(fs.remove(flowFilePath.filePath));
200+
const wasSkipped =
201+
(flowFilePath.fileType === FlowFileType.NO_FLOW &&
202+
options.skipNoFlow) ||
203+
(flowFilePath.fileType === FlowFileType.NO_ANNOTATION &&
204+
!options.convertUnannotated);
205+
206+
if (!wasSkipped) {
207+
toRemoveCalls.push(fs.remove(flowFilePath.filePath));
208+
}
201209
}
202210
await Promise.all(toRemoveCalls);
203211
} else {

0 commit comments

Comments
 (0)