* @inheritDoc
(args: ArgumentsCamelCase<BaseArgs>)
| 12 | * @inheritDoc |
| 13 | */ |
| 14 | async handler(args: ArgumentsCamelCase<BaseArgs>) { |
| 15 | CLIHelper.dump(`Current ${colors.cyan('MikroORM')} CLI configuration`); |
| 16 | CLIHelper.dumpDependencies(); |
| 17 | const settings = CLIHelper.getSettings(); |
| 18 | |
| 19 | if (!process.versions.bun && settings.preferTs !== false) { |
| 20 | const loader = process.env.MIKRO_ORM_CLI_TS_LOADER ?? 'auto'; |
| 21 | CLIHelper.dump(' - TypeScript support ' + colors.green(`enabled (${loader})`)); |
| 22 | } |
| 23 | |
| 24 | const configPaths = args.config ?? (await CLIHelper.getConfigPaths()); |
| 25 | CLIHelper.dump(' - searched config paths:'); |
| 26 | await DebugCommand.checkPaths(configPaths, 'yellow'); |
| 27 | CLIHelper.dump(` - searched for config name: ${colors.green(args.contextName)}`); |
| 28 | |
| 29 | try { |
| 30 | const config = await CLIHelper.getConfiguration(args.contextName, configPaths); |
| 31 | CLIHelper.dump(` - configuration ${colors.green('found')}`); |
| 32 | const drivers = CLIHelper.getDriverDependencies(config); |
| 33 | |
| 34 | CLIHelper.dump(' - driver dependencies:'); |
| 35 | for (const driver of drivers) { |
| 36 | CLIHelper.dump(` - ${driver} ${CLIHelper.getModuleVersion(driver)}`); |
| 37 | } |
| 38 | |
| 39 | const isConnected = await CLIHelper.isDBConnected(config, true); |
| 40 | |
| 41 | if (isConnected === true) { |
| 42 | CLIHelper.dump(` - ${colors.green('database connection successful')}`); |
| 43 | } else { |
| 44 | CLIHelper.dump(` - ${colors.yellow(`database connection failed (${isConnected})`)}`); |
| 45 | } |
| 46 | |
| 47 | const preferTs = config.get('preferTs'); |
| 48 | |
| 49 | if ([true, false].includes(preferTs as boolean)) { |
| 50 | const warning = preferTs ? ' (this value should be set to `false` when running compiled code!)' : ''; |
| 51 | CLIHelper.dump( |
| 52 | ` - \`preferTs\` flag explicitly set to ${preferTs}, will use \`entities${preferTs ? 'Ts' : ''}\` array${warning}`, |
| 53 | ); |
| 54 | } |
| 55 | |
| 56 | const entities = config.get('entities', []); |
| 57 | |
| 58 | if (entities.length > 0) { |
| 59 | const refs = entities.filter(p => typeof p !== 'string'); |
| 60 | const paths = entities.filter(p => typeof p === 'string'); |
| 61 | const will = !config.get('preferTs') ? 'will' : 'could'; |
| 62 | CLIHelper.dump( |
| 63 | ` - ${will} use \`entities\` array (contains ${refs.length} references and ${paths.length} paths)`, |
| 64 | ); |
| 65 | |
| 66 | if (paths.length > 0) { |
| 67 | await DebugCommand.checkPaths(paths, 'red', config.get('baseDir')); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | const entitiesTs = config.get('entitiesTs', []); |
no test coverage detected