From f98c12a9c5c5719b0f3ca4e00ab3f2a52901b5c0 Mon Sep 17 00:00:00 2001 From: "Sakamoto, Kazunori" Date: Tue, 26 Sep 2023 14:24:02 +0900 Subject: [PATCH] fix: make updateHashFromFiles() create directory --- packages/shared-lib-node/src/hash.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/shared-lib-node/src/hash.ts b/packages/shared-lib-node/src/hash.ts index 00726e4f..374fde3d 100644 --- a/packages/shared-lib-node/src/hash.ts +++ b/packages/shared-lib-node/src/hash.ts @@ -30,6 +30,7 @@ export async function updateHashFromFiles(hashFilePath: string, ...paths: string const newHash = await calculateHashFromFiles(...paths); if (oldHash === newHash) return false; + await fs.promises.mkdir(path.dirname(hashFilePath), { recursive: true }); await fs.promises.writeFile(hashFilePath, newHash, 'utf8'); return true; }