Skip to content

Commit 1d49b4e

Browse files
authored
Merge pull request #930 from thechucklingatom/main
use import pattern that supports windows external drives
2 parents 1df670e + dd46e5e commit 1d49b4e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as path from "node:path";
2+
import * as url from "node:url";
23
import { defineCommand, runMain } from "citty";
34
import { consola } from "consola";
45
import packageJson from "./package.json" with { type: "json" };
@@ -276,23 +277,23 @@ const generateCommand = defineCommand({
276277
if (args.debug) consola.level = Number.MAX_SAFE_INTEGER;
277278
if (args.silent) consola.level = 0;
278279

279-
let customConfig = null;
280-
let customConfigPath: string | undefined;
280+
let customConfig;
281281

282282
if (args["custom-config"]) {
283283
try {
284-
customConfigPath = path.resolve(process.cwd(), args["custom-config"]);
284+
const customConfigPath = url
285+
.pathToFileURL(path.resolve(process.cwd(), args["custom-config"]))
286+
.toString();
285287
customConfig = await import(customConfigPath);
286288
customConfig = customConfig.default || customConfig;
289+
if (customConfig) {
290+
consola.info(`Found custom config at: ${customConfigPath}`);
291+
}
287292
} catch (error) {
288293
consola.error("Error loading custom config:", error);
289294
}
290295
}
291296

292-
if (customConfig) {
293-
consola.info(`Found custom config at: ${customConfigPath}`);
294-
}
295-
296297
await generateApi({
297298
addReadonly: args["add-readonly"],
298299
anotherArrayType: args["another-array-type"],

0 commit comments

Comments
 (0)