This commit is contained in:
Vendicated 2023-04-19 21:49:12 +02:00
parent 525aa3af33
commit 3171b78a36
No known key found for this signature in database
GPG Key ID: A1DC0CFB5615D905

@ -16,16 +16,26 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { cpSync, rmSync } from "fs"; import { cpSync, readdirSync, rmSync } from "fs";
import { join } from "path"; import { join } from "path";
const SRC = join(__dirname, "..", "..", "src");
for (const file of ["preload.d.ts", "userplugins", "main", "debug"]) { 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"]) { function copyDtsFiles(from: string, to: string) {
cpSync( for (const file of readdirSync(from, { withFileTypes: true })) {
join(__dirname, "..", "..", "src", file), const fullFrom = join(from, file.name);
join(__dirname, "dist", file) 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);