From 57da5d4f6963b27728c2dffed3a3221f68cccc29 Mon Sep 17 00:00:00 2001 From: inlang-bot Date: Wed, 19 Jun 2024 12:36:37 +0000 Subject: [PATCH] [v 0.3.15]: new release of i18n-action --- dist/index.cjs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dist/index.cjs b/dist/index.cjs index d2fb81c..81ab95b 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -59750,10 +59750,17 @@ async function readModuleFromCache(moduleURI, projectPath, readFile) { const filePath = projectPath + `/cache/modules/${moduleHash}`; return await tryCatch(async () => await readFile(filePath, { encoding: "utf-8" })); } -async function writeModuleToCache(moduleURI, moduleContent, projectPath, writeFile) { +async function writeModuleToCache(moduleURI, moduleContent, projectPath, writeFile, mkdir) { const moduleHash = escape(moduleURI); const filePath = projectPath + `/cache/modules/${moduleHash}`; - await writeFile(filePath, moduleContent); + try { + await writeFile(filePath, moduleContent); + } catch (e) { + if (!(e instanceof Error) || !e.message.includes("ENONET")) + return; + await mkdir(projectPath + `/cache/modules`, { recursive: true }); + await writeFile(filePath, moduleContent); + } } function withCache(moduleLoader, projectPath, nodeishFs) { return async (uri) => { @@ -59767,7 +59774,7 @@ function withCache(moduleLoader, projectPath, nodeishFs) { throw networkResult.error; } else { const moduleAsText = networkResult.data; - await writeModuleToCache(uri, moduleAsText, projectPath, nodeishFs.writeFile); + await writeModuleToCache(uri, moduleAsText, projectPath, nodeishFs.writeFile, nodeishFs.mkdir); return moduleAsText; } };