@mikro-orm/cli 7.0.0-dev.77 → 7.0.0-dev.79

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.
@@ -1,4 +1,5 @@
1
- import { ConfigurationLoader, Utils } from '@mikro-orm/core';
1
+ import { Utils } from '@mikro-orm/core';
2
+ import { fs } from '@mikro-orm/core/fs-utils';
2
3
  import yargs from 'yargs';
3
4
  import { ClearCacheCommand } from './commands/ClearCacheCommand.js';
4
5
  import { CreateDatabaseCommand } from './commands/CreateDatabaseCommand.js';
@@ -36,7 +37,7 @@ function createBasicConfig() {
36
37
  .strict();
37
38
  }
38
39
  export async function configure() {
39
- await ConfigurationLoader.checkPackageVersion();
40
+ await fs.checkPackageVersion();
40
41
  const settings = await CLIHelper.getSettings();
41
42
  const version = Utils.getORMVersion();
42
43
  if (settings.preferTs !== false) {
package/CLIHelper.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type EntityManagerType, type EntityManager, MikroORM, Configuration, type IDatabaseDriver, type Options } from '@mikro-orm/core';
1
+ import { Configuration, type EntityManager, type EntityManagerType, type IDatabaseDriver, MikroORM, type Options } from '@mikro-orm/core';
2
2
  /**
3
3
  * @internal
4
4
  */
@@ -7,7 +7,7 @@ export declare class CLIHelper {
7
7
  * Gets a named configuration
8
8
  *
9
9
  * @param contextName Load a config with the given `contextName` value. Used when config file exports array or factory function. Setting it to "default" matches also config objects without `contextName` set.
10
- * @param paths Array of possible paths for a configuration file. Files will be checked in order, and the first existing one will be used. Defaults to the output of {@link ConfigurationLoader.getConfigPaths}.
10
+ * @param paths Array of possible paths for a configuration file. Files will be checked in order, and the first existing one will be used. Defaults to the output of {@link fs.getConfigPaths}.
11
11
  * @param options Additional options to augment the final configuration with.
12
12
  */
13
13
  static getConfiguration<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>>(contextName?: string, paths?: string[], options?: Partial<Options<D>>): Promise<Configuration<D, EM>>;
package/CLIHelper.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { extname, join } from 'node:path';
2
2
  import { pathToFileURL } from 'node:url';
3
3
  import yargs from 'yargs';
4
- import { colors, ConfigurationLoader, MikroORM, Utils, Configuration, lookupExtensions, } from '@mikro-orm/core';
4
+ import { colors, Configuration, loadEnvironmentVars, lookupExtensions, MikroORM, Utils, } from '@mikro-orm/core';
5
+ import { fs } from '@mikro-orm/core/fs-utils';
5
6
  /**
6
7
  * @internal
7
8
  */
@@ -10,12 +11,12 @@ export class CLIHelper {
10
11
  * Gets a named configuration
11
12
  *
12
13
  * @param contextName Load a config with the given `contextName` value. Used when config file exports array or factory function. Setting it to "default" matches also config objects without `contextName` set.
13
- * @param paths Array of possible paths for a configuration file. Files will be checked in order, and the first existing one will be used. Defaults to the output of {@link ConfigurationLoader.getConfigPaths}.
14
+ * @param paths Array of possible paths for a configuration file. Files will be checked in order, and the first existing one will be used. Defaults to the output of {@link fs.getConfigPaths}.
14
15
  * @param options Additional options to augment the final configuration with.
15
16
  */
16
17
  static async getConfiguration(contextName, paths, options = {}) {
17
18
  paths ??= await this.getConfigPaths();
18
- const deps = await ConfigurationLoader.getORMPackages();
19
+ const deps = await fs.getORMPackages();
19
20
  if (!deps.has('@mikro-orm/cli') && !process.env.MIKRO_ORM_ALLOW_GLOBAL_CLI) {
20
21
  throw new Error('@mikro-orm/cli needs to be installed as a local dependency!');
21
22
  }
@@ -125,7 +126,7 @@ export class CLIHelper {
125
126
  console.log(text);
126
127
  }
127
128
  static async getSettings() {
128
- const config = await ConfigurationLoader.getPackageConfig();
129
+ const config = await fs.getPackageConfig();
129
130
  const settings = { ...config['mikro-orm'] };
130
131
  const bool = (v) => ['true', 't', '1'].includes(v.toLowerCase());
131
132
  settings.preferTs = process.env.MIKRO_ORM_CLI_PREFER_TS != null ? bool(process.env.MIKRO_ORM_CLI_PREFER_TS) : settings.preferTs;
@@ -149,8 +150,8 @@ export class CLIHelper {
149
150
  paths.push('./src/mikro-orm.config.ts');
150
151
  paths.push('./mikro-orm.config.ts');
151
152
  }
152
- const distDir = Utils.pathExists(process.cwd() + '/dist');
153
- const buildDir = Utils.pathExists(process.cwd() + '/build');
153
+ const distDir = fs.pathExists(process.cwd() + '/dist');
154
+ const buildDir = fs.pathExists(process.cwd() + '/build');
154
155
  /* v8 ignore next */
155
156
  const path = distDir ? 'dist' : (buildDir ? 'build' : 'src');
156
157
  paths.push(`./${path}/mikro-orm.config.js`);
@@ -162,7 +163,7 @@ export class CLIHelper {
162
163
  for (let path of paths) {
163
164
  path = Utils.absolutePath(path);
164
165
  path = Utils.normalizePath(path);
165
- if (Utils.pathExists(path)) {
166
+ if (fs.pathExists(path)) {
166
167
  const config = await Utils.dynamicImport(path);
167
168
  /* v8 ignore next */
168
169
  return [path, await (config.default ?? config)];
@@ -171,7 +172,7 @@ export class CLIHelper {
171
172
  return [];
172
173
  }
173
174
  static async loadEnvironmentVars() {
174
- const ret = ConfigurationLoader.loadEnvironmentVars();
175
+ const ret = loadEnvironmentVars();
175
176
  /* v8 ignore next */
176
177
  switch (process.env.MIKRO_ORM_TYPE) {
177
178
  case 'mongo':
@@ -203,7 +204,7 @@ export class CLIHelper {
203
204
  CLIHelper.dump(' - dependencies:');
204
205
  CLIHelper.dump(` - mikro-orm ${colors.green(version)}`);
205
206
  CLIHelper.dump(` - node ${colors.green(process.versions.node)}`);
206
- if (Utils.pathExists(process.cwd() + '/package.json')) {
207
+ if (fs.pathExists(process.cwd() + '/package.json')) {
207
208
  /* v8 ignore if */
208
209
  if (process.versions.bun) {
209
210
  CLIHelper.dump(` - typescript via bun`);
@@ -220,7 +221,7 @@ export class CLIHelper {
220
221
  static async getModuleVersion(name) {
221
222
  try {
222
223
  const path = `${this.resolveModulePath(name)}/package.json`;
223
- const pkg = Utils.readJSONSync(path);
224
+ const pkg = fs.readJSONSync(path);
224
225
  return colors.green(pkg.version);
225
226
  }
226
227
  catch {
@@ -303,7 +304,7 @@ export class CLIHelper {
303
304
  return false;
304
305
  }
305
306
  static async isESM() {
306
- const config = await ConfigurationLoader.getPackageConfig();
307
+ const config = await fs.getPackageConfig();
307
308
  const type = config?.type ?? '';
308
309
  return type === 'module';
309
310
  }
@@ -1,4 +1,5 @@
1
1
  import { colors, Utils } from '@mikro-orm/core';
2
+ import { fs } from '@mikro-orm/core/fs-utils';
2
3
  import { CLIHelper } from '../CLIHelper.js';
3
4
  export class DebugCommand {
4
5
  command = 'debug';
@@ -68,7 +69,7 @@ export class DebugCommand {
68
69
  for (let path of paths) {
69
70
  path = Utils.absolutePath(path, baseDir);
70
71
  path = Utils.normalizePath(path);
71
- if (Utils.pathExists(path)) {
72
+ if (fs.pathExists(path)) {
72
73
  CLIHelper.dump(` - ${path} (${colors.green('found')})`);
73
74
  }
74
75
  else {
@@ -1,4 +1,5 @@
1
- import { MetadataDiscovery, MetadataStorage, colors, FileCacheAdapter } from '@mikro-orm/core';
1
+ import { MetadataDiscovery, MetadataStorage, colors } from '@mikro-orm/core';
2
+ import { FileCacheAdapter } from '@mikro-orm/core/fs-utils';
2
3
  import { CLIHelper } from '../CLIHelper.js';
3
4
  export class GenerateCacheCommand {
4
5
  command = 'cache:generate';
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.77",
4
+ "version": "7.0.0-dev.79",
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.77",
57
- "@mikro-orm/knex": "7.0.0-dev.77",
58
- "mikro-orm": "7.0.0-dev.77",
56
+ "@mikro-orm/core": "7.0.0-dev.79",
57
+ "@mikro-orm/knex": "7.0.0-dev.79",
58
+ "mikro-orm": "7.0.0-dev.79",
59
59
  "yargs": "17.7.2"
60
60
  },
61
61
  "devDependencies": {