@h3ravel/arquebus 0.3.2 → 0.3.4
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/bin/index.cjs +14 -51
- package/bin/index.js +10 -48
- package/dist/index.cjs +6 -46
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +5 -45
- package/dist/migrations/index.cjs +6 -46
- package/dist/migrations/index.d.cts +0 -1
- package/dist/migrations/index.d.ts +0 -1
- package/dist/migrations/index.js +5 -45
- package/package.json +2 -1
package/bin/index.cjs
CHANGED
|
@@ -34,8 +34,6 @@ let commander = require("commander");
|
|
|
34
34
|
commander = __toESM(commander);
|
|
35
35
|
let fs_promises = require("fs/promises");
|
|
36
36
|
fs_promises = __toESM(fs_promises);
|
|
37
|
-
let chalk = require("chalk");
|
|
38
|
-
chalk = __toESM(chalk);
|
|
39
37
|
let escalade_sync = require("escalade/sync");
|
|
40
38
|
escalade_sync = __toESM(escalade_sync);
|
|
41
39
|
let path = require("path");
|
|
@@ -44,6 +42,8 @@ let resolve_from = require("resolve-from");
|
|
|
44
42
|
resolve_from = __toESM(resolve_from);
|
|
45
43
|
let node_fs_promises = require("node:fs/promises");
|
|
46
44
|
node_fs_promises = __toESM(node_fs_promises);
|
|
45
|
+
let __h3ravel_shared = require("@h3ravel/shared");
|
|
46
|
+
__h3ravel_shared = __toESM(__h3ravel_shared);
|
|
47
47
|
let radashi = require("radashi");
|
|
48
48
|
radashi = __toESM(radashi);
|
|
49
49
|
let dayjs_plugin_advancedFormat_js = require("dayjs/plugin/advancedFormat.js");
|
|
@@ -64,6 +64,8 @@ let node_path = require("node:path");
|
|
|
64
64
|
node_path = __toESM(node_path);
|
|
65
65
|
let node_url = require("node:url");
|
|
66
66
|
node_url = __toESM(node_url);
|
|
67
|
+
let chalk = require("chalk");
|
|
68
|
+
chalk = __toESM(chalk);
|
|
67
69
|
let dotenv = require("dotenv");
|
|
68
70
|
dotenv = __toESM(dotenv);
|
|
69
71
|
|
|
@@ -77,35 +79,8 @@ var Utils = class {
|
|
|
77
79
|
* @param color
|
|
78
80
|
* @returns
|
|
79
81
|
*/
|
|
80
|
-
static textFormat(txt, color
|
|
81
|
-
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Ouput formater object
|
|
85
|
-
*
|
|
86
|
-
* @returns
|
|
87
|
-
*/
|
|
88
|
-
static output() {
|
|
89
|
-
return {
|
|
90
|
-
success: (msg, exit = false) => {
|
|
91
|
-
console.log(chalk.default.green("✓"), this.textFormat(msg, chalk.default.bgGreen), "\n");
|
|
92
|
-
if (exit) process.exit(0);
|
|
93
|
-
},
|
|
94
|
-
info: (msg, exit = false) => {
|
|
95
|
-
console.log(chalk.default.blue("ℹ"), this.textFormat(msg, chalk.default.bgBlue), "\n");
|
|
96
|
-
if (exit) process.exit(0);
|
|
97
|
-
},
|
|
98
|
-
error: (msg, exit = true) => {
|
|
99
|
-
if (msg instanceof Error) {
|
|
100
|
-
if (msg.message) console.error(chalk.default.red("✖"), this.textFormat(msg.message, chalk.default.bgRed));
|
|
101
|
-
console.error(chalk.default.red(`${msg.detail ? `${msg.detail}\n` : ""}${msg.stack}`), "\n");
|
|
102
|
-
} else console.error(chalk.default.red("✖"), this.textFormat(msg, chalk.default.bgRed), "\n");
|
|
103
|
-
if (exit) process.exit(1);
|
|
104
|
-
},
|
|
105
|
-
quiet: () => {
|
|
106
|
-
process.exit(0);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
82
|
+
static textFormat(txt, color) {
|
|
83
|
+
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
|
|
109
84
|
}
|
|
110
85
|
static findModulePkg(moduleId, cwd) {
|
|
111
86
|
const parts = moduleId.replace(/\\/g, "/").split("/");
|
|
@@ -121,12 +96,6 @@ var Utils = class {
|
|
|
121
96
|
if (path$6) return [join(cwd, path$6)];
|
|
122
97
|
return [...migrator.getPaths(), join(cwd, defaultPath)];
|
|
123
98
|
}
|
|
124
|
-
static twoColumnDetail(name$1, value) {
|
|
125
|
-
const regex = /\x1b\[\d+m/g;
|
|
126
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
127
|
-
const dots = Math.max(width - name$1.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
128
|
-
return console.log(name$1, chalk.default.gray(".".repeat(dots)), value);
|
|
129
|
-
}
|
|
130
99
|
/**
|
|
131
100
|
* Check if file exists
|
|
132
101
|
*
|
|
@@ -323,7 +292,7 @@ var Migrator = class {
|
|
|
323
292
|
for (const migration of migrations) {
|
|
324
293
|
const file = files$1[migration.migration];
|
|
325
294
|
if (!file) {
|
|
326
|
-
|
|
295
|
+
__h3ravel_shared.Logger.twoColumnLog(__h3ravel_shared.Logger.parse([[migration.migration, "green"]], "", false), __h3ravel_shared.Logger.parse([["Migration not found", "yellow"]], "", false));
|
|
327
296
|
continue;
|
|
328
297
|
}
|
|
329
298
|
rolledBack.push(file);
|
|
@@ -408,13 +377,6 @@ var Migrator = class {
|
|
|
408
377
|
write(...args) {
|
|
409
378
|
if (this.output) console.log(...args);
|
|
410
379
|
}
|
|
411
|
-
writeTwoColumns(name$1, ...args) {
|
|
412
|
-
const value = args.join(" ");
|
|
413
|
-
const regex = /\x1b\[\d+m/g;
|
|
414
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
415
|
-
const dots = Math.max(width - name$1.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
416
|
-
this.write(name$1, chalk.default.gray(".".repeat(dots)), value);
|
|
417
|
-
}
|
|
418
380
|
async writeTask(description$1, task) {
|
|
419
381
|
const startTime = process.hrtime();
|
|
420
382
|
let result = false;
|
|
@@ -423,7 +385,7 @@ var Migrator = class {
|
|
|
423
385
|
} finally {
|
|
424
386
|
const endTime = process.hrtime(startTime);
|
|
425
387
|
const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
426
|
-
|
|
388
|
+
__h3ravel_shared.Logger.twoColumnLog(__h3ravel_shared.Logger.parse([[description$1, "green"]], "", false), [__h3ravel_shared.Logger.parse([[`${Math.floor(duration)}ms`, "gray"]], "", false), __h3ravel_shared.Logger.parse([[result !== false ? "✔" : "✘", result !== false ? "green" : "red"]], "", false)].join(" "));
|
|
427
389
|
}
|
|
428
390
|
}
|
|
429
391
|
};
|
|
@@ -4040,7 +4002,7 @@ var migration_creator_default = MigrationCreator;
|
|
|
4040
4002
|
//#endregion
|
|
4041
4003
|
//#region package.json
|
|
4042
4004
|
var name = "@h3ravel/arquebus";
|
|
4043
|
-
var version = "0.3.
|
|
4005
|
+
var version = "0.3.3";
|
|
4044
4006
|
var packageManager = "pnpm@10.14.0";
|
|
4045
4007
|
var description = "Arquebus ORM is a Beautiful, expressive ORM inspired by Laravel's Eloquent, designed for TypeScript applications and for the H3ravel Framework.";
|
|
4046
4008
|
var homepage = "https://h3ravel.toneflix.net/arquebus";
|
|
@@ -4154,6 +4116,7 @@ var scripts = {
|
|
|
4154
4116
|
var husky = { "hooks": { "pre-commit": "lint-staged" } };
|
|
4155
4117
|
var lint_staged = { "*.{js,json}": ["prettier --write", "git add"] };
|
|
4156
4118
|
var dependencies = {
|
|
4119
|
+
"@h3ravel/shared": "^0.17.4",
|
|
4157
4120
|
"chalk": "^5.6.0",
|
|
4158
4121
|
"collect.js": "^4.36.1",
|
|
4159
4122
|
"commander": "^14.0.0",
|
|
@@ -4237,7 +4200,7 @@ var package_default = {
|
|
|
4237
4200
|
//#region src/cli/cli.ts
|
|
4238
4201
|
var Cli = class Cli {
|
|
4239
4202
|
cwd;
|
|
4240
|
-
output =
|
|
4203
|
+
output = __h3ravel_shared.Logger.log();
|
|
4241
4204
|
config = {};
|
|
4242
4205
|
basePath = "";
|
|
4243
4206
|
modulePath;
|
|
@@ -4336,7 +4299,7 @@ var Cli = class Cli {
|
|
|
4336
4299
|
const creator = new migration_creator_default(path.default.join(packagePath, pkgJson.migrations ?? "migrations"));
|
|
4337
4300
|
this.output.info(`INFO: Publishing migrations from ${chalk.default.italic.gray(pkgJson.name + "@" + pkgJson.version)}`);
|
|
4338
4301
|
await creator.publish(basePath, (fileName) => {
|
|
4339
|
-
|
|
4302
|
+
__h3ravel_shared.Logger.twoColumnLog(fileName, chalk.default.green("PUBLISHED"));
|
|
4340
4303
|
});
|
|
4341
4304
|
} catch (e) {
|
|
4342
4305
|
this.output.error("ERROR: " + e);
|
|
@@ -4379,10 +4342,10 @@ var Cli = class Cli {
|
|
|
4379
4342
|
if (sts) this.output[sts](msg);
|
|
4380
4343
|
}).status(this.config, opts, true);
|
|
4381
4344
|
if (migrations.length > 0) {
|
|
4382
|
-
|
|
4345
|
+
__h3ravel_shared.Logger.twoColumnLog(chalk.default.gray("Migration name"), chalk.default.gray("Batch / Status"));
|
|
4383
4346
|
migrations.forEach((migration) => {
|
|
4384
4347
|
const status = migration.ran ? `[${migration.batch}] ${chalk.default.green("Ran")}` : chalk.default.yellow("Pending");
|
|
4385
|
-
|
|
4348
|
+
__h3ravel_shared.Logger.twoColumnLog(migration.name, status);
|
|
4386
4349
|
});
|
|
4387
4350
|
} else console.log("No migrations found");
|
|
4388
4351
|
} catch (e) {
|
package/bin/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import "node:module";
|
|
3
3
|
import { Argument, Option, program } from "commander";
|
|
4
4
|
import { access } from "fs/promises";
|
|
5
|
-
import chalk from "chalk";
|
|
6
5
|
import escalade from "escalade/sync";
|
|
7
6
|
import path from "path";
|
|
8
7
|
import resolveFrom from "resolve-from";
|
|
9
8
|
import fs, { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
9
|
+
import { Logger } from "@h3ravel/shared";
|
|
10
10
|
import { assign, camel, diff, flat, get, isArray, isEmpty, isEqual, isString, omit, pick, set, snake, trim } from "radashi";
|
|
11
11
|
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
|
12
12
|
import dayjs from "dayjs";
|
|
@@ -17,6 +17,7 @@ import { existsSync } from "fs";
|
|
|
17
17
|
import { existsSync as existsSync$1, readFileSync } from "node:fs";
|
|
18
18
|
import { dirname } from "node:path";
|
|
19
19
|
import { fileURLToPath } from "node:url";
|
|
20
|
+
import chalk from "chalk";
|
|
20
21
|
import { config } from "dotenv";
|
|
21
22
|
|
|
22
23
|
//#region rolldown:runtime
|
|
@@ -44,33 +45,6 @@ var Utils = class {
|
|
|
44
45
|
static textFormat(txt, color) {
|
|
45
46
|
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
|
|
46
47
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Ouput formater object
|
|
49
|
-
*
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
static output() {
|
|
53
|
-
return {
|
|
54
|
-
success: (msg, exit = false) => {
|
|
55
|
-
console.log(chalk.green("✓"), this.textFormat(msg, chalk.bgGreen), "\n");
|
|
56
|
-
if (exit) process.exit(0);
|
|
57
|
-
},
|
|
58
|
-
info: (msg, exit = false) => {
|
|
59
|
-
console.log(chalk.blue("ℹ"), this.textFormat(msg, chalk.bgBlue), "\n");
|
|
60
|
-
if (exit) process.exit(0);
|
|
61
|
-
},
|
|
62
|
-
error: (msg, exit = true) => {
|
|
63
|
-
if (msg instanceof Error) {
|
|
64
|
-
if (msg.message) console.error(chalk.red("✖"), this.textFormat(msg.message, chalk.bgRed));
|
|
65
|
-
console.error(chalk.red(`${msg.detail ? `${msg.detail}\n` : ""}${msg.stack}`), "\n");
|
|
66
|
-
} else console.error(chalk.red("✖"), this.textFormat(msg, chalk.bgRed), "\n");
|
|
67
|
-
if (exit) process.exit(1);
|
|
68
|
-
},
|
|
69
|
-
quiet: () => {
|
|
70
|
-
process.exit(0);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
48
|
static findModulePkg(moduleId, cwd) {
|
|
75
49
|
const parts = moduleId.replace(/\\/g, "/").split("/");
|
|
76
50
|
let packageName = "";
|
|
@@ -85,12 +59,6 @@ var Utils = class {
|
|
|
85
59
|
if (path$1) return [join(cwd, path$1)];
|
|
86
60
|
return [...migrator.getPaths(), join(cwd, defaultPath)];
|
|
87
61
|
}
|
|
88
|
-
static twoColumnDetail(name$1, value) {
|
|
89
|
-
const regex = /\x1b\[\d+m/g;
|
|
90
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
91
|
-
const dots = Math.max(width - name$1.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
92
|
-
return console.log(name$1, chalk.gray(".".repeat(dots)), value);
|
|
93
|
-
}
|
|
94
62
|
/**
|
|
95
63
|
* Check if file exists
|
|
96
64
|
*
|
|
@@ -287,7 +255,7 @@ var Migrator = class {
|
|
|
287
255
|
for (const migration of migrations) {
|
|
288
256
|
const file = files$1[migration.migration];
|
|
289
257
|
if (!file) {
|
|
290
|
-
|
|
258
|
+
Logger.twoColumnLog(Logger.parse([[migration.migration, "green"]], "", false), Logger.parse([["Migration not found", "yellow"]], "", false));
|
|
291
259
|
continue;
|
|
292
260
|
}
|
|
293
261
|
rolledBack.push(file);
|
|
@@ -372,13 +340,6 @@ var Migrator = class {
|
|
|
372
340
|
write(...args) {
|
|
373
341
|
if (this.output) console.log(...args);
|
|
374
342
|
}
|
|
375
|
-
writeTwoColumns(name$1, ...args) {
|
|
376
|
-
const value = args.join(" ");
|
|
377
|
-
const regex = /\x1b\[\d+m/g;
|
|
378
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
379
|
-
const dots = Math.max(width - name$1.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
380
|
-
this.write(name$1, chalk.gray(".".repeat(dots)), value);
|
|
381
|
-
}
|
|
382
343
|
async writeTask(description$1, task) {
|
|
383
344
|
const startTime = process.hrtime();
|
|
384
345
|
let result = false;
|
|
@@ -387,7 +348,7 @@ var Migrator = class {
|
|
|
387
348
|
} finally {
|
|
388
349
|
const endTime = process.hrtime(startTime);
|
|
389
350
|
const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
390
|
-
|
|
351
|
+
Logger.twoColumnLog(Logger.parse([[description$1, "green"]], "", false), [Logger.parse([[`${Math.floor(duration)}ms`, "gray"]], "", false), Logger.parse([[result !== false ? "✔" : "✘", result !== false ? "green" : "red"]], "", false)].join(" "));
|
|
391
352
|
}
|
|
392
353
|
}
|
|
393
354
|
};
|
|
@@ -4004,7 +3965,7 @@ var migration_creator_default = MigrationCreator;
|
|
|
4004
3965
|
//#endregion
|
|
4005
3966
|
//#region package.json
|
|
4006
3967
|
var name = "@h3ravel/arquebus";
|
|
4007
|
-
var version = "0.3.
|
|
3968
|
+
var version = "0.3.3";
|
|
4008
3969
|
var packageManager = "pnpm@10.14.0";
|
|
4009
3970
|
var description = "Arquebus ORM is a Beautiful, expressive ORM inspired by Laravel's Eloquent, designed for TypeScript applications and for the H3ravel Framework.";
|
|
4010
3971
|
var homepage = "https://h3ravel.toneflix.net/arquebus";
|
|
@@ -4118,6 +4079,7 @@ var scripts = {
|
|
|
4118
4079
|
var husky = { "hooks": { "pre-commit": "lint-staged" } };
|
|
4119
4080
|
var lint_staged = { "*.{js,json}": ["prettier --write", "git add"] };
|
|
4120
4081
|
var dependencies = {
|
|
4082
|
+
"@h3ravel/shared": "^0.17.4",
|
|
4121
4083
|
"chalk": "^5.6.0",
|
|
4122
4084
|
"collect.js": "^4.36.1",
|
|
4123
4085
|
"commander": "^14.0.0",
|
|
@@ -4201,7 +4163,7 @@ var package_default = {
|
|
|
4201
4163
|
//#region src/cli/cli.ts
|
|
4202
4164
|
var Cli = class Cli {
|
|
4203
4165
|
cwd;
|
|
4204
|
-
output =
|
|
4166
|
+
output = Logger.log();
|
|
4205
4167
|
config = {};
|
|
4206
4168
|
basePath = "";
|
|
4207
4169
|
modulePath;
|
|
@@ -4300,7 +4262,7 @@ var Cli = class Cli {
|
|
|
4300
4262
|
const creator = new migration_creator_default(path.join(packagePath, pkgJson.migrations ?? "migrations"));
|
|
4301
4263
|
this.output.info(`INFO: Publishing migrations from ${chalk.italic.gray(pkgJson.name + "@" + pkgJson.version)}`);
|
|
4302
4264
|
await creator.publish(basePath, (fileName) => {
|
|
4303
|
-
|
|
4265
|
+
Logger.twoColumnLog(fileName, chalk.green("PUBLISHED"));
|
|
4304
4266
|
});
|
|
4305
4267
|
} catch (e) {
|
|
4306
4268
|
this.output.error("ERROR: " + e);
|
|
@@ -4343,10 +4305,10 @@ var Cli = class Cli {
|
|
|
4343
4305
|
if (sts) this.output[sts](msg);
|
|
4344
4306
|
}).status(this.config, opts, true);
|
|
4345
4307
|
if (migrations.length > 0) {
|
|
4346
|
-
|
|
4308
|
+
Logger.twoColumnLog(chalk.gray("Migration name"), chalk.gray("Batch / Status"));
|
|
4347
4309
|
migrations.forEach((migration) => {
|
|
4348
4310
|
const status = migration.ran ? `[${migration.batch}] ${chalk.green("Ran")}` : chalk.yellow("Pending");
|
|
4349
|
-
|
|
4311
|
+
Logger.twoColumnLog(migration.name, status);
|
|
4350
4312
|
});
|
|
4351
4313
|
} else console.log("No migrations found");
|
|
4352
4314
|
} catch (e) {
|
package/dist/index.cjs
CHANGED
|
@@ -45,8 +45,8 @@ let fs = require("fs");
|
|
|
45
45
|
fs = __toESM(fs);
|
|
46
46
|
let pluralize = require("pluralize");
|
|
47
47
|
pluralize = __toESM(pluralize);
|
|
48
|
-
let
|
|
49
|
-
|
|
48
|
+
let __h3ravel_shared = require("@h3ravel/shared");
|
|
49
|
+
__h3ravel_shared = __toESM(__h3ravel_shared);
|
|
50
50
|
let node_fs_promises = require("node:fs/promises");
|
|
51
51
|
node_fs_promises = __toESM(node_fs_promises);
|
|
52
52
|
let fs_promises = require("fs/promises");
|
|
@@ -3651,7 +3651,7 @@ var Migrator = class {
|
|
|
3651
3651
|
for (const migration of migrations) {
|
|
3652
3652
|
const file = files[migration.migration];
|
|
3653
3653
|
if (!file) {
|
|
3654
|
-
|
|
3654
|
+
__h3ravel_shared.Logger.twoColumnLog(__h3ravel_shared.Logger.parse([[migration.migration, "green"]], "", false), __h3ravel_shared.Logger.parse([["Migration not found", "yellow"]], "", false));
|
|
3655
3655
|
continue;
|
|
3656
3656
|
}
|
|
3657
3657
|
rolledBack.push(file);
|
|
@@ -3736,13 +3736,6 @@ var Migrator = class {
|
|
|
3736
3736
|
write(...args) {
|
|
3737
3737
|
if (this.output) console.log(...args);
|
|
3738
3738
|
}
|
|
3739
|
-
writeTwoColumns(name, ...args) {
|
|
3740
|
-
const value = args.join(" ");
|
|
3741
|
-
const regex = /\x1b\[\d+m/g;
|
|
3742
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
3743
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
3744
|
-
this.write(name, chalk.default.gray(".".repeat(dots)), value);
|
|
3745
|
-
}
|
|
3746
3739
|
async writeTask(description, task) {
|
|
3747
3740
|
const startTime = process.hrtime();
|
|
3748
3741
|
let result = false;
|
|
@@ -3751,7 +3744,7 @@ var Migrator = class {
|
|
|
3751
3744
|
} finally {
|
|
3752
3745
|
const endTime = process.hrtime(startTime);
|
|
3753
3746
|
const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
3754
|
-
|
|
3747
|
+
__h3ravel_shared.Logger.twoColumnLog(__h3ravel_shared.Logger.parse([[description, "green"]], "", false), [__h3ravel_shared.Logger.parse([[`${Math.floor(duration)}ms`, "gray"]], "", false), __h3ravel_shared.Logger.parse([[result !== false ? "✔" : "✘", result !== false ? "green" : "red"]], "", false)].join(" "));
|
|
3755
3748
|
}
|
|
3756
3749
|
}
|
|
3757
3750
|
};
|
|
@@ -3768,35 +3761,8 @@ var Utils = class {
|
|
|
3768
3761
|
* @param color
|
|
3769
3762
|
* @returns
|
|
3770
3763
|
*/
|
|
3771
|
-
static textFormat(txt, color
|
|
3772
|
-
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color
|
|
3773
|
-
}
|
|
3774
|
-
/**
|
|
3775
|
-
* Ouput formater object
|
|
3776
|
-
*
|
|
3777
|
-
* @returns
|
|
3778
|
-
*/
|
|
3779
|
-
static output() {
|
|
3780
|
-
return {
|
|
3781
|
-
success: (msg, exit = false) => {
|
|
3782
|
-
console.log(chalk.default.green("✓"), this.textFormat(msg, chalk.default.bgGreen), "\n");
|
|
3783
|
-
if (exit) process.exit(0);
|
|
3784
|
-
},
|
|
3785
|
-
info: (msg, exit = false) => {
|
|
3786
|
-
console.log(chalk.default.blue("ℹ"), this.textFormat(msg, chalk.default.bgBlue), "\n");
|
|
3787
|
-
if (exit) process.exit(0);
|
|
3788
|
-
},
|
|
3789
|
-
error: (msg, exit = true) => {
|
|
3790
|
-
if (msg instanceof Error) {
|
|
3791
|
-
if (msg.message) console.error(chalk.default.red("✖"), this.textFormat(msg.message, chalk.default.bgRed));
|
|
3792
|
-
console.error(chalk.default.red(`${msg.detail ? `${msg.detail}\n` : ""}${msg.stack}`), "\n");
|
|
3793
|
-
} else console.error(chalk.default.red("✖"), this.textFormat(msg, chalk.default.bgRed), "\n");
|
|
3794
|
-
if (exit) process.exit(1);
|
|
3795
|
-
},
|
|
3796
|
-
quiet: () => {
|
|
3797
|
-
process.exit(0);
|
|
3798
|
-
}
|
|
3799
|
-
};
|
|
3764
|
+
static textFormat(txt, color) {
|
|
3765
|
+
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
|
|
3800
3766
|
}
|
|
3801
3767
|
static findModulePkg(moduleId, cwd) {
|
|
3802
3768
|
const parts = moduleId.replace(/\\/g, "/").split("/");
|
|
@@ -3812,12 +3778,6 @@ var Utils = class {
|
|
|
3812
3778
|
if (path$4) return [join(cwd, path$4)];
|
|
3813
3779
|
return [...migrator.getPaths(), join(cwd, defaultPath)];
|
|
3814
3780
|
}
|
|
3815
|
-
static twoColumnDetail(name, value) {
|
|
3816
|
-
const regex = /\x1b\[\d+m/g;
|
|
3817
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
3818
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
3819
|
-
return console.log(name, chalk.default.gray(".".repeat(dots)), value);
|
|
3820
|
-
}
|
|
3821
3781
|
/**
|
|
3822
3782
|
* Check if file exists
|
|
3823
3783
|
*
|
package/dist/index.d.cts
CHANGED
|
@@ -1300,7 +1300,6 @@ declare class Migrator {
|
|
|
1300
1300
|
deleteRepository(): void;
|
|
1301
1301
|
setOutput(output: boolean): this;
|
|
1302
1302
|
write(...args: any[]): void;
|
|
1303
|
-
writeTwoColumns(name: string, ...args: string[]): void;
|
|
1304
1303
|
writeTask(description: string, task: () => Promise<any> | any): Promise<void>;
|
|
1305
1304
|
}
|
|
1306
1305
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -1300,7 +1300,6 @@ declare class Migrator {
|
|
|
1300
1300
|
deleteRepository(): void;
|
|
1301
1301
|
setOutput(output: boolean): this;
|
|
1302
1302
|
write(...args: any[]): void;
|
|
1303
|
-
writeTwoColumns(name: string, ...args: string[]): void;
|
|
1304
1303
|
writeTask(description: string, task: () => Promise<any> | any): Promise<void>;
|
|
1305
1304
|
}
|
|
1306
1305
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import Knex$1 from "knex";
|
|
|
7
7
|
import path from "path";
|
|
8
8
|
import { existsSync } from "fs";
|
|
9
9
|
import pluralize from "pluralize";
|
|
10
|
-
import
|
|
10
|
+
import { Logger } from "@h3ravel/shared";
|
|
11
11
|
import fs from "node:fs/promises";
|
|
12
12
|
import { access } from "fs/promises";
|
|
13
13
|
import escalade from "escalade/sync";
|
|
@@ -3620,7 +3620,7 @@ var Migrator = class {
|
|
|
3620
3620
|
for (const migration of migrations) {
|
|
3621
3621
|
const file = files[migration.migration];
|
|
3622
3622
|
if (!file) {
|
|
3623
|
-
|
|
3623
|
+
Logger.twoColumnLog(Logger.parse([[migration.migration, "green"]], "", false), Logger.parse([["Migration not found", "yellow"]], "", false));
|
|
3624
3624
|
continue;
|
|
3625
3625
|
}
|
|
3626
3626
|
rolledBack.push(file);
|
|
@@ -3705,13 +3705,6 @@ var Migrator = class {
|
|
|
3705
3705
|
write(...args) {
|
|
3706
3706
|
if (this.output) console.log(...args);
|
|
3707
3707
|
}
|
|
3708
|
-
writeTwoColumns(name, ...args) {
|
|
3709
|
-
const value = args.join(" ");
|
|
3710
|
-
const regex = /\x1b\[\d+m/g;
|
|
3711
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
3712
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
3713
|
-
this.write(name, color.gray(".".repeat(dots)), value);
|
|
3714
|
-
}
|
|
3715
3708
|
async writeTask(description, task) {
|
|
3716
3709
|
const startTime = process.hrtime();
|
|
3717
3710
|
let result = false;
|
|
@@ -3720,7 +3713,7 @@ var Migrator = class {
|
|
|
3720
3713
|
} finally {
|
|
3721
3714
|
const endTime = process.hrtime(startTime);
|
|
3722
3715
|
const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
3723
|
-
|
|
3716
|
+
Logger.twoColumnLog(Logger.parse([[description, "green"]], "", false), [Logger.parse([[`${Math.floor(duration)}ms`, "gray"]], "", false), Logger.parse([[result !== false ? "✔" : "✘", result !== false ? "green" : "red"]], "", false)].join(" "));
|
|
3724
3717
|
}
|
|
3725
3718
|
}
|
|
3726
3719
|
};
|
|
@@ -3737,35 +3730,8 @@ var Utils = class {
|
|
|
3737
3730
|
* @param color
|
|
3738
3731
|
* @returns
|
|
3739
3732
|
*/
|
|
3740
|
-
static textFormat(txt, color
|
|
3741
|
-
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color
|
|
3742
|
-
}
|
|
3743
|
-
/**
|
|
3744
|
-
* Ouput formater object
|
|
3745
|
-
*
|
|
3746
|
-
* @returns
|
|
3747
|
-
*/
|
|
3748
|
-
static output() {
|
|
3749
|
-
return {
|
|
3750
|
-
success: (msg, exit = false) => {
|
|
3751
|
-
console.log(color.green("✓"), this.textFormat(msg, color.bgGreen), "\n");
|
|
3752
|
-
if (exit) process.exit(0);
|
|
3753
|
-
},
|
|
3754
|
-
info: (msg, exit = false) => {
|
|
3755
|
-
console.log(color.blue("ℹ"), this.textFormat(msg, color.bgBlue), "\n");
|
|
3756
|
-
if (exit) process.exit(0);
|
|
3757
|
-
},
|
|
3758
|
-
error: (msg, exit = true) => {
|
|
3759
|
-
if (msg instanceof Error) {
|
|
3760
|
-
if (msg.message) console.error(color.red("✖"), this.textFormat(msg.message, color.bgRed));
|
|
3761
|
-
console.error(color.red(`${msg.detail ? `${msg.detail}\n` : ""}${msg.stack}`), "\n");
|
|
3762
|
-
} else console.error(color.red("✖"), this.textFormat(msg, color.bgRed), "\n");
|
|
3763
|
-
if (exit) process.exit(1);
|
|
3764
|
-
},
|
|
3765
|
-
quiet: () => {
|
|
3766
|
-
process.exit(0);
|
|
3767
|
-
}
|
|
3768
|
-
};
|
|
3733
|
+
static textFormat(txt, color) {
|
|
3734
|
+
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
|
|
3769
3735
|
}
|
|
3770
3736
|
static findModulePkg(moduleId, cwd) {
|
|
3771
3737
|
const parts = moduleId.replace(/\\/g, "/").split("/");
|
|
@@ -3781,12 +3747,6 @@ var Utils = class {
|
|
|
3781
3747
|
if (path$1) return [join(cwd, path$1)];
|
|
3782
3748
|
return [...migrator.getPaths(), join(cwd, defaultPath)];
|
|
3783
3749
|
}
|
|
3784
|
-
static twoColumnDetail(name, value) {
|
|
3785
|
-
const regex = /\x1b\[\d+m/g;
|
|
3786
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
3787
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
3788
|
-
return console.log(name, color.gray(".".repeat(dots)), value);
|
|
3789
|
-
}
|
|
3790
3750
|
/**
|
|
3791
3751
|
* Check if file exists
|
|
3792
3752
|
*
|
|
@@ -29,8 +29,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
}) : target, mod));
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
|
-
let
|
|
33
|
-
|
|
32
|
+
let __h3ravel_shared = require("@h3ravel/shared");
|
|
33
|
+
__h3ravel_shared = __toESM(__h3ravel_shared);
|
|
34
34
|
let node_fs_promises = require("node:fs/promises");
|
|
35
35
|
node_fs_promises = __toESM(node_fs_promises);
|
|
36
36
|
let path = require("path");
|
|
@@ -219,7 +219,7 @@ var Migrator = class {
|
|
|
219
219
|
for (const migration of migrations) {
|
|
220
220
|
const file = files[migration.migration];
|
|
221
221
|
if (!file) {
|
|
222
|
-
|
|
222
|
+
__h3ravel_shared.Logger.twoColumnLog(__h3ravel_shared.Logger.parse([[migration.migration, "green"]], "", false), __h3ravel_shared.Logger.parse([["Migration not found", "yellow"]], "", false));
|
|
223
223
|
continue;
|
|
224
224
|
}
|
|
225
225
|
rolledBack.push(file);
|
|
@@ -304,13 +304,6 @@ var Migrator = class {
|
|
|
304
304
|
write(...args) {
|
|
305
305
|
if (this.output) console.log(...args);
|
|
306
306
|
}
|
|
307
|
-
writeTwoColumns(name, ...args) {
|
|
308
|
-
const value = args.join(" ");
|
|
309
|
-
const regex = /\x1b\[\d+m/g;
|
|
310
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
311
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
312
|
-
this.write(name, chalk.default.gray(".".repeat(dots)), value);
|
|
313
|
-
}
|
|
314
307
|
async writeTask(description, task) {
|
|
315
308
|
const startTime = process.hrtime();
|
|
316
309
|
let result = false;
|
|
@@ -319,7 +312,7 @@ var Migrator = class {
|
|
|
319
312
|
} finally {
|
|
320
313
|
const endTime = process.hrtime(startTime);
|
|
321
314
|
const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
322
|
-
|
|
315
|
+
__h3ravel_shared.Logger.twoColumnLog(__h3ravel_shared.Logger.parse([[description, "green"]], "", false), [__h3ravel_shared.Logger.parse([[`${Math.floor(duration)}ms`, "gray"]], "", false), __h3ravel_shared.Logger.parse([[result !== false ? "✔" : "✘", result !== false ? "green" : "red"]], "", false)].join(" "));
|
|
323
316
|
}
|
|
324
317
|
}
|
|
325
318
|
};
|
|
@@ -336,35 +329,8 @@ var Utils = class {
|
|
|
336
329
|
* @param color
|
|
337
330
|
* @returns
|
|
338
331
|
*/
|
|
339
|
-
static textFormat(txt, color
|
|
340
|
-
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Ouput formater object
|
|
344
|
-
*
|
|
345
|
-
* @returns
|
|
346
|
-
*/
|
|
347
|
-
static output() {
|
|
348
|
-
return {
|
|
349
|
-
success: (msg, exit = false) => {
|
|
350
|
-
console.log(chalk.default.green("✓"), this.textFormat(msg, chalk.default.bgGreen), "\n");
|
|
351
|
-
if (exit) process.exit(0);
|
|
352
|
-
},
|
|
353
|
-
info: (msg, exit = false) => {
|
|
354
|
-
console.log(chalk.default.blue("ℹ"), this.textFormat(msg, chalk.default.bgBlue), "\n");
|
|
355
|
-
if (exit) process.exit(0);
|
|
356
|
-
},
|
|
357
|
-
error: (msg, exit = true) => {
|
|
358
|
-
if (msg instanceof Error) {
|
|
359
|
-
if (msg.message) console.error(chalk.default.red("✖"), this.textFormat(msg.message, chalk.default.bgRed));
|
|
360
|
-
console.error(chalk.default.red(`${msg.detail ? `${msg.detail}\n` : ""}${msg.stack}`), "\n");
|
|
361
|
-
} else console.error(chalk.default.red("✖"), this.textFormat(msg, chalk.default.bgRed), "\n");
|
|
362
|
-
if (exit) process.exit(1);
|
|
363
|
-
},
|
|
364
|
-
quiet: () => {
|
|
365
|
-
process.exit(0);
|
|
366
|
-
}
|
|
367
|
-
};
|
|
332
|
+
static textFormat(txt, color) {
|
|
333
|
+
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
|
|
368
334
|
}
|
|
369
335
|
static findModulePkg(moduleId, cwd) {
|
|
370
336
|
const parts = moduleId.replace(/\\/g, "/").split("/");
|
|
@@ -380,12 +346,6 @@ var Utils = class {
|
|
|
380
346
|
if (path$5) return [join(cwd, path$5)];
|
|
381
347
|
return [...migrator.getPaths(), join(cwd, defaultPath)];
|
|
382
348
|
}
|
|
383
|
-
static twoColumnDetail(name, value) {
|
|
384
|
-
const regex = /\x1b\[\d+m/g;
|
|
385
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
386
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
387
|
-
return console.log(name, chalk.default.gray(".".repeat(dots)), value);
|
|
388
|
-
}
|
|
389
349
|
/**
|
|
390
350
|
* Check if file exists
|
|
391
351
|
*
|
|
@@ -1256,7 +1256,6 @@ declare class Migrator {
|
|
|
1256
1256
|
deleteRepository(): void;
|
|
1257
1257
|
setOutput(output: boolean): this;
|
|
1258
1258
|
write(...args: any[]): void;
|
|
1259
|
-
writeTwoColumns(name: string, ...args: string[]): void;
|
|
1260
1259
|
writeTask(description: string, task: () => Promise<any> | any): Promise<void>;
|
|
1261
1260
|
}
|
|
1262
1261
|
//#endregion
|
|
@@ -1253,7 +1253,6 @@ declare class Migrator {
|
|
|
1253
1253
|
deleteRepository(): void;
|
|
1254
1254
|
setOutput(output: boolean): this;
|
|
1255
1255
|
write(...args: any[]): void;
|
|
1256
|
-
writeTwoColumns(name: string, ...args: string[]): void;
|
|
1257
1256
|
writeTask(description: string, task: () => Promise<any> | any): Promise<void>;
|
|
1258
1257
|
}
|
|
1259
1258
|
//#endregion
|
package/dist/migrations/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __export } from "./chunk-PECeCxCb.js";
|
|
2
|
-
import
|
|
2
|
+
import { Logger } from "@h3ravel/shared";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { access } from "fs/promises";
|
|
@@ -173,7 +173,7 @@ var Migrator = class {
|
|
|
173
173
|
for (const migration of migrations) {
|
|
174
174
|
const file = files[migration.migration];
|
|
175
175
|
if (!file) {
|
|
176
|
-
|
|
176
|
+
Logger.twoColumnLog(Logger.parse([[migration.migration, "green"]], "", false), Logger.parse([["Migration not found", "yellow"]], "", false));
|
|
177
177
|
continue;
|
|
178
178
|
}
|
|
179
179
|
rolledBack.push(file);
|
|
@@ -258,13 +258,6 @@ var Migrator = class {
|
|
|
258
258
|
write(...args) {
|
|
259
259
|
if (this.output) console.log(...args);
|
|
260
260
|
}
|
|
261
|
-
writeTwoColumns(name, ...args) {
|
|
262
|
-
const value = args.join(" ");
|
|
263
|
-
const regex = /\x1b\[\d+m/g;
|
|
264
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
265
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
266
|
-
this.write(name, color.gray(".".repeat(dots)), value);
|
|
267
|
-
}
|
|
268
261
|
async writeTask(description, task) {
|
|
269
262
|
const startTime = process.hrtime();
|
|
270
263
|
let result = false;
|
|
@@ -273,7 +266,7 @@ var Migrator = class {
|
|
|
273
266
|
} finally {
|
|
274
267
|
const endTime = process.hrtime(startTime);
|
|
275
268
|
const duration = (endTime[0] * 1e9 + endTime[1]) / 1e6;
|
|
276
|
-
|
|
269
|
+
Logger.twoColumnLog(Logger.parse([[description, "green"]], "", false), [Logger.parse([[`${Math.floor(duration)}ms`, "gray"]], "", false), Logger.parse([[result !== false ? "✔" : "✘", result !== false ? "green" : "red"]], "", false)].join(" "));
|
|
277
270
|
}
|
|
278
271
|
}
|
|
279
272
|
};
|
|
@@ -290,35 +283,8 @@ var Utils = class {
|
|
|
290
283
|
* @param color
|
|
291
284
|
* @returns
|
|
292
285
|
*/
|
|
293
|
-
static textFormat(txt, color
|
|
294
|
-
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Ouput formater object
|
|
298
|
-
*
|
|
299
|
-
* @returns
|
|
300
|
-
*/
|
|
301
|
-
static output() {
|
|
302
|
-
return {
|
|
303
|
-
success: (msg, exit = false) => {
|
|
304
|
-
console.log(color.green("✓"), this.textFormat(msg, color.bgGreen), "\n");
|
|
305
|
-
if (exit) process.exit(0);
|
|
306
|
-
},
|
|
307
|
-
info: (msg, exit = false) => {
|
|
308
|
-
console.log(color.blue("ℹ"), this.textFormat(msg, color.bgBlue), "\n");
|
|
309
|
-
if (exit) process.exit(0);
|
|
310
|
-
},
|
|
311
|
-
error: (msg, exit = true) => {
|
|
312
|
-
if (msg instanceof Error) {
|
|
313
|
-
if (msg.message) console.error(color.red("✖"), this.textFormat(msg.message, color.bgRed));
|
|
314
|
-
console.error(color.red(`${msg.detail ? `${msg.detail}\n` : ""}${msg.stack}`), "\n");
|
|
315
|
-
} else console.error(color.red("✖"), this.textFormat(msg, color.bgRed), "\n");
|
|
316
|
-
if (exit) process.exit(1);
|
|
317
|
-
},
|
|
318
|
-
quiet: () => {
|
|
319
|
-
process.exit(0);
|
|
320
|
-
}
|
|
321
|
-
};
|
|
286
|
+
static textFormat(txt, color) {
|
|
287
|
+
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
|
|
322
288
|
}
|
|
323
289
|
static findModulePkg(moduleId, cwd) {
|
|
324
290
|
const parts = moduleId.replace(/\\/g, "/").split("/");
|
|
@@ -334,12 +300,6 @@ var Utils = class {
|
|
|
334
300
|
if (path$1) return [join(cwd, path$1)];
|
|
335
301
|
return [...migrator.getPaths(), join(cwd, defaultPath)];
|
|
336
302
|
}
|
|
337
|
-
static twoColumnDetail(name, value) {
|
|
338
|
-
const regex = /\x1b\[\d+m/g;
|
|
339
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
340
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
341
|
-
return console.log(name, color.gray(".".repeat(dots)), value);
|
|
342
|
-
}
|
|
343
303
|
/**
|
|
344
304
|
* Check if file exists
|
|
345
305
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/arquebus",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Arquebus ORM is a Beautiful, expressive ORM inspired by Laravel's Eloquent, designed for TypeScript applications and for the H3ravel Framework.",
|
|
5
5
|
"homepage": "https://h3ravel.toneflix.net/arquebus",
|
|
6
6
|
"bin": {
|
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
]
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
+
"@h3ravel/shared": "^0.17.4",
|
|
118
119
|
"chalk": "^5.6.0",
|
|
119
120
|
"collect.js": "^4.36.1",
|
|
120
121
|
"commander": "^14.0.0",
|