From 1270d0f329360613bdc1b64fbb85fcc425c100f6 Mon Sep 17 00:00:00 2001 From: almeidx Date: Sun, 13 Apr 2025 20:17:03 +0100 Subject: [PATCH] fix: structure imports on windows --- packages/create-discord-bot/template/Deno/src/util/loaders.ts | 4 ++-- .../template/JavaScript/src/util/loaders.js | 4 ++-- .../template/TypeScript/src/util/loaders.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/create-discord-bot/template/Deno/src/util/loaders.ts b/packages/create-discord-bot/template/Deno/src/util/loaders.ts index 1c2ab9ea6ca9..ee76051b3091 100644 --- a/packages/create-discord-bot/template/Deno/src/util/loaders.ts +++ b/packages/create-discord-bot/template/Deno/src/util/loaders.ts @@ -1,6 +1,6 @@ import type { PathLike } from 'node:fs'; import { readdir, stat } from 'node:fs/promises'; -import { fileURLToPath, URL } from 'node:url'; +import { URL } from 'node:url'; import type { Command } from '../commands/index.ts'; import { predicate as commandPredicate } from '../commands/index.ts'; import type { Event } from '../events/index.ts'; @@ -57,7 +57,7 @@ export async function loadStructures( } // Import the structure dynamically from the file - const structure = (await import(fileURLToPath(fileUrl))).default; + const structure = (await import(fileUrl.toString())).default; // If the structure is a valid structure, add it if (predicate(structure)) { diff --git a/packages/create-discord-bot/template/JavaScript/src/util/loaders.js b/packages/create-discord-bot/template/JavaScript/src/util/loaders.js index 81776ad72a7c..860ccb9bdb2d 100644 --- a/packages/create-discord-bot/template/JavaScript/src/util/loaders.js +++ b/packages/create-discord-bot/template/JavaScript/src/util/loaders.js @@ -1,5 +1,5 @@ import { readdir, stat } from 'node:fs/promises'; -import { fileURLToPath, URL } from 'node:url'; +import { URL } from 'node:url'; import { predicate as commandPredicate } from '../commands/index.js'; import { predicate as eventPredicate } from '../events/index.js'; @@ -54,7 +54,7 @@ export async function loadStructures(dir, predicate, recursive = true) { } // Import the structure dynamically from the file - const structure = (await import(fileURLToPath(fileUrl))).default; + const structure = (await import(fileUrl.toString())).default; // If the structure is a valid structure, add it if (predicate(structure)) { diff --git a/packages/create-discord-bot/template/TypeScript/src/util/loaders.ts b/packages/create-discord-bot/template/TypeScript/src/util/loaders.ts index cb79ff7a6cbb..cd79a5327a4a 100644 --- a/packages/create-discord-bot/template/TypeScript/src/util/loaders.ts +++ b/packages/create-discord-bot/template/TypeScript/src/util/loaders.ts @@ -1,6 +1,6 @@ import type { PathLike } from 'node:fs'; import { readdir, stat } from 'node:fs/promises'; -import { fileURLToPath, URL } from 'node:url'; +import { URL } from 'node:url'; import type { Command } from '../commands/index.[REPLACE_IMPORT_EXT]'; import { predicate as commandPredicate } from '../commands/index.[REPLACE_IMPORT_EXT]'; import type { Event } from '../events/index.[REPLACE_IMPORT_EXT]'; @@ -57,7 +57,7 @@ export async function loadStructures( } // Import the structure dynamically from the file - const structure = (await import(fileURLToPath(fileUrl))).default; + const structure = (await import(fileUrl.toString())).default; // If the structure is a valid structure, add it if (predicate(structure)) structures.push(structure);