@mikro-orm/cli 7.0.4 → 7.0.5-dev.1
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/CLIConfigurator.d.ts +6 -7
- package/CLIConfigurator.js +51 -51
- package/CLIHelper.d.ts +45 -58
- package/CLIHelper.js +314 -325
- package/README.md +1 -1
- package/cli.js +1 -1
- package/commands/ClearCacheCommand.d.ts +6 -6
- package/commands/ClearCacheCommand.js +14 -16
- package/commands/CompileCommand.d.ts +13 -16
- package/commands/CompileCommand.js +83 -88
- package/commands/CreateDatabaseCommand.d.ts +6 -6
- package/commands/CreateDatabaseCommand.js +10 -10
- package/commands/CreateSeederCommand.d.ts +12 -12
- package/commands/CreateSeederCommand.js +27 -28
- package/commands/DatabaseSeedCommand.d.ts +8 -8
- package/commands/DatabaseSeedCommand.js +20 -20
- package/commands/DebugCommand.d.ts +7 -7
- package/commands/DebugCommand.js +71 -74
- package/commands/GenerateCacheCommand.d.ts +9 -9
- package/commands/GenerateCacheCommand.js +29 -33
- package/commands/GenerateEntitiesCommand.d.ts +14 -14
- package/commands/GenerateEntitiesCommand.js +43 -43
- package/commands/ImportCommand.d.ts +7 -7
- package/commands/ImportCommand.js +12 -12
- package/commands/MigrationCommandFactory.d.ts +53 -58
- package/commands/MigrationCommandFactory.js +191 -192
- package/commands/SchemaCommandFactory.d.ts +32 -42
- package/commands/SchemaCommandFactory.js +100 -97
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -133,7 +133,7 @@ const author = await em.findOneOrFail(Author, 1, {
|
|
|
133
133
|
populate: ['books'],
|
|
134
134
|
});
|
|
135
135
|
author.name = 'Jon Snow II';
|
|
136
|
-
author.books.getItems().forEach(book =>
|
|
136
|
+
author.books.getItems().forEach(book => book.title += ' (2nd ed.)');
|
|
137
137
|
author.books.add(orm.em.create(Book, { title: 'New Book', author }));
|
|
138
138
|
|
|
139
139
|
// Flush computes change sets and executes them in a single transaction
|
package/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase } from 'yargs';
|
|
2
2
|
import type { BaseArgs, BaseCommand } from '../CLIConfigurator.js';
|
|
3
3
|
export declare class ClearCacheCommand implements BaseCommand {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
command: string;
|
|
5
|
+
describe: string;
|
|
6
|
+
/**
|
|
7
|
+
* @inheritDoc
|
|
8
|
+
*/
|
|
9
|
+
handler(args: ArgumentsCamelCase<BaseArgs>): Promise<void>;
|
|
10
10
|
}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { colors } from '@mikro-orm/core';
|
|
2
2
|
import { CLIHelper } from '../CLIHelper.js';
|
|
3
3
|
export class ClearCacheCommand {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
command = 'cache:clear';
|
|
5
|
+
describe = 'Clear metadata cache';
|
|
6
|
+
/**
|
|
7
|
+
* @inheritDoc
|
|
8
|
+
*/
|
|
9
|
+
async handler(args) {
|
|
10
|
+
const config = await CLIHelper.getConfiguration(args.contextName, args.config);
|
|
11
|
+
if (!config.get('metadataCache').enabled) {
|
|
12
|
+
CLIHelper.dump(colors.red('Metadata cache is disabled in your configuration. Set cache.enabled to true to use this command.'));
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const cache = config.getMetadataCacheAdapter();
|
|
16
|
+
await cache.clear();
|
|
17
|
+
CLIHelper.dump(colors.green('Metadata cache was successfully cleared'));
|
|
16
18
|
}
|
|
17
|
-
const cache = config.getMetadataCacheAdapter();
|
|
18
|
-
await cache.clear();
|
|
19
|
-
CLIHelper.dump(colors.green('Metadata cache was successfully cleared'));
|
|
20
|
-
}
|
|
21
19
|
}
|
|
@@ -2,23 +2,20 @@ import type { ArgumentsCamelCase, Argv } from 'yargs';
|
|
|
2
2
|
import { MetadataStorage, type Configuration } from '@mikro-orm/core';
|
|
3
3
|
import type { BaseArgs, BaseCommand } from '../CLIConfigurator.js';
|
|
4
4
|
type CompileArgs = BaseArgs & {
|
|
5
|
-
|
|
5
|
+
out?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare class CompileCommand implements BaseCommand<CompileArgs> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
contextKeys: string[];
|
|
21
|
-
code: string;
|
|
22
|
-
}[];
|
|
8
|
+
command: string;
|
|
9
|
+
describe: string;
|
|
10
|
+
builder: (args: Argv<BaseArgs>) => Argv<CompileArgs>;
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
14
|
+
handler(args: ArgumentsCamelCase<CompileArgs>): Promise<void>;
|
|
15
|
+
static capture(metadata: MetadataStorage, config: Configuration): {
|
|
16
|
+
key: string;
|
|
17
|
+
contextKeys: string[];
|
|
18
|
+
code: string;
|
|
19
|
+
}[];
|
|
23
20
|
}
|
|
24
21
|
export {};
|
|
@@ -1,99 +1,94 @@
|
|
|
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 {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
args.out = resolve(dirname(absPath), 'compiled-functions.js');
|
|
35
|
-
break;
|
|
7
|
+
command = 'compile';
|
|
8
|
+
describe = 'Pre-compile optimized entity functions for runtimes that prohibit eval (e.g. Cloudflare Workers)';
|
|
9
|
+
builder = (args) => {
|
|
10
|
+
args.option('out', {
|
|
11
|
+
type: 'string',
|
|
12
|
+
desc: 'Output path for the generated file (defaults to next to your ORM config)',
|
|
13
|
+
});
|
|
14
|
+
return args;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
async handler(args) {
|
|
20
|
+
const config = await CLIHelper.getConfiguration(args.contextName, args.config);
|
|
21
|
+
const settings = CLIHelper.getSettings();
|
|
22
|
+
config.set('debug', !!settings.verbose);
|
|
23
|
+
const metadata = await new MetadataDiscovery(new MetadataStorage(), config.getDriver().getPlatform(), config).discover(false);
|
|
24
|
+
// Default output path to next to the ORM config file
|
|
25
|
+
if (!args.out) {
|
|
26
|
+
const configPaths = args.config ?? (await CLIHelper.getConfigPaths());
|
|
27
|
+
for (const configPath of configPaths) {
|
|
28
|
+
const absPath = fs.absolutePath(configPath);
|
|
29
|
+
if (fs.pathExists(absPath)) {
|
|
30
|
+
args.out = resolve(dirname(absPath), 'compiled-functions.js');
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
36
34
|
}
|
|
37
|
-
|
|
35
|
+
const captured = CompileCommand.capture(metadata, config);
|
|
36
|
+
const entries = captured.map(({ key, contextKeys, code }) => {
|
|
37
|
+
const params = contextKeys.join(', ');
|
|
38
|
+
const indentedCode = code.replace(/\n/g, '\n ');
|
|
39
|
+
return ` '${key}': function(${params}) {\n ${indentedCode}\n }`;
|
|
40
|
+
});
|
|
41
|
+
const esm = CLIHelper.isESM();
|
|
42
|
+
const version = Utils.getORMVersion();
|
|
43
|
+
const output = esm
|
|
44
|
+
? `export default {\n __version: '${version}',\n${entries.join(',\n')}\n};\n`
|
|
45
|
+
: `'use strict';\nmodule.exports = {\n __version: '${version}',\n${entries.join(',\n')}\n};\n`;
|
|
46
|
+
const outPath = args.out ?? resolve(process.cwd(), 'compiled-functions.js');
|
|
47
|
+
const dtsPath = outPath.replace(/\.js$/, '.d.ts');
|
|
48
|
+
const dts = esm
|
|
49
|
+
? `import type { CompiledFunctions } from '@mikro-orm/core';\ndeclare const compiledFunctions: CompiledFunctions;\nexport default compiledFunctions;\n`
|
|
50
|
+
: `import type { CompiledFunctions } from '@mikro-orm/core';\ndeclare const compiledFunctions: CompiledFunctions;\nexport = compiledFunctions;\n`;
|
|
51
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
52
|
+
writeFileSync(outPath, output);
|
|
53
|
+
writeFileSync(dtsPath, dts);
|
|
54
|
+
CLIHelper.dump(colors.green(`Compiled functions generated to ${outPath} (${captured.length} functions)`));
|
|
55
|
+
CLIHelper.dump(`\nExample usage in your ORM config:\n`);
|
|
56
|
+
const importPath = esm ? './compiled-functions.js' : './compiled-functions';
|
|
57
|
+
CLIHelper.dump(` ${esm ? 'import' : 'const'} compiledFunctions ${esm ? 'from ' : '= require('}${colors.cyan(`'${importPath}'`)}${esm ? '' : ')'};`);
|
|
58
|
+
CLIHelper.dump('');
|
|
59
|
+
CLIHelper.dump(` export default defineConfig({ compiledFunctions });\n`);
|
|
38
60
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
static capture(metadata, config) {
|
|
68
|
-
const captured = [];
|
|
69
|
-
const original = Utils.createFunction;
|
|
70
|
-
Utils.createFunction = (context, code, _compiledFunctions, key) => {
|
|
71
|
-
captured.push({ key: key, contextKeys: [...context.keys()], code });
|
|
72
|
-
return original.call(Utils, context, code);
|
|
73
|
-
};
|
|
74
|
-
try {
|
|
75
|
-
const platform = config.getDriver().getPlatform();
|
|
76
|
-
const hydrator = new ObjectHydrator(metadata, platform, config);
|
|
77
|
-
const comparator = new EntityComparator(metadata, platform, config);
|
|
78
|
-
for (const meta of metadata) {
|
|
79
|
-
hydrator.getEntityHydrator(meta, 'full', false);
|
|
80
|
-
hydrator.getEntityHydrator(meta, 'full', true);
|
|
81
|
-
comparator.getEntityComparator(meta.class);
|
|
82
|
-
comparator.getSnapshotGenerator(meta.class);
|
|
83
|
-
comparator.getResultMapper(meta);
|
|
84
|
-
if (!meta.embeddable && !meta.virtual) {
|
|
85
|
-
hydrator.getEntityHydrator(meta, 'reference', false);
|
|
86
|
-
hydrator.getEntityHydrator(meta, 'reference', true);
|
|
61
|
+
static capture(metadata, config) {
|
|
62
|
+
const captured = [];
|
|
63
|
+
const original = Utils.createFunction;
|
|
64
|
+
Utils.createFunction = (context, code, _compiledFunctions, key) => {
|
|
65
|
+
captured.push({ key: key, contextKeys: [...context.keys()], code });
|
|
66
|
+
return original.call(Utils, context, code);
|
|
67
|
+
};
|
|
68
|
+
try {
|
|
69
|
+
const platform = config.getDriver().getPlatform();
|
|
70
|
+
const hydrator = new ObjectHydrator(metadata, platform, config);
|
|
71
|
+
const comparator = new EntityComparator(metadata, platform, config);
|
|
72
|
+
for (const meta of metadata) {
|
|
73
|
+
hydrator.getEntityHydrator(meta, 'full', false);
|
|
74
|
+
hydrator.getEntityHydrator(meta, 'full', true);
|
|
75
|
+
comparator.getEntityComparator(meta.class);
|
|
76
|
+
comparator.getSnapshotGenerator(meta.class);
|
|
77
|
+
comparator.getResultMapper(meta);
|
|
78
|
+
if (!meta.embeddable && !meta.virtual) {
|
|
79
|
+
hydrator.getEntityHydrator(meta, 'reference', false);
|
|
80
|
+
hydrator.getEntityHydrator(meta, 'reference', true);
|
|
81
|
+
}
|
|
82
|
+
if (meta.primaryKeys.length > 0) {
|
|
83
|
+
comparator.getPkGetter(meta);
|
|
84
|
+
comparator.getPkGetterConverted(meta);
|
|
85
|
+
comparator.getPkSerializer(meta);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
comparator.getPkGetterConverted(meta);
|
|
91
|
-
comparator.getPkSerializer(meta);
|
|
89
|
+
finally {
|
|
90
|
+
Utils.createFunction = original;
|
|
92
91
|
}
|
|
93
|
-
|
|
94
|
-
} finally {
|
|
95
|
-
Utils.createFunction = original;
|
|
92
|
+
return captured;
|
|
96
93
|
}
|
|
97
|
-
return captured;
|
|
98
|
-
}
|
|
99
94
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase } from 'yargs';
|
|
2
2
|
import type { BaseArgs, BaseCommand } from '../CLIConfigurator.js';
|
|
3
3
|
export declare class CreateDatabaseCommand implements BaseCommand {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
command: string;
|
|
5
|
+
describe: string;
|
|
6
|
+
/**
|
|
7
|
+
* @inheritDoc
|
|
8
|
+
*/
|
|
9
|
+
handler(args: ArgumentsCamelCase<BaseArgs>): Promise<void>;
|
|
10
10
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { CLIHelper } from '../CLIHelper.js';
|
|
2
2
|
export class CreateDatabaseCommand {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
command = 'database:create';
|
|
4
|
+
describe = 'Create your database if it does not exist';
|
|
5
|
+
/**
|
|
6
|
+
* @inheritDoc
|
|
7
|
+
*/
|
|
8
|
+
async handler(args) {
|
|
9
|
+
const orm = await CLIHelper.getORM(args.contextName, args.config);
|
|
10
|
+
await orm.schema.ensureDatabase();
|
|
11
|
+
await orm.close(true);
|
|
12
|
+
}
|
|
13
13
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
2
|
import type { BaseArgs, BaseCommand } from '../CLIConfigurator.js';
|
|
3
3
|
type CreateSeederCommandArgs = BaseArgs & {
|
|
4
|
-
|
|
4
|
+
seeder: string;
|
|
5
5
|
};
|
|
6
6
|
export declare class CreateSeederCommand implements BaseCommand<CreateSeederCommandArgs> {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
command: string;
|
|
8
|
+
describe: string;
|
|
9
|
+
builder: (args: Argv<BaseArgs>) => Argv<CreateSeederCommandArgs>;
|
|
10
|
+
/**
|
|
11
|
+
* @inheritDoc
|
|
12
|
+
*/
|
|
13
|
+
handler(args: ArgumentsCamelCase<CreateSeederCommandArgs>): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Will return a seeder name that is formatted like this EntitySeeder
|
|
16
|
+
*/
|
|
17
|
+
private static getSeederClassName;
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
import { colors } from '@mikro-orm/core';
|
|
2
2
|
import { CLIHelper } from '../CLIHelper.js';
|
|
3
3
|
export class CreateSeederCommand {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
4
|
+
command = 'seeder:create <seeder>';
|
|
5
|
+
describe = 'Create a new seeder class';
|
|
6
|
+
builder = (args) => {
|
|
7
|
+
args.positional('seeder', {
|
|
8
|
+
describe: 'Name for the seeder class. (e.g. "test" will generate "TestSeeder" or "TestSeeder" will generate "TestSeeder")',
|
|
9
|
+
demandOption: true,
|
|
10
|
+
});
|
|
11
|
+
return args;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
async handler(args) {
|
|
17
|
+
const className = CreateSeederCommand.getSeederClassName(args.seeder);
|
|
18
|
+
const orm = await CLIHelper.getORM(args.contextName, args.config);
|
|
19
|
+
const path = await orm.seeder.create(className);
|
|
20
|
+
CLIHelper.dump(colors.green(`Seeder ${args.seeder} successfully created at ${path}`));
|
|
21
|
+
await orm.close(true);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Will return a seeder name that is formatted like this EntitySeeder
|
|
25
|
+
*/
|
|
26
|
+
static getSeederClassName(name) {
|
|
27
|
+
name = /(.+)seeder/i.exec(name)?.[1] ?? name;
|
|
28
|
+
const parts = name.split('-');
|
|
29
|
+
return parts.map(name => name.charAt(0).toUpperCase() + name.slice(1)).join('') + 'Seeder';
|
|
30
|
+
}
|
|
32
31
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
2
|
import type { BaseArgs, BaseCommand } from '../CLIConfigurator.js';
|
|
3
3
|
type DatabaseSeedArgs = BaseArgs & {
|
|
4
|
-
|
|
4
|
+
class?: string;
|
|
5
5
|
};
|
|
6
6
|
export declare class DatabaseSeedCommand implements BaseCommand<DatabaseSeedArgs> {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
command: string;
|
|
8
|
+
describe: string;
|
|
9
|
+
builder: (args: Argv<BaseArgs>) => Argv<DatabaseSeedArgs>;
|
|
10
|
+
/**
|
|
11
|
+
* @inheritDoc
|
|
12
|
+
*/
|
|
13
|
+
handler(args: ArgumentsCamelCase<DatabaseSeedArgs>): Promise<void>;
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { colors } from '@mikro-orm/core';
|
|
2
2
|
import { CLIHelper } from '../CLIHelper.js';
|
|
3
3
|
export class DatabaseSeedCommand {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
command = 'seeder:run';
|
|
5
|
+
describe = 'Seed the database using the seeder class';
|
|
6
|
+
builder = (args) => {
|
|
7
|
+
args.option('c', {
|
|
8
|
+
alias: 'class',
|
|
9
|
+
type: 'string',
|
|
10
|
+
desc: 'Seeder class to run',
|
|
11
|
+
});
|
|
12
|
+
return args;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
async handler(args) {
|
|
18
|
+
const orm = await CLIHelper.getORM(args.contextName, args.config);
|
|
19
|
+
const className = args.class ?? orm.config.get('seeder').defaultSeeder;
|
|
20
|
+
await orm.seeder.seedString(className);
|
|
21
|
+
CLIHelper.dump(colors.green(`Seeder ${className} successfully executed`));
|
|
22
|
+
await orm.close(true);
|
|
23
|
+
}
|
|
24
24
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ArgumentsCamelCase } from 'yargs';
|
|
2
2
|
import type { BaseArgs, BaseCommand } from '../CLIConfigurator.js';
|
|
3
3
|
export declare class DebugCommand implements BaseCommand {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
command: string;
|
|
5
|
+
describe: string;
|
|
6
|
+
/**
|
|
7
|
+
* @inheritDoc
|
|
8
|
+
*/
|
|
9
|
+
handler(args: ArgumentsCamelCase<BaseArgs>): Promise<void>;
|
|
10
|
+
private static checkPaths;
|
|
11
11
|
}
|