Skip to content

Commit b009465

Browse files
authored
Merge pull request #983 from acacode/backport-930
use import pattern that supports windows external drives
2 parents da2e3f0 + 1ad0095 commit b009465

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22

33
import { resolve } from "node:path";
4+
import { pathToFileURL } from "node:url";
45
import { cli } from "./cli/index.js";
56
import packageJson from "./package.json";
67
import { TemplatesGenConfig } from "./src/commands/generate-templates/configuration.js";
@@ -295,20 +296,21 @@ program.addCommand({
295296
const main = async () => {
296297
const { command, options } = await program.execute({ args: process.argv });
297298

298-
let customConfig = null;
299-
let customConfigPath;
299+
let customConfig;
300300

301301
if (options.customConfig) {
302302
try {
303-
customConfigPath = resolve(process.cwd(), options.customConfig);
303+
const customConfigPath = pathToFileURL(
304+
resolve(process.cwd(), options.customConfig),
305+
).toString();
304306
customConfig = await import(customConfigPath);
305307
customConfig = customConfig.default || customConfig;
308+
if (customConfig) {
309+
console.log(`✨ found custom config at: ${customConfigPath}`);
310+
}
306311
} catch (e) {
307312
console.error("Error loading custom config", e);
308313
}
309-
if (customConfig) {
310-
console.log(`✨ found custom config at: ${customConfigPath}`);
311-
}
312314
}
313315

314316
try {

0 commit comments

Comments
 (0)