File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
2
3
3
import { resolve } from "node:path" ;
4
+ import { pathToFileURL } from "node:url" ;
4
5
import { cli } from "./cli/index.js" ;
5
6
import packageJson from "./package.json" ;
6
7
import { TemplatesGenConfig } from "./src/commands/generate-templates/configuration.js" ;
@@ -295,20 +296,21 @@ program.addCommand({
295
296
const main = async ( ) => {
296
297
const { command, options } = await program . execute ( { args : process . argv } ) ;
297
298
298
- let customConfig = null ;
299
- let customConfigPath ;
299
+ let customConfig ;
300
300
301
301
if ( options . customConfig ) {
302
302
try {
303
- customConfigPath = resolve ( process . cwd ( ) , options . customConfig ) ;
303
+ const customConfigPath = pathToFileURL (
304
+ resolve ( process . cwd ( ) , options . customConfig ) ,
305
+ ) . toString ( ) ;
304
306
customConfig = await import ( customConfigPath ) ;
305
307
customConfig = customConfig . default || customConfig ;
308
+ if ( customConfig ) {
309
+ console . log ( `✨ found custom config at: ${ customConfigPath } ` ) ;
310
+ }
306
311
} catch ( e ) {
307
312
console . error ( "Error loading custom config" , e ) ;
308
313
}
309
- if ( customConfig ) {
310
- console . log ( `✨ found custom config at: ${ customConfigPath } ` ) ;
311
- }
312
314
}
313
315
314
316
try {
You can’t perform that action at this time.
0 commit comments