@mikro-orm/cli 7.0.0-dev.300 → 7.0.0-dev.302

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.
package/CLIHelper.js CHANGED
@@ -25,8 +25,9 @@ export class CLIHelper {
25
25
  contextName ??= process.env.MIKRO_ORM_CONTEXT_NAME ?? 'default';
26
26
  const env = await this.loadEnvironmentVars();
27
27
  await loadOptionalDependencies(options);
28
+ // oxfmt-ignore
28
29
  const configFinder = (cfg) => {
29
- return typeof cfg === 'object' && cfg !== null && ('contextName' in cfg ? cfg.contextName === contextName : (contextName === 'default'));
30
+ return typeof cfg === 'object' && cfg !== null && ('contextName' in cfg ? cfg.contextName === contextName : contextName === 'default');
30
31
  };
31
32
  const isValidConfigFactoryResult = (cfg) => {
32
33
  return typeof cfg === 'object' && cfg !== null && (!('contextName' in cfg) || cfg.contextName === contextName);
@@ -92,9 +93,11 @@ export class CLIHelper {
92
93
  return;
93
94
  }
94
95
  /* v8 ignore next */
95
- options.dynamicImportProvider ??= globalThis.dynamicImportProvider ?? ((id) => {
96
- return createRequire(process.cwd())(fileURLToPath(id));
97
- });
96
+ options.dynamicImportProvider ??=
97
+ globalThis.dynamicImportProvider ??
98
+ ((id) => {
99
+ return createRequire(process.cwd())(fileURLToPath(id));
100
+ });
98
101
  globalThis.dynamicImportProvider = options.dynamicImportProvider;
99
102
  }
100
103
  static async getORM(contextName, configPaths, opts = {}) {
@@ -143,10 +146,12 @@ export class CLIHelper {
143
146
  const config = fs.getPackageConfig();
144
147
  const settings = { ...config['mikro-orm'] };
145
148
  const bool = (v) => ['true', 't', '1'].includes(v.toLowerCase());
146
- settings.preferTs = process.env.MIKRO_ORM_CLI_PREFER_TS != null ? bool(process.env.MIKRO_ORM_CLI_PREFER_TS) : settings.preferTs;
149
+ settings.preferTs =
150
+ process.env.MIKRO_ORM_CLI_PREFER_TS != null ? bool(process.env.MIKRO_ORM_CLI_PREFER_TS) : settings.preferTs;
147
151
  settings.tsLoader = process.env.MIKRO_ORM_CLI_TS_LOADER ?? settings.tsLoader;
148
152
  settings.tsConfigPath = process.env.MIKRO_ORM_CLI_TS_CONFIG_PATH ?? settings.tsConfigPath;
149
- settings.verbose = process.env.MIKRO_ORM_CLI_VERBOSE != null ? bool(process.env.MIKRO_ORM_CLI_VERBOSE) : settings.verbose;
153
+ settings.verbose =
154
+ process.env.MIKRO_ORM_CLI_VERBOSE != null ? bool(process.env.MIKRO_ORM_CLI_VERBOSE) : settings.verbose;
150
155
  if (process.env.MIKRO_ORM_CLI_CONFIG?.endsWith('.ts')) {
151
156
  settings.preferTs = true;
152
157
  }
@@ -167,7 +172,7 @@ export class CLIHelper {
167
172
  const distDir = fs.pathExists(process.cwd() + '/dist');
168
173
  const buildDir = fs.pathExists(process.cwd() + '/build');
169
174
  /* v8 ignore next */
170
- const path = distDir ? 'dist' : (buildDir ? 'build' : 'src');
175
+ const path = distDir ? 'dist' : buildDir ? 'build' : 'src';
171
176
  paths.push(`./${path}/mikro-orm.config.js`);
172
177
  paths.push('./mikro-orm.config.js');
173
178
  /* v8 ignore next */
@@ -270,10 +275,18 @@ export class CLIHelper {
270
275
  });
271
276
  let ret = '';
272
277
  ret += colors.grey('┌' + lengths.map(length => '─'.repeat(length)).join('┬') + '┐\n');
273
- ret += colors.grey('│') + lengths.map((length, idx) => ' ' + colors.red(options.columns[idx]) + ' '.repeat(length - options.columns[idx].length - 1)).join(colors.grey('│')) + colors.grey('│\n');
278
+ ret +=
279
+ colors.grey('│') +
280
+ lengths
281
+ .map((length, idx) => ' ' + colors.red(options.columns[idx]) + ' '.repeat(length - options.columns[idx].length - 1))
282
+ .join(colors.grey('│')) +
283
+ colors.grey('│\n');
274
284
  ret += colors.grey('├' + lengths.map(length => '─'.repeat(length)).join('┼') + '┤\n');
275
285
  options.rows.forEach(row => {
276
- ret += colors.grey('│') + lengths.map((length, idx) => ' ' + row[idx] + ' '.repeat(length - row[idx].length - 1)).join(colors.grey('│')) + colors.grey('│\n');
286
+ ret +=
287
+ colors.grey('│') +
288
+ lengths.map((length, idx) => ' ' + row[idx] + ' '.repeat(length - row[idx].length - 1)).join(colors.grey('│')) +
289
+ colors.grey('│\n');
277
290
  });
278
291
  ret += colors.grey('└' + lengths.map(length => '─'.repeat(length)).join('┴') + '┘');
279
292
  CLIHelper.dump(ret);
@@ -293,7 +306,7 @@ export class CLIHelper {
293
306
  process.env.MIKRO_ORM_CLI_ALWAYS_ALLOW_TS ??= '1';
294
307
  const explicitLoader = tsLoader ?? process.env.MIKRO_ORM_CLI_TS_LOADER ?? 'auto';
295
308
  const setEsmImportProvider = () => {
296
- return globalThis.dynamicImportProvider = (id) => import(id).then(mod => mod?.default ?? mod);
309
+ return (globalThis.dynamicImportProvider = (id) => import(id).then(mod => mod?.default ?? mod));
297
310
  };
298
311
  const loaders = {
299
312
  swc: { esm: '@swc-node/register/esm-register', cjs: '@swc-node/register' },
@@ -1,6 +1,6 @@
1
1
  import { writeFileSync, mkdirSync } from 'node:fs';
2
2
  import { resolve, dirname } from 'node:path';
3
- import { MetadataDiscovery, MetadataStorage, Utils, EntityComparator, ObjectHydrator, colors } from '@mikro-orm/core';
3
+ import { MetadataDiscovery, MetadataStorage, Utils, EntityComparator, ObjectHydrator, colors, } from '@mikro-orm/core';
4
4
  import { fs } from '@mikro-orm/core/fs-utils';
5
5
  import { CLIHelper } from '../CLIHelper.js';
6
6
  export class CompileCommand {
@@ -15,7 +15,7 @@ export class DebugCommand {
15
15
  const loader = process.env.MIKRO_ORM_CLI_TS_LOADER ?? 'auto';
16
16
  CLIHelper.dump(' - TypeScript support ' + colors.green(`enabled (${loader})`));
17
17
  }
18
- const configPaths = args.config ?? await CLIHelper.getConfigPaths();
18
+ const configPaths = args.config ?? (await CLIHelper.getConfigPaths());
19
19
  CLIHelper.dump(' - searched config paths:');
20
20
  await DebugCommand.checkPaths(configPaths, 'yellow');
21
21
  CLIHelper.dump(` - searched for config name: ${colors.green(args.contextName)}`);
@@ -11,6 +11,7 @@ export class MigrationCommandFactory {
11
11
  fresh: 'Clear the database and rerun all migrations',
12
12
  };
13
13
  static create(command) {
14
+ // oxfmt-ignore
14
15
  return {
15
16
  command: `migration:${command}`,
16
17
  describe: MigrationCommandFactory.DESCRIPTIONS[command],
@@ -154,6 +155,7 @@ export class MigrationCommandFactory {
154
155
  CLIHelper.dump(ret.diff.down.map(sql => ' ' + sql).join('\n'), config);
155
156
  }
156
157
  else {
158
+ /* v8 ignore next */
157
159
  CLIHelper.dump(colors.yellow(`(${config.getDriver().constructor.name} does not support automatic down migrations)`));
158
160
  }
159
161
  }
@@ -185,7 +187,7 @@ export class MigrationCommandFactory {
185
187
  return { migrations: flags.only.split(/[, ]+/) };
186
188
  }
187
189
  const ret = {};
188
- ['from', 'to'].filter(k => flags[k]).forEach(k => ret[k] = flags[k] === '0' ? 0 : flags[k]);
190
+ ['from', 'to'].filter(k => flags[k]).forEach(k => (ret[k] = flags[k] === '0' ? 0 : flags[k]));
189
191
  return ret;
190
192
  }
191
193
  static getUpDownSuccessMessage(method, options) {
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
1
  {
2
2
  "name": "@mikro-orm/cli",
3
- "type": "module",
4
- "version": "7.0.0-dev.300",
3
+ "version": "7.0.0-dev.302",
5
4
  "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
- "exports": {
7
- "./package.json": "./package.json",
8
- ".": "./index.js"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
13
- },
14
5
  "keywords": [
15
- "orm",
6
+ "data-mapper",
7
+ "ddd",
8
+ "entity",
9
+ "identity-map",
10
+ "javascript",
11
+ "js",
12
+ "mariadb",
13
+ "mikro-orm",
16
14
  "mongo",
17
15
  "mongodb",
18
16
  "mysql",
19
- "mariadb",
17
+ "orm",
20
18
  "postgresql",
21
19
  "sqlite",
22
20
  "sqlite3",
23
21
  "ts",
24
22
  "typescript",
25
- "js",
26
- "javascript",
27
- "entity",
28
- "ddd",
29
- "mikro-orm",
30
- "unit-of-work",
31
- "data-mapper",
32
- "identity-map"
23
+ "unit-of-work"
33
24
  ],
34
- "author": "Martin Adámek",
35
- "license": "MIT",
25
+ "homepage": "https://mikro-orm.io",
36
26
  "bugs": {
37
27
  "url": "https://github.com/mikro-orm/mikro-orm/issues"
38
28
  },
39
- "homepage": "https://mikro-orm.io",
29
+ "license": "MIT",
30
+ "author": "Martin Adámek",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
34
+ },
40
35
  "bin": {
41
36
  "mikro-orm": "./cli"
42
37
  },
43
- "engines": {
44
- "node": ">= 22.17.0"
38
+ "type": "module",
39
+ "exports": {
40
+ "./package.json": "./package.json",
41
+ ".": "./index.js"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "yarn compile && yarn copy",
@@ -49,12 +49,12 @@
49
49
  "compile": "yarn run -T tsc -p tsconfig.build.json",
50
50
  "copy": "node ../../scripts/copy.mjs"
51
51
  },
52
- "publishConfig": {
53
- "access": "public"
54
- },
55
52
  "dependencies": {
56
- "@mikro-orm/core": "7.0.0-dev.300",
57
- "mikro-orm": "7.0.0-dev.300",
53
+ "@mikro-orm/core": "7.0.0-dev.302",
54
+ "mikro-orm": "7.0.0-dev.302",
58
55
  "yargs": "17.7.2"
56
+ },
57
+ "engines": {
58
+ "node": ">= 22.17.0"
59
59
  }
60
60
  }