From e03b5c7b539a65a16a246b39a8f819a4e0e53d88 Mon Sep 17 00:00:00 2001 From: ful1e5 <24286590+ful1e5@users.noreply.github.com> Date: Sun, 30 Aug 2020 10:04:48 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.ts | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/config.ts b/src/config.ts index 86f6db9..843b7b5 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,10 +1,31 @@ import { resolve } from "path"; -import { staticCursors, animatedCursors, animatedClip } from "./cursors.json"; +import { readdirSync, existsSync } from "fs"; // Source Directory const svgsDir = resolve(__dirname, "svg"); +if (!existsSync(svgsDir)) { + console.log("Source .svg files not found"); +} + +const staticCursorsDir = resolve(svgsDir, "static"); +const animatedCursorsDir = resolve(svgsDir, "animated"); // Out Directory const bitmapsDir = resolve(__dirname, "../", "bitmaps"); -export { staticCursors, animatedCursors, svgsDir, bitmapsDir, animatedClip }; +// Cursors +const staticCursors = readdirSync(staticCursorsDir).map((f) => + resolve(staticCursorsDir, f) +); +const animatedCursors = readdirSync(animatedCursorsDir).map((f) => + resolve(animatedCursorsDir, f) +); + +// Animated Config +const animatedClip = { + x: 4, + y: 4, + width: 200, + height: 200, +}; +export { staticCursors, animatedCursors, bitmapsDir, animatedClip };