File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -75,10 +75,18 @@ const getConfig = async (args) => {
75
75
let userConfigFileOptions = { } ;
76
76
if ( args . config ) {
77
77
try {
78
- const config = await jiti . import ( path . resolve ( args . config ) ) ;
78
+ let config = { } ;
79
+ let filepath = '' ;
80
+ if ( args . config . endsWith ( '.js' ) || args . config . endsWith ( '.ts' ) ) {
81
+ config = await jiti . import ( path . resolve ( args . config ) ) ;
82
+ filepath = jiti . esmResolve ( path . resolve ( args . config ) ) ;
83
+ } else {
84
+ const explorer = cosmiconfig ( 'migrations' ) ;
85
+ const explorerResult = await explorer . load ( args . config ) ;
86
+ config = explorerResult . config ;
87
+ filepath = explorerResult . filepath ;
88
+ }
79
89
if ( config ) {
80
- const filepath = jiti . esmResolve ( path . resolve ( args . config ) ) ;
81
-
82
90
userConfigFileOptions = {
83
91
directory : path . resolve ( path . dirname ( filepath || '' ) , args . directory || 'migrations' ) ,
84
92
...( config || { } ) ,
You can’t perform that action at this time.
0 commit comments