Skip to content

Commit e53a403

Browse files
committed
refactor: enhance copyFilesToFolder function to create target directory if it doesn't exist
1 parent b4338d7 commit e53a403

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

_build_scripts/build-component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ async function copyHTMLFiles(srcFolder: string, distFile: string) {
8888
}
8989

9090
export async function copyFilesToFolder(sourceDir: string, targetDir: string) {
91+
// if the targetDir does not exist, create it
92+
try {
93+
await Deno.stat(targetDir);
94+
} catch (error) {
95+
await Deno.mkdir(targetDir, { recursive: true });
96+
}
97+
9198
for await (const entry of Deno.readDir(sourceDir)) {
9299
const srcPath = `${sourceDir}/${entry.name}`;
93100
const distPath = `${targetDir}/${entry.name}`;

_build_scripts/build.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ async function cleaerDistFolder() {
1515
await cleaerDistFolder();
1616

1717
// Components
18-
19-
await buildComponent("material-icon");
20-
await copyFilesToFolder("components/material-icon/icons", "dist/components/material-icon/icons");
18+
await copyFilesToFolder("components/styles", "dist/components/styles");
2119

2220
await buildComponent("activity-state");
2321
await buildComponent("app-header");
@@ -37,6 +35,7 @@ await buildComponent("tool-bar");
3735
await buildComponent("tree-view");
3836
await buildComponent("ollama-ui");
3937

38+
4039
// Modules
4140
await buildSrcFile("modules/canvas.js");
4241
await buildSrcFile("modules/component.js");

0 commit comments

Comments
 (0)