From 0ae59c2fd743fa7420ce3d2353f53b5851520d74 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Fri, 17 Jan 2025 20:15:09 -0600 Subject: [PATCH] fix: check dir exists --- packages/scripts/src/applyPatches.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/scripts/src/applyPatches.ts b/packages/scripts/src/applyPatches.ts index 878b4c27a..a01793432 100644 --- a/packages/scripts/src/applyPatches.ts +++ b/packages/scripts/src/applyPatches.ts @@ -1,4 +1,5 @@ import { assertSecret } from '@blitzkit/core'; +import { existsSync } from 'fs'; import { mkdir, writeFile } from 'fs/promises'; import { parse as parsePath } from 'path'; import ProgressBar from 'progress'; @@ -48,8 +49,12 @@ while (true) { await Promise.all( files.map(async ({ path, data }) => { const { dir } = parsePath(path); + const dirPath = `${DATA}/${dir}`; + + if (!existsSync(dirPath)) { + await mkdir(dirPath, { recursive: true }); + } - await mkdir(`${DATA}/${dir}`, { recursive: true }); await writeFile( `${DATA}/${path}`, new Uint8Array(writeDVPL(Buffer.from(data))),