Skip to content

Commit

Permalink
chore: 컴포넌트 디렉토리 존재하지 않는 경우 예외 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
ghdtjgus76 committed May 30, 2024
1 parent 8ea29c1 commit 1ffb655
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/scripts/generateReactComponentFromSvg.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { promises as fs } from "fs";
import { existsSync, promises as fs } from "fs";
import path from "path";

const SVG_DIR = "../wow-icons/src/svg";
Expand All @@ -23,6 +23,11 @@ const generateSvgComponentMap = async () => {
};

const deleteUnusedComponentFiles = async (svgComponentMap: SvgComponentMap) => {
if (!existsSync(COMPONENT_DIR)) {
fs.mkdir(COMPONENT_DIR);
return;
}

const componentFiles = await fs.readdir(COMPONENT_DIR);
const componentFilesToDelete = componentFiles.filter((componentFile) => {
const componentName = path.basename(componentFile, ".tsx");
Expand Down

0 comments on commit 1ffb655

Please sign in to comment.