MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / createBasicConfig

Function createBasicConfig

packages/cli/src/CLIConfigurator.ts:28–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26export interface BaseCommand<CommandArgs extends BaseArgs = BaseArgs> extends CommandModule<BaseArgs, CommandArgs> {}
27
28function createBasicConfig(): Argv<{ config: string[] | undefined; contextName: string }> {
29 return yargs()
30 .scriptName('mikro-orm')
31 .usage('Usage: $0 <command> [options]')
32 .example('$0 debug', 'Show debugging information')
33 .example('$0 schema:update --run', 'Runs schema synchronization')
34 .option('config', {
35 type: 'string',
36 array: true,
37 desc: `Set path to the ORM configuration file`,
38 })
39 .option('contextName', {
40 alias: 'context',
41 type: 'string',
42 desc: 'Set name of config to load out of the ORM configuration file. Used when config file exports an array or a function',
43 default: process.env.MIKRO_ORM_CONTEXT_NAME ?? 'default',
44 })
45 .alias('v', 'version')
46 .alias('h', 'help')
47 .recommendCommands()
48 .showHelpOnFail(true)
49 .demandCommand(1, '')
50 .strict();
51}
52
53export async function configure(): Promise<Argv<{ config: string[] | undefined; contextName: string }>> {
54 fs.checkPackageVersion();

Callers 1

configureFunction · 0.85

Calls 1

aliasMethod · 0.80

Tested by

no test coverage detected