From 3171b78a36c88cbacafe1d1c3b7b36872b3b5210 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 19 Apr 2023 21:49:12 +0200 Subject: [PATCH] stuffs 2 --- packages/vencord-types/prepare.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/packages/vencord-types/prepare.ts b/packages/vencord-types/prepare.ts index f278204d..1f2e08d6 100644 --- a/packages/vencord-types/prepare.ts +++ b/packages/vencord-types/prepare.ts @@ -16,16 +16,26 @@ * along with this program. If not, see . */ -import { cpSync, rmSync } from "fs"; +import { cpSync, readdirSync, rmSync } from "fs"; import { join } from "path"; +const SRC = join(__dirname, "..", "..", "src"); + for (const file of ["preload.d.ts", "userplugins", "main", "debug"]) { - rmSync(join(__dirname, "dist", file), { recursive: true, force: true }); + rmSync(join(__dirname, file), { recursive: true, force: true }); } -for (const file of ["globals.d.ts", "modules.d.ts"]) { - cpSync( - join(__dirname, "..", "..", "src", file), - join(__dirname, "dist", file) - ); +function copyDtsFiles(from: string, to: string) { + for (const file of readdirSync(from, { withFileTypes: true })) { + const fullFrom = join(from, file.name); + const fullTo = join(to, file.name); + + if (file.isDirectory()) { + copyDtsFiles(fullFrom, fullTo); + } else if (file.name.endsWith(".d.ts")) { + cpSync(fullFrom, fullTo); + } + } } + +copyDtsFiles(SRC, __dirname);