()
| 156 | } |
| 157 | |
| 158 | static async getConfigPaths(): Promise<string[]> { |
| 159 | const settings = this.getSettings(); |
| 160 | const typeScriptSupport = settings.preferTs ?? Utils.detectTypeScriptSupport(); |
| 161 | const paths: string[] = []; |
| 162 | |
| 163 | if (process.env.MIKRO_ORM_CLI_CONFIG) { |
| 164 | paths.push(process.env.MIKRO_ORM_CLI_CONFIG); |
| 165 | } |
| 166 | |
| 167 | paths.push(...(settings.configPaths || [])); |
| 168 | |
| 169 | if (typeScriptSupport) { |
| 170 | paths.push('./src/mikro-orm.config.ts'); |
| 171 | paths.push('./mikro-orm.config.ts'); |
| 172 | } |
| 173 | |
| 174 | const distDir = fs.pathExists(process.cwd() + '/dist'); |
| 175 | const buildDir = fs.pathExists(process.cwd() + '/build'); |
| 176 | /* v8 ignore next */ |
| 177 | const path = distDir ? 'dist' : buildDir ? 'build' : 'src'; |
| 178 | paths.push(`./${path}/mikro-orm.config.js`); |
| 179 | paths.push('./mikro-orm.config.js'); |
| 180 | |
| 181 | /* v8 ignore next */ |
| 182 | return Utils.unique(paths).filter(p => !/\.[mc]?ts$/.exec(p) || typeScriptSupport); |
| 183 | } |
| 184 | |
| 185 | private static async getConfigFile(paths: string[]): Promise<[string, unknown] | []> { |
| 186 | for (let path of paths) { |
no test coverage detected