Skip to content

Commit

Permalink
fix: safer directory cache removal
Browse files Browse the repository at this point in the history
Fixes #200
  • Loading branch information
harlan-zw committed Apr 24, 2024
1 parent e4619d9 commit 720dc9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/unlighthouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export async function createUnlighthouse(userConfig: UserConfig, provider?: Prov

if (!resolvedConfig.cache && existsSync(resolvedConfig.outputPath)) {
logger.debug(`\`cache\` is disabled, deleting cache folder: \`${resolvedConfig.outputPath}\``)
fs.rmSync(resolvedConfig.outputPath, { recursive: true })
fs.rmSync(outputPath, { recursive: true })
}
fs.ensureDirSync(ctx.runtimeSettings.outputPath)
return ctx
Expand Down Expand Up @@ -260,7 +260,7 @@ export async function createUnlighthouse(userConfig: UserConfig, provider?: Prov

if (!resolvedConfig.cache && existsSync(resolvedConfig.outputPath)) {
logger.debug(`\`cache\` is disabled, deleting cache folder: \`${resolvedConfig.outputPath}\``)
fs.rmSync(resolvedConfig.outputPath, { recursive: true })
fs.rmSync(ctx.runtimeSettings.outputPath, { recursive: true })
}
fs.ensureDirSync(ctx.runtimeSettings.outputPath)
await generateClient()
Expand Down

0 comments on commit 720dc9d

Please sign in to comment.