@yandjin-mikro-orm/cli 6.1.4-rc-sti-changes-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 +7 -0
- package/CLIConfigurator.js +68 -0
- package/CLIHelper.d.ts +21 -0
- package/CLIHelper.js +137 -0
- package/LICENSE +21 -0
- package/README.md +383 -0
- package/cli +18 -0
- package/cli.d.ts +2 -0
- package/cli.js +18 -0
- package/commands/ClearCacheCommand.d.ts +9 -0
- package/commands/ClearCacheCommand.js +23 -0
- package/commands/CreateDatabaseCommand.d.ts +9 -0
- package/commands/CreateDatabaseCommand.js +18 -0
- package/commands/CreateSeederCommand.d.ts +20 -0
- package/commands/CreateSeederCommand.js +38 -0
- package/commands/DatabaseSeedCommand.d.ts +16 -0
- package/commands/DatabaseSeedCommand.js +28 -0
- package/commands/DebugCommand.d.ts +10 -0
- package/commands/DebugCommand.js +80 -0
- package/commands/GenerateCacheCommand.d.ts +15 -0
- package/commands/GenerateCacheCommand.js +38 -0
- package/commands/GenerateEntitiesCommand.d.ts +19 -0
- package/commands/GenerateEntitiesCommand.js +52 -0
- package/commands/ImportCommand.d.ts +9 -0
- package/commands/ImportCommand.js +19 -0
- package/commands/MigrationCommandFactory.d.ts +48 -0
- package/commands/MigrationCommandFactory.js +221 -0
- package/commands/SchemaCommandFactory.d.ts +34 -0
- package/commands/SchemaCommandFactory.js +119 -0
- package/esm +18 -0
- package/esm.cmd +3 -0
- package/esm.d.ts +2 -0
- package/esm.js +18 -0
- package/index.d.ts +6 -0
- package/index.js +22 -0
- package/index.mjs +5 -0
- package/package.json +77 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MigrationCommandFactory = void 0;
|
|
4
|
+
const core_1 = require("@yandjin-mikro-orm/core");
|
|
5
|
+
const CLIHelper_1 = require("../CLIHelper");
|
|
6
|
+
class MigrationCommandFactory {
|
|
7
|
+
static DESCRIPTIONS = {
|
|
8
|
+
create: "Create new migration with current schema diff",
|
|
9
|
+
up: "Migrate up to the latest version",
|
|
10
|
+
down: "Migrate one step down",
|
|
11
|
+
list: "List all executed migrations",
|
|
12
|
+
check: "Check if migrations are needed. Useful for bash scripts.",
|
|
13
|
+
pending: "List all pending migrations",
|
|
14
|
+
fresh: "Clear the database and rerun all migrations",
|
|
15
|
+
};
|
|
16
|
+
static create(command) {
|
|
17
|
+
return {
|
|
18
|
+
command: `migration:${command}`,
|
|
19
|
+
describe: MigrationCommandFactory.DESCRIPTIONS[command],
|
|
20
|
+
builder: (args) => MigrationCommandFactory.configureMigrationCommand(args, command),
|
|
21
|
+
handler: (args) => MigrationCommandFactory.handleMigrationCommand(args, command),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
static configureMigrationCommand(args, method) {
|
|
25
|
+
if (method === "create") {
|
|
26
|
+
this.configureCreateCommand(args);
|
|
27
|
+
}
|
|
28
|
+
if (["up", "down"].includes(method)) {
|
|
29
|
+
this.configureUpDownCommand(args, method);
|
|
30
|
+
}
|
|
31
|
+
if (method === "fresh") {
|
|
32
|
+
this.configureFreshCommand(args);
|
|
33
|
+
}
|
|
34
|
+
return args;
|
|
35
|
+
}
|
|
36
|
+
static configureUpDownCommand(args, method) {
|
|
37
|
+
args.option("t", {
|
|
38
|
+
alias: "to",
|
|
39
|
+
type: "string",
|
|
40
|
+
desc: `Migrate ${method} to specific version`,
|
|
41
|
+
});
|
|
42
|
+
args.option("f", {
|
|
43
|
+
alias: "from",
|
|
44
|
+
type: "string",
|
|
45
|
+
desc: "Start migration from specific version",
|
|
46
|
+
});
|
|
47
|
+
args.option("o", {
|
|
48
|
+
alias: "only",
|
|
49
|
+
type: "string",
|
|
50
|
+
desc: "Migrate only specified versions",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
static configureCreateCommand(args) {
|
|
54
|
+
args.option("b", {
|
|
55
|
+
alias: "blank",
|
|
56
|
+
type: "boolean",
|
|
57
|
+
desc: "Create blank migration",
|
|
58
|
+
});
|
|
59
|
+
args.option("i", {
|
|
60
|
+
alias: "initial",
|
|
61
|
+
type: "boolean",
|
|
62
|
+
desc: "Create initial migration",
|
|
63
|
+
});
|
|
64
|
+
args.option("d", {
|
|
65
|
+
alias: "dump",
|
|
66
|
+
type: "boolean",
|
|
67
|
+
desc: "Dumps all queries to console",
|
|
68
|
+
});
|
|
69
|
+
args.option("p", {
|
|
70
|
+
alias: "path",
|
|
71
|
+
type: "string",
|
|
72
|
+
desc: "Sets path to directory where to save entities",
|
|
73
|
+
});
|
|
74
|
+
args.option("n", {
|
|
75
|
+
alias: "name",
|
|
76
|
+
type: "string",
|
|
77
|
+
desc: "Specify custom name for the file",
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
static async handleMigrationCommand(args, method) {
|
|
81
|
+
// to be able to run have a master transaction, but run marked migrations outside of it, we need a second connection
|
|
82
|
+
const options = { pool: { min: 1, max: 2 } };
|
|
83
|
+
const orm = await CLIHelper_1.CLIHelper.getORM(undefined, options);
|
|
84
|
+
const migrator = orm.getMigrator();
|
|
85
|
+
switch (method) {
|
|
86
|
+
case "create":
|
|
87
|
+
await this.handleCreateCommand(migrator, args, orm.config);
|
|
88
|
+
break;
|
|
89
|
+
case "check":
|
|
90
|
+
await this.handleCheckCommand(migrator, orm);
|
|
91
|
+
break;
|
|
92
|
+
case "list":
|
|
93
|
+
await this.handleListCommand(migrator);
|
|
94
|
+
break;
|
|
95
|
+
case "pending":
|
|
96
|
+
await this.handlePendingCommand(migrator);
|
|
97
|
+
break;
|
|
98
|
+
case "up":
|
|
99
|
+
case "down":
|
|
100
|
+
await this.handleUpDownCommand(args, migrator, method);
|
|
101
|
+
break;
|
|
102
|
+
case "fresh":
|
|
103
|
+
await this.handleFreshCommand(args, migrator, orm);
|
|
104
|
+
}
|
|
105
|
+
await orm.close(true);
|
|
106
|
+
}
|
|
107
|
+
static configureFreshCommand(args) {
|
|
108
|
+
args.option("seed", {
|
|
109
|
+
type: "string",
|
|
110
|
+
desc: "Allows to seed the database after dropping it and rerunning all migrations",
|
|
111
|
+
});
|
|
112
|
+
args.option("drop-db", {
|
|
113
|
+
type: "boolean",
|
|
114
|
+
desc: "Drop the whole database",
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
static async handleUpDownCommand(args, migrator, method) {
|
|
118
|
+
const opts = MigrationCommandFactory.getUpDownOptions(args);
|
|
119
|
+
await migrator[method](opts);
|
|
120
|
+
const message = this.getUpDownSuccessMessage(method, opts);
|
|
121
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.green(message));
|
|
122
|
+
}
|
|
123
|
+
static async handlePendingCommand(migrator) {
|
|
124
|
+
const pending = await migrator.getPendingMigrations();
|
|
125
|
+
CLIHelper_1.CLIHelper.dumpTable({
|
|
126
|
+
columns: ["Name"],
|
|
127
|
+
rows: pending.map((row) => [row.name]),
|
|
128
|
+
empty: "No pending migrations",
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
static async handleListCommand(migrator) {
|
|
132
|
+
const executed = await migrator.getExecutedMigrations();
|
|
133
|
+
CLIHelper_1.CLIHelper.dumpTable({
|
|
134
|
+
columns: ["Name", "Executed at"],
|
|
135
|
+
rows: executed.map((row) => {
|
|
136
|
+
/* istanbul ignore next */
|
|
137
|
+
const executedAt = (row.executed_at ?? row.created_at)?.toISOString() ??
|
|
138
|
+
"";
|
|
139
|
+
return [row.name.replace(/\.[jt]s$/, ""), executedAt];
|
|
140
|
+
}),
|
|
141
|
+
empty: "No migrations executed yet",
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
static async handleCreateCommand(migrator, args, config) {
|
|
145
|
+
const ret = await migrator.createMigration(args.path, args.blank, args.initial, args.name);
|
|
146
|
+
if (ret.diff.up.length === 0) {
|
|
147
|
+
return CLIHelper_1.CLIHelper.dump(core_1.colors.green(`No changes required, schema is up-to-date`));
|
|
148
|
+
}
|
|
149
|
+
if (args.dump) {
|
|
150
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.green("Creating migration with following queries:"));
|
|
151
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.green("up:"));
|
|
152
|
+
CLIHelper_1.CLIHelper.dump(ret.diff.up.map((sql) => " " + sql).join("\n"), config);
|
|
153
|
+
/* istanbul ignore next */
|
|
154
|
+
if (config.getDriver().getPlatform().supportsDownMigrations()) {
|
|
155
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.green("down:"));
|
|
156
|
+
CLIHelper_1.CLIHelper.dump(ret.diff.down.map((sql) => " " + sql).join("\n"), config);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.yellow(`(${config.getDriver().constructor.name} does not support automatic down migrations)`));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.green(`${ret.fileName} successfully created`));
|
|
163
|
+
}
|
|
164
|
+
static async handleCheckCommand(migrator, orm) {
|
|
165
|
+
if (!(await migrator.checkMigrationNeeded())) {
|
|
166
|
+
return CLIHelper_1.CLIHelper.dump(core_1.colors.green(`No changes required, schema is up-to-date`));
|
|
167
|
+
}
|
|
168
|
+
await orm.close(true);
|
|
169
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.yellow(`Changes detected. Please create migration to update schema.`));
|
|
170
|
+
process.exit(1);
|
|
171
|
+
}
|
|
172
|
+
static async handleFreshCommand(args, migrator, orm) {
|
|
173
|
+
const generator = orm.getSchemaGenerator();
|
|
174
|
+
await generator.dropSchema({
|
|
175
|
+
dropMigrationsTable: true,
|
|
176
|
+
dropDb: args.dropDb,
|
|
177
|
+
});
|
|
178
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.green("Dropped schema successfully"));
|
|
179
|
+
const opts = MigrationCommandFactory.getUpDownOptions(args);
|
|
180
|
+
await migrator.up(opts);
|
|
181
|
+
const message = this.getUpDownSuccessMessage("up", opts);
|
|
182
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.green(message));
|
|
183
|
+
if (args.seed !== undefined) {
|
|
184
|
+
const seeder = orm.getSeeder();
|
|
185
|
+
const seederClass = args.seed || orm.config.get("seeder").defaultSeeder;
|
|
186
|
+
await seeder.seedString(seederClass);
|
|
187
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.green(`Database seeded successfully with seeder class ${seederClass}`));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
static getUpDownOptions(flags) {
|
|
191
|
+
if (!flags.to && !flags.from && flags.only) {
|
|
192
|
+
return { migrations: flags.only.split(/[, ]+/) };
|
|
193
|
+
}
|
|
194
|
+
const ret = {};
|
|
195
|
+
["from", "to"]
|
|
196
|
+
.filter((k) => flags[k])
|
|
197
|
+
.forEach((k) => (ret[k] = flags[k] === "0" ? 0 : flags[k]));
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
|
+
static getUpDownSuccessMessage(method, options) {
|
|
201
|
+
const msg = `Successfully migrated ${method}`;
|
|
202
|
+
if (method === "down" && core_1.Utils.isEmpty(options)) {
|
|
203
|
+
return msg + " to previous version";
|
|
204
|
+
}
|
|
205
|
+
if (options.to === 0) {
|
|
206
|
+
const v = { down: "first", up: "latest" }[method];
|
|
207
|
+
return `${msg} to the ${v} version`;
|
|
208
|
+
}
|
|
209
|
+
if (method === "up" && core_1.Utils.isEmpty(options)) {
|
|
210
|
+
return msg + " to the latest version";
|
|
211
|
+
}
|
|
212
|
+
if (core_1.Utils.isString(options.to)) {
|
|
213
|
+
return msg + " to version " + options.to;
|
|
214
|
+
}
|
|
215
|
+
if (options.migrations && options.migrations.length === 1) {
|
|
216
|
+
return msg + " to version " + options.migrations[0];
|
|
217
|
+
}
|
|
218
|
+
return msg;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.MigrationCommandFactory = MigrationCommandFactory;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ArgumentsCamelCase, Argv, CommandModule } from "yargs";
|
|
2
|
+
export declare class SchemaCommandFactory {
|
|
3
|
+
static readonly DESCRIPTIONS: {
|
|
4
|
+
create: string;
|
|
5
|
+
update: string;
|
|
6
|
+
drop: string;
|
|
7
|
+
fresh: string;
|
|
8
|
+
};
|
|
9
|
+
static readonly SUCCESS_MESSAGES: {
|
|
10
|
+
create: string;
|
|
11
|
+
update: string;
|
|
12
|
+
drop: string;
|
|
13
|
+
fresh: string;
|
|
14
|
+
};
|
|
15
|
+
static create<U extends Options = Options>(command: SchemaMethod): CommandModule<unknown, U> & {
|
|
16
|
+
builder: (args: Argv) => Argv<U>;
|
|
17
|
+
handler: (args: ArgumentsCamelCase<U>) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
static configureSchemaCommand(args: Argv, command: SchemaMethod): Argv<{}>;
|
|
20
|
+
static handleSchemaCommand(args: ArgumentsCamelCase<Options>, method: SchemaMethod, successMessage: string): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
type SchemaMethod = "create" | "update" | "drop" | "fresh";
|
|
23
|
+
export type Options = {
|
|
24
|
+
dump: boolean;
|
|
25
|
+
run: boolean;
|
|
26
|
+
fkChecks: boolean;
|
|
27
|
+
dropMigrationsTable: boolean;
|
|
28
|
+
dropDb: boolean;
|
|
29
|
+
dropTables: boolean;
|
|
30
|
+
safe: boolean;
|
|
31
|
+
seed: string;
|
|
32
|
+
schema: string;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaCommandFactory = void 0;
|
|
4
|
+
const core_1 = require("@yandjin-mikro-orm/core");
|
|
5
|
+
const CLIHelper_1 = require("../CLIHelper");
|
|
6
|
+
class SchemaCommandFactory {
|
|
7
|
+
static DESCRIPTIONS = {
|
|
8
|
+
create: "Create database schema based on current metadata",
|
|
9
|
+
update: "Update database schema based on current metadata",
|
|
10
|
+
drop: "Drop database schema based on current metadata",
|
|
11
|
+
fresh: "Drop and recreate database schema based on current metadata",
|
|
12
|
+
};
|
|
13
|
+
static SUCCESS_MESSAGES = {
|
|
14
|
+
create: "Schema successfully created",
|
|
15
|
+
update: "Schema successfully updated",
|
|
16
|
+
drop: "Schema successfully dropped",
|
|
17
|
+
fresh: "Schema successfully dropped and recreated",
|
|
18
|
+
};
|
|
19
|
+
static create(command) {
|
|
20
|
+
const successMessage = SchemaCommandFactory.SUCCESS_MESSAGES[command];
|
|
21
|
+
return {
|
|
22
|
+
command: `schema:${command}`,
|
|
23
|
+
describe: SchemaCommandFactory.DESCRIPTIONS[command],
|
|
24
|
+
builder: (args) => SchemaCommandFactory.configureSchemaCommand(args, command),
|
|
25
|
+
handler: (args) => SchemaCommandFactory.handleSchemaCommand(args, command, successMessage),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
static configureSchemaCommand(args, command) {
|
|
29
|
+
args.option("r", {
|
|
30
|
+
alias: "run",
|
|
31
|
+
type: "boolean",
|
|
32
|
+
desc: "Runs queries",
|
|
33
|
+
});
|
|
34
|
+
if (command !== "fresh") {
|
|
35
|
+
args.option("d", {
|
|
36
|
+
alias: "dump",
|
|
37
|
+
type: "boolean",
|
|
38
|
+
desc: "Dumps all queries to console",
|
|
39
|
+
});
|
|
40
|
+
args.option("fk-checks", {
|
|
41
|
+
type: "boolean",
|
|
42
|
+
desc: "Do not skip foreign key checks",
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
args.option("schema", {
|
|
46
|
+
type: "string",
|
|
47
|
+
desc: "Set the current schema for wildcard schema entities",
|
|
48
|
+
});
|
|
49
|
+
if (["create", "fresh"].includes(command)) {
|
|
50
|
+
args.option("seed", {
|
|
51
|
+
type: "string",
|
|
52
|
+
desc: "Allows to seed the database on create or drop and recreate",
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (command === "update") {
|
|
56
|
+
args.option("safe", {
|
|
57
|
+
type: "boolean",
|
|
58
|
+
desc: "Allows to disable table and column dropping",
|
|
59
|
+
default: false,
|
|
60
|
+
});
|
|
61
|
+
args.option("drop-tables", {
|
|
62
|
+
type: "boolean",
|
|
63
|
+
desc: "Allows to disable table dropping",
|
|
64
|
+
default: true,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if (command === "drop") {
|
|
68
|
+
args.option("drop-migrations-table", {
|
|
69
|
+
type: "boolean",
|
|
70
|
+
desc: "Drop also migrations table",
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (["drop", "fresh"].includes(command)) {
|
|
74
|
+
args.option("drop-db", {
|
|
75
|
+
type: "boolean",
|
|
76
|
+
desc: "Drop the whole database",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return args;
|
|
80
|
+
}
|
|
81
|
+
static async handleSchemaCommand(args, method, successMessage) {
|
|
82
|
+
if (!args.run && !args.dump) {
|
|
83
|
+
return CLIHelper_1.CLIHelper.showHelp();
|
|
84
|
+
}
|
|
85
|
+
const orm = await CLIHelper_1.CLIHelper.getORM();
|
|
86
|
+
const generator = orm.getSchemaGenerator();
|
|
87
|
+
const params = {
|
|
88
|
+
wrap: args.fkChecks == null ? undefined : !args.fkChecks,
|
|
89
|
+
...args,
|
|
90
|
+
};
|
|
91
|
+
if (args.dump) {
|
|
92
|
+
const m = `get${method.substr(0, 1).toUpperCase()}${method.substr(1)}SchemaSQL`;
|
|
93
|
+
const dump = await generator[m](params);
|
|
94
|
+
/* istanbul ignore next */
|
|
95
|
+
if (dump) {
|
|
96
|
+
CLIHelper_1.CLIHelper.dump(dump, orm.config);
|
|
97
|
+
successMessage = "";
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
successMessage = "Schema is up-to-date";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else if (method === "fresh") {
|
|
104
|
+
await generator.dropSchema(params);
|
|
105
|
+
await generator.createSchema(params);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const m = (method + "Schema");
|
|
109
|
+
await generator[m](params);
|
|
110
|
+
}
|
|
111
|
+
if (args.seed !== undefined) {
|
|
112
|
+
const seeder = orm.getSeeder();
|
|
113
|
+
await seeder.seedString(args.seed || orm.config.get("seeder").defaultSeeder);
|
|
114
|
+
}
|
|
115
|
+
CLIHelper_1.CLIHelper.dump(core_1.colors.green(successMessage));
|
|
116
|
+
await orm.close(true);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.SchemaCommandFactory = SchemaCommandFactory;
|
package/esm
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
|
+
require('@jercle/yargonaut')
|
|
6
|
+
.style('blue')
|
|
7
|
+
.style('yellow', 'required')
|
|
8
|
+
.helpStyle('green')
|
|
9
|
+
.errorsStyle('red');
|
|
10
|
+
const CLIHelper_1 = require("./CLIHelper");
|
|
11
|
+
const CLIConfigurator_1 = require("./CLIConfigurator");
|
|
12
|
+
(async () => {
|
|
13
|
+
const argv = await CLIConfigurator_1.CLIConfigurator.configure();
|
|
14
|
+
const args = await argv.parse(process.argv.slice(2));
|
|
15
|
+
if (args._.length === 0) {
|
|
16
|
+
CLIHelper_1.CLIHelper.showHelp();
|
|
17
|
+
}
|
|
18
|
+
})();
|
package/esm.cmd
ADDED
package/esm.d.ts
ADDED
package/esm.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
|
+
require('@jercle/yargonaut')
|
|
6
|
+
.style('blue')
|
|
7
|
+
.style('yellow', 'required')
|
|
8
|
+
.helpStyle('green')
|
|
9
|
+
.errorsStyle('red');
|
|
10
|
+
const CLIHelper_1 = require("./CLIHelper");
|
|
11
|
+
const CLIConfigurator_1 = require("./CLIConfigurator");
|
|
12
|
+
(async () => {
|
|
13
|
+
const argv = await CLIConfigurator_1.CLIConfigurator.configure();
|
|
14
|
+
const args = await argv.parse(process.argv.slice(2));
|
|
15
|
+
if (args._.length === 0) {
|
|
16
|
+
CLIHelper_1.CLIHelper.showHelp();
|
|
17
|
+
}
|
|
18
|
+
})();
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* @packageDocumentation
|
|
19
|
+
* @module cli
|
|
20
|
+
*/
|
|
21
|
+
__exportStar(require("./CLIHelper"), exports);
|
|
22
|
+
__exportStar(require("./CLIConfigurator"), exports);
|
package/index.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yandjin-mikro-orm/cli",
|
|
3
|
+
"version": "6.1.4-rc-sti-changes-1",
|
|
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.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"module": "index.mjs",
|
|
7
|
+
"typings": "index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./package.json": "./package.json",
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"default": "./index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"require": "./index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"orm",
|
|
24
|
+
"mongo",
|
|
25
|
+
"mongodb",
|
|
26
|
+
"mysql",
|
|
27
|
+
"mariadb",
|
|
28
|
+
"postgresql",
|
|
29
|
+
"sqlite",
|
|
30
|
+
"sqlite3",
|
|
31
|
+
"ts",
|
|
32
|
+
"typescript",
|
|
33
|
+
"js",
|
|
34
|
+
"javascript",
|
|
35
|
+
"entity",
|
|
36
|
+
"ddd",
|
|
37
|
+
"mikro-orm",
|
|
38
|
+
"unit-of-work",
|
|
39
|
+
"data-mapper",
|
|
40
|
+
"identity-map"
|
|
41
|
+
],
|
|
42
|
+
"author": "Martin Adámek",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/mikro-orm/mikro-orm/issues"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://mikro-orm.io",
|
|
48
|
+
"bin": {
|
|
49
|
+
"mikro-orm": "./cli",
|
|
50
|
+
"mikro-orm-esm": "./esm"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">= 18.12.0"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "yarn clean && yarn compile && yarn copy && yarn run -T gen-esm-wrapper index.js index.mjs",
|
|
57
|
+
"clean": "yarn run -T rimraf ./dist",
|
|
58
|
+
"compile": "yarn run -T tsc -p tsconfig.build.json",
|
|
59
|
+
"copy": "node ../../scripts/copy.mjs"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@jercle/yargonaut": "1.1.5",
|
|
66
|
+
"@yandjin-mikro-orm/core": "6.1.4-rc-sti-changes-1",
|
|
67
|
+
"@yandjin-mikro-orm/knex": "6.1.4-rc-sti-changes-1",
|
|
68
|
+
"fs-extra": "11.2.0",
|
|
69
|
+
"tsconfig-paths": "4.2.0",
|
|
70
|
+
"yargs": "17.7.2"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@yandjin-mikro-orm/entity-generator": "^6.1.4-rc-sti-changes-1",
|
|
74
|
+
"@yandjin-mikro-orm/migrations": "^6.1.4-rc-sti-changes-1",
|
|
75
|
+
"@yandjin-mikro-orm/seeder": "^6.1.4-rc-sti-changes-1"
|
|
76
|
+
}
|
|
77
|
+
}
|