@mikro-orm/cli 7.0.0-dev.85 → 7.0.0-dev.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,8 +37,8 @@ function createBasicConfig() {
37
37
  .strict();
38
38
  }
39
39
  export async function configure() {
40
- await fs.checkPackageVersion();
41
- const settings = await CLIHelper.getSettings();
40
+ fs.checkPackageVersion();
41
+ const settings = CLIHelper.getSettings();
42
42
  const version = Utils.getORMVersion();
43
43
  if (settings.preferTs !== false) {
44
44
  const preferTs = await CLIHelper.registerTypeScriptSupport(settings.tsConfigPath, settings.tsLoader);
package/CLIHelper.d.ts CHANGED
@@ -16,12 +16,12 @@ export declare class CLIHelper {
16
16
  static isDBConnected(config: Configuration, reason: true): Promise<true | string>;
17
17
  static getDriverDependencies(config: Configuration): string[];
18
18
  static dump(text: string, config?: Configuration): void;
19
- static getSettings(): Promise<Settings>;
19
+ static getSettings(): Settings;
20
20
  static getConfigPaths(): Promise<string[]>;
21
21
  private static getConfigFile;
22
22
  private static loadEnvironmentVars;
23
- static dumpDependencies(): Promise<void>;
24
- static getModuleVersion(name: string): Promise<string>;
23
+ static dumpDependencies(): void;
24
+ static getModuleVersion(name: string): string;
25
25
  /**
26
26
  * Resolve path to a module.
27
27
  * @param id The module to require
@@ -39,7 +39,7 @@ export declare class CLIHelper {
39
39
  * This method is used only in CLI context.
40
40
  */
41
41
  static registerTypeScriptSupport(configPath?: string, tsLoader?: 'swc' | 'tsx' | 'jiti' | 'tsimp' | 'auto'): Promise<boolean>;
42
- static isESM(): Promise<boolean>;
42
+ static isESM(): boolean;
43
43
  static showHelp(): void;
44
44
  }
45
45
  export interface Settings {
package/CLIHelper.js CHANGED
@@ -16,7 +16,7 @@ export class CLIHelper {
16
16
  */
17
17
  static async getConfiguration(contextName, paths, options = {}) {
18
18
  paths ??= await this.getConfigPaths();
19
- const deps = await fs.getORMPackages();
19
+ const deps = fs.getORMPackages();
20
20
  if (!deps.has('@mikro-orm/cli') && !process.env.MIKRO_ORM_ALLOW_GLOBAL_CLI) {
21
21
  throw new Error('@mikro-orm/cli needs to be installed as a local dependency!');
22
22
  }
@@ -80,12 +80,12 @@ export class CLIHelper {
80
80
  }
81
81
  }
82
82
  }
83
- const esmConfigOptions = await this.isESM() ? { entityGenerator: { esmImport: true } } : {};
83
+ const esmConfigOptions = this.isESM() ? { entityGenerator: { esmImport: true } } : {};
84
84
  return new Configuration(Utils.mergeConfig({}, esmConfigOptions, tmp, options, env));
85
85
  }
86
86
  static async getORM(contextName, configPaths, opts = {}) {
87
87
  const options = await this.getConfiguration(contextName, configPaths, opts);
88
- const settings = await this.getSettings();
88
+ const settings = this.getSettings();
89
89
  options.set('allowGlobalContext', true);
90
90
  options.set('debug', !!settings.verbose);
91
91
  options.getLogger().setDebugMode(!!settings.verbose);
@@ -125,8 +125,8 @@ export class CLIHelper {
125
125
  // eslint-disable-next-line no-console
126
126
  console.log(text);
127
127
  }
128
- static async getSettings() {
129
- const config = await fs.getPackageConfig();
128
+ static getSettings() {
129
+ const config = fs.getPackageConfig();
130
130
  const settings = { ...config['mikro-orm'] };
131
131
  const bool = (v) => ['true', 't', '1'].includes(v.toLowerCase());
132
132
  settings.preferTs = process.env.MIKRO_ORM_CLI_PREFER_TS != null ? bool(process.env.MIKRO_ORM_CLI_PREFER_TS) : settings.preferTs;
@@ -139,7 +139,7 @@ export class CLIHelper {
139
139
  return settings;
140
140
  }
141
141
  static async getConfigPaths() {
142
- const settings = await this.getSettings();
142
+ const settings = this.getSettings();
143
143
  const typeScriptSupport = settings.preferTs ?? Utils.detectTypeScriptSupport();
144
144
  const paths = [];
145
145
  if (process.env.MIKRO_ORM_CLI_CONFIG) {
@@ -199,7 +199,7 @@ export class CLIHelper {
199
199
  }
200
200
  return ret;
201
201
  }
202
- static async dumpDependencies() {
202
+ static dumpDependencies() {
203
203
  const version = Utils.getORMVersion();
204
204
  CLIHelper.dump(' - dependencies:');
205
205
  CLIHelper.dump(` - mikro-orm ${colors.green(version)}`);
@@ -210,7 +210,7 @@ export class CLIHelper {
210
210
  CLIHelper.dump(` - typescript via bun`);
211
211
  }
212
212
  else {
213
- CLIHelper.dump(` - typescript ${await CLIHelper.getModuleVersion('typescript')}`);
213
+ CLIHelper.dump(` - typescript ${CLIHelper.getModuleVersion('typescript')}`);
214
214
  }
215
215
  CLIHelper.dump(' - package.json ' + colors.green('found'));
216
216
  }
@@ -218,7 +218,7 @@ export class CLIHelper {
218
218
  CLIHelper.dump(' - package.json ' + colors.red('not found'));
219
219
  }
220
220
  }
221
- static async getModuleVersion(name) {
221
+ static getModuleVersion(name) {
222
222
  try {
223
223
  const path = `${this.resolveModulePath(name)}/package.json`;
224
224
  const pkg = fs.readJSONSync(path);
@@ -289,7 +289,7 @@ export class CLIHelper {
289
289
  continue;
290
290
  }
291
291
  const { esm, cjs, cb } = loaders[loader];
292
- const isEsm = await this.isESM();
292
+ const isEsm = this.isESM();
293
293
  /* v8 ignore next */
294
294
  const module = isEsm ? esm : cjs;
295
295
  const mod = await Utils.tryImport({ module });
@@ -303,8 +303,8 @@ export class CLIHelper {
303
303
  console.warn('Neither `swc`, `tsx`, `jiti` nor `tsimp` found in the project dependencies, support for working with TypeScript files might not work. To use `swc`, you need to install both `@swc-node/register` and `@swc/core`.');
304
304
  return false;
305
305
  }
306
- static async isESM() {
307
- const config = await fs.getPackageConfig();
306
+ static isESM() {
307
+ const config = fs.getPackageConfig();
308
308
  const type = config?.type ?? '';
309
309
  return type === 'module';
310
310
  }
@@ -9,8 +9,8 @@ export class DebugCommand {
9
9
  */
10
10
  async handler(args) {
11
11
  CLIHelper.dump(`Current ${colors.cyan('MikroORM')} CLI configuration`);
12
- await CLIHelper.dumpDependencies();
13
- const settings = await CLIHelper.getSettings();
12
+ CLIHelper.dumpDependencies();
13
+ const settings = CLIHelper.getSettings();
14
14
  if (!process.versions.bun && settings.preferTs !== false) {
15
15
  const loader = process.env.MIKRO_ORM_CLI_TS_LOADER ?? 'auto';
16
16
  CLIHelper.dump(' - TypeScript support ' + colors.green(`enabled (${loader})`));
@@ -25,7 +25,7 @@ export class DebugCommand {
25
25
  const drivers = CLIHelper.getDriverDependencies(config);
26
26
  CLIHelper.dump(' - driver dependencies:');
27
27
  for (const driver of drivers) {
28
- CLIHelper.dump(` - ${driver} ${await CLIHelper.getModuleVersion(driver)}`);
28
+ CLIHelper.dump(` - ${driver} ${CLIHelper.getModuleVersion(driver)}`);
29
29
  }
30
30
  const isConnected = await CLIHelper.isDBConnected(config, true);
31
31
  if (isConnected === true) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mikro-orm/cli",
3
3
  "type": "module",
4
- "version": "7.0.0-dev.85",
4
+ "version": "7.0.0-dev.87",
5
5
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
6
6
  "exports": {
7
7
  "./package.json": "./package.json",
@@ -53,9 +53,9 @@
53
53
  "access": "public"
54
54
  },
55
55
  "dependencies": {
56
- "@mikro-orm/core": "7.0.0-dev.85",
57
- "@mikro-orm/knex": "7.0.0-dev.85",
58
- "mikro-orm": "7.0.0-dev.85",
56
+ "@mikro-orm/core": "7.0.0-dev.87",
57
+ "@mikro-orm/knex": "7.0.0-dev.87",
58
+ "mikro-orm": "7.0.0-dev.87",
59
59
  "yargs": "17.7.2"
60
60
  },
61
61
  "devDependencies": {