Skip to content

Commit e3a594f

Browse files
committed
ensure the cache database path exists
1 parent 79dfe4e commit e3a594f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/utils/cache.server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'node:fs'
2+
import path from 'node:path'
23
import {
34
cachified as baseCachified,
45
verboseReporter,
@@ -21,6 +22,9 @@ const CACHE_DATABASE_PATH = process.env.CACHE_DATABASE_PATH
2122
const cacheDb = remember('cacheDb', createDatabase)
2223

2324
function createDatabase(tryAgain = true): DatabaseSync {
25+
const parentDir = path.dirname(CACHE_DATABASE_PATH)
26+
fs.mkdirSync(parentDir, { recursive: true })
27+
2428
const db = new DatabaseSync(CACHE_DATABASE_PATH)
2529

2630
try {

0 commit comments

Comments
 (0)