Skip to content

Commit 4cbb47c

Browse files
committedMay 22, 2024
fix: check for valid cache removal when running with no cache
1 parent 3ad552e commit 4cbb47c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
 

‎packages/core/src/unlighthouse.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,14 @@ export async function createUnlighthouse(userConfig: UserConfig, provider?: Prov
258258
})
259259
}
260260

261-
if (!resolvedConfig.cache && existsSync(resolvedConfig.outputPath)) {
262-
logger.debug(`\`cache\` is disabled, deleting cache folder: \`${resolvedConfig.outputPath}\``)
263-
fs.rmSync(ctx.runtimeSettings.outputPath, { recursive: true })
261+
if (!resolvedConfig.cache && existsSync(ctx.runtimeSettings.outputPath)) {
262+
logger.debug(`\`cache\` is disabled, deleting cache folder: \`${ctx.runtimeSettings.outputPath}\``)
263+
try {
264+
fs.rmSync(ctx.runtimeSettings.outputPath, { recursive: true })
265+
}
266+
catch (e) {
267+
logger.debug(`Failed to delete cache folder: \`${ctx.runtimeSettings.outputPath}\``, e)
268+
}
264269
}
265270
fs.ensureDirSync(ctx.runtimeSettings.outputPath)
266271
await generateClient()

0 commit comments

Comments
 (0)
Please sign in to comment.