From 4da4652b04c6360b7853f06b26c7c353105ae79e Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Tue, 19 Dec 2023 13:13:25 +0100 Subject: [PATCH] :bug: Ensure assets exists before copying --- src/site.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/site.ts b/src/site.ts index 46567e13..23a0ec2f 100644 --- a/src/site.ts +++ b/src/site.ts @@ -39,13 +39,12 @@ export const generateSite = async () => { exec("npm run export"); mkdir("-p", "status-page/__sapper__/export"); cp("-r", "__sapper__/export/*", "status-page/__sapper__/export"); + let assetsExists = false; try { - console.log("../assets", (await stat("../assets")).size); - console.log("../../assets", (await stat("../../assets")).size); - console.log("../../../assets", (await stat("../../../assets")).size); - // cp("-r", "../assets/*", "status-page/__sapper__/export"); + assetsExists = (await stat("../assets")).size > 0; } catch (error) { - // Ignore errors if unable to find directory + // Ignore errors if assets folder doesn't exist } + if (assetsExists) cp("-r", "../assets/*", "status-page/__sapper__/export"); cd("../.."); };