Skip to content

Commit

Permalink
🐛 Ensure assets exists before copying
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Dec 19, 2023
1 parent df0e84a commit 4da4652
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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("../..");
};

0 comments on commit 4da4652

Please sign in to comment.