Skip to content

Commit

Permalink
Merge pull request #930 from thechucklingatom/main
Browse files Browse the repository at this point in the history
use import pattern that supports windows external drives
  • Loading branch information
smorimoto authored Oct 29, 2024
2 parents 1df670e + dd46e5e commit 1d49b4e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as path from "node:path";
import * as url from "node:url";
import { defineCommand, runMain } from "citty";
import { consola } from "consola";
import packageJson from "./package.json" with { type: "json" };
Expand Down Expand Up @@ -276,23 +277,23 @@ const generateCommand = defineCommand({
if (args.debug) consola.level = Number.MAX_SAFE_INTEGER;
if (args.silent) consola.level = 0;

let customConfig = null;
let customConfigPath: string | undefined;
let customConfig;

if (args["custom-config"]) {
try {
customConfigPath = path.resolve(process.cwd(), args["custom-config"]);
const customConfigPath = url
.pathToFileURL(path.resolve(process.cwd(), args["custom-config"]))
.toString();
customConfig = await import(customConfigPath);
customConfig = customConfig.default || customConfig;
if (customConfig) {
consola.info(`Found custom config at: ${customConfigPath}`);
}
} catch (error) {
consola.error("Error loading custom config:", error);
}
}

if (customConfig) {
consola.info(`Found custom config at: ${customConfigPath}`);
}

await generateApi({
addReadonly: args["add-readonly"],
anotherArrayType: args["another-array-type"],
Expand Down

0 comments on commit 1d49b4e

Please sign in to comment.