@ooneex/cli 1.20.3 → 1.21.0
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/dist/index.js +867 -735
- package/dist/index.js.map +23 -22
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5064,11 +5064,105 @@ class AppStopCommand {
|
|
|
5064
5064
|
AppStopCommand = __legacyDecorateClassTS([
|
|
5065
5065
|
decorator3.command()
|
|
5066
5066
|
], AppStopCommand);
|
|
5067
|
-
// src/commands/
|
|
5068
|
-
import {
|
|
5067
|
+
// src/commands/CommandRunCommand.ts
|
|
5068
|
+
import { existsSync } from "fs";
|
|
5069
5069
|
import { join as join4 } from "path";
|
|
5070
5070
|
import { decorator as decorator4 } from "@ooneex/command";
|
|
5071
5071
|
import { TerminalLogger as TerminalLogger4 } from "@ooneex/logger";
|
|
5072
|
+
class CommandRunCommand {
|
|
5073
|
+
getName() {
|
|
5074
|
+
return "command:run";
|
|
5075
|
+
}
|
|
5076
|
+
getDescription() {
|
|
5077
|
+
return "Run a custom command from a module";
|
|
5078
|
+
}
|
|
5079
|
+
async run() {
|
|
5080
|
+
const logger = new TerminalLogger4;
|
|
5081
|
+
const commandName = Bun.argv[3];
|
|
5082
|
+
if (!commandName) {
|
|
5083
|
+
logger.error("Command name is required. Usage: ooneex command:run <command-name>", undefined, {
|
|
5084
|
+
showTimestamp: false,
|
|
5085
|
+
showArrow: false,
|
|
5086
|
+
useSymbol: false
|
|
5087
|
+
});
|
|
5088
|
+
return;
|
|
5089
|
+
}
|
|
5090
|
+
const extraArgs = Bun.argv.slice(4);
|
|
5091
|
+
const modulesDir = join4(process.cwd(), "modules");
|
|
5092
|
+
if (!existsSync(modulesDir)) {
|
|
5093
|
+
logger.warn(`Command "${commandName}" not found in any module`, undefined, {
|
|
5094
|
+
showTimestamp: false,
|
|
5095
|
+
showArrow: false,
|
|
5096
|
+
useSymbol: false
|
|
5097
|
+
});
|
|
5098
|
+
return;
|
|
5099
|
+
}
|
|
5100
|
+
const glob = new Bun.Glob("*/package.json");
|
|
5101
|
+
const modules = [];
|
|
5102
|
+
for await (const match of glob.scan({ cwd: modulesDir, onlyFiles: true })) {
|
|
5103
|
+
const entry = match.replace("/package.json", "");
|
|
5104
|
+
const moduleDir = join4(modulesDir, entry);
|
|
5105
|
+
const commandRunFile = Bun.file(join4(moduleDir, "bin", "command", "run.ts"));
|
|
5106
|
+
if (await commandRunFile.exists()) {
|
|
5107
|
+
const packageJson = await Bun.file(join4(modulesDir, match)).json();
|
|
5108
|
+
modules.push({ name: packageJson.name ?? entry, dir: moduleDir });
|
|
5109
|
+
}
|
|
5110
|
+
}
|
|
5111
|
+
if (modules.length === 0) {
|
|
5112
|
+
logger.warn(`Command "${commandName}" not found in any module`, undefined, {
|
|
5113
|
+
showTimestamp: false,
|
|
5114
|
+
showArrow: false,
|
|
5115
|
+
useSymbol: false
|
|
5116
|
+
});
|
|
5117
|
+
return;
|
|
5118
|
+
}
|
|
5119
|
+
for (const { name, dir } of modules) {
|
|
5120
|
+
const commandRunPath = join4(dir, "bin", "command", "run.ts");
|
|
5121
|
+
logger.info(`Running "${commandName}" for ${name}...`, undefined, {
|
|
5122
|
+
showTimestamp: false,
|
|
5123
|
+
showArrow: false,
|
|
5124
|
+
useSymbol: false
|
|
5125
|
+
});
|
|
5126
|
+
const proc = Bun.spawn(["bun", "run", commandRunPath, commandName, ...extraArgs], {
|
|
5127
|
+
cwd: dir,
|
|
5128
|
+
stdout: "pipe",
|
|
5129
|
+
stderr: "pipe"
|
|
5130
|
+
});
|
|
5131
|
+
const [stdout, stderr] = await Promise.all([new Response(proc.stdout).text(), new Response(proc.stderr).text()]);
|
|
5132
|
+
const exitCode = await proc.exited;
|
|
5133
|
+
if (exitCode === 0) {
|
|
5134
|
+
if (stdout)
|
|
5135
|
+
process.stdout.write(stdout);
|
|
5136
|
+
if (stderr)
|
|
5137
|
+
process.stderr.write(stderr);
|
|
5138
|
+
logger.success(`Command "${commandName}" completed for ${name}`, undefined, {
|
|
5139
|
+
showTimestamp: false,
|
|
5140
|
+
showArrow: false,
|
|
5141
|
+
useSymbol: false
|
|
5142
|
+
});
|
|
5143
|
+
return;
|
|
5144
|
+
}
|
|
5145
|
+
logger.warn(`Command "${commandName}" not found in ${name}`, undefined, {
|
|
5146
|
+
showTimestamp: false,
|
|
5147
|
+
showArrow: false,
|
|
5148
|
+
useSymbol: false
|
|
5149
|
+
});
|
|
5150
|
+
}
|
|
5151
|
+
logger.error(`Command "${commandName}" not found in any module`, undefined, {
|
|
5152
|
+
showTimestamp: false,
|
|
5153
|
+
showArrow: false,
|
|
5154
|
+
useSymbol: false
|
|
5155
|
+
});
|
|
5156
|
+
}
|
|
5157
|
+
}
|
|
5158
|
+
CommandRunCommand = __legacyDecorateClassTS([
|
|
5159
|
+
decorator4.command()
|
|
5160
|
+
], CommandRunCommand);
|
|
5161
|
+
// src/commands/CompletionZshCommand.ts
|
|
5162
|
+
import { homedir } from "os";
|
|
5163
|
+
import { join as join5 } from "path";
|
|
5164
|
+
import { decorator as decorator5 } from "@ooneex/command";
|
|
5165
|
+
import { TerminalLogger as TerminalLogger5 } from "@ooneex/logger";
|
|
5072
5166
|
|
|
5073
5167
|
// src/templates/completions/_oo.txt
|
|
5074
5168
|
var _oo_default = `#compdef oo ooneex
|
|
@@ -5081,12 +5175,21 @@ _oo_modules() {
|
|
|
5081
5175
|
fi
|
|
5082
5176
|
}
|
|
5083
5177
|
|
|
5178
|
+
_oo_custom_commands() {
|
|
5179
|
+
local -a cmds
|
|
5180
|
+
if [[ -d modules ]]; then
|
|
5181
|
+
cmds=(\${(@f)"$(command grep -rh 'return "' modules/*/src/commands/*Command.ts 2>/dev/null | sed 's/.*return "\\(.*\\)".*/\\1/' | sort -u)"})
|
|
5182
|
+
compadd -a cmds
|
|
5183
|
+
fi
|
|
5184
|
+
}
|
|
5185
|
+
|
|
5084
5186
|
_oo() {
|
|
5085
5187
|
local -a commands
|
|
5086
5188
|
commands=(
|
|
5087
5189
|
'app\\:build:Build the application'
|
|
5088
5190
|
'app\\:start:Start the application'
|
|
5089
5191
|
'app\\:stop:Stop the application'
|
|
5192
|
+
'command\\:run:Run a custom command from a module'
|
|
5090
5193
|
'completion\\:zsh:Install Zsh completion for oo command'
|
|
5091
5194
|
'help:Show available commands'
|
|
5092
5195
|
'make\\:ai:Generate a new AI class'
|
|
@@ -5142,6 +5245,10 @@ _oo() {
|
|
|
5142
5245
|
;;
|
|
5143
5246
|
opts)
|
|
5144
5247
|
case "$words[1]" in
|
|
5248
|
+
command:run)
|
|
5249
|
+
_arguments -s \\
|
|
5250
|
+
'1:command name:_oo_custom_commands'
|
|
5251
|
+
;;
|
|
5145
5252
|
make:controller)
|
|
5146
5253
|
_arguments -s \\
|
|
5147
5254
|
'--name=[Name of the resource]:name' \\
|
|
@@ -5197,7 +5304,11 @@ _oo() {
|
|
|
5197
5304
|
'--name=[Name of the resource]:name' \\
|
|
5198
5305
|
'--module=[Module name]:module:_oo_modules'
|
|
5199
5306
|
;;
|
|
5200
|
-
|
|
5307
|
+
migration:up|seed:run)
|
|
5308
|
+
_arguments -s \\
|
|
5309
|
+
'--drop[Drop the database before running]'
|
|
5310
|
+
;;
|
|
5311
|
+
app:build|app:start|app:stop|help|make:release|make:resource:book|make:resource:calendar-event|make:resource:category|make:resource:color|make:resource:discount|make:resource:folder|make:resource:image|make:resource:note|make:resource:status|make:resource:tag|make:resource:task|make:resource:topic|make:resource:user|make:resource:video|make:claude:skill|completion:zsh)
|
|
5201
5312
|
;;
|
|
5202
5313
|
esac
|
|
5203
5314
|
;;
|
|
@@ -5218,12 +5329,21 @@ _ooneex_modules() {
|
|
|
5218
5329
|
fi
|
|
5219
5330
|
}
|
|
5220
5331
|
|
|
5332
|
+
_ooneex_custom_commands() {
|
|
5333
|
+
local -a cmds
|
|
5334
|
+
if [[ -d modules ]]; then
|
|
5335
|
+
cmds=(\${(@f)"$(command grep -rh 'return "' modules/*/src/commands/*Command.ts 2>/dev/null | sed 's/.*return "\\(.*\\)".*/\\1/' | sort -u)"})
|
|
5336
|
+
compadd -a cmds
|
|
5337
|
+
fi
|
|
5338
|
+
}
|
|
5339
|
+
|
|
5221
5340
|
_ooneex() {
|
|
5222
5341
|
local -a commands
|
|
5223
5342
|
commands=(
|
|
5224
5343
|
'app\\:build:Build the application'
|
|
5225
5344
|
'app\\:start:Start the application'
|
|
5226
5345
|
'app\\:stop:Stop the application'
|
|
5346
|
+
'command\\:run:Run a custom command from a module'
|
|
5227
5347
|
'completion\\:zsh:Install Zsh completion for oo command'
|
|
5228
5348
|
'help:Show available commands'
|
|
5229
5349
|
'make\\:ai:Generate a new AI class'
|
|
@@ -5279,6 +5399,10 @@ _ooneex() {
|
|
|
5279
5399
|
;;
|
|
5280
5400
|
opts)
|
|
5281
5401
|
case "$words[1]" in
|
|
5402
|
+
command:run)
|
|
5403
|
+
_arguments -s \\
|
|
5404
|
+
'1:command name:_ooneex_custom_commands'
|
|
5405
|
+
;;
|
|
5282
5406
|
make:controller)
|
|
5283
5407
|
_arguments -s \\
|
|
5284
5408
|
'--name=[Name of the resource]:name' \\
|
|
@@ -5334,7 +5458,11 @@ _ooneex() {
|
|
|
5334
5458
|
'--name=[Name of the resource]:name' \\
|
|
5335
5459
|
'--module=[Module name]:module:_ooneex_modules'
|
|
5336
5460
|
;;
|
|
5337
|
-
|
|
5461
|
+
migration:up|seed:run)
|
|
5462
|
+
_arguments -s \\
|
|
5463
|
+
'--drop[Drop the database before running]'
|
|
5464
|
+
;;
|
|
5465
|
+
app:build|app:start|app:stop|help|make:release|make:resource:book|make:resource:calendar-event|make:resource:category|make:resource:color|make:resource:discount|make:resource:folder|make:resource:image|make:resource:note|make:resource:status|make:resource:tag|make:resource:task|make:resource:topic|make:resource:user|make:resource:video|make:claude:skill|completion:zsh)
|
|
5338
5466
|
;;
|
|
5339
5467
|
esac
|
|
5340
5468
|
;;
|
|
@@ -5353,12 +5481,12 @@ class CompletionZshCommand {
|
|
|
5353
5481
|
return "Install Zsh completion for oo command";
|
|
5354
5482
|
}
|
|
5355
5483
|
async run() {
|
|
5356
|
-
const completionDir =
|
|
5357
|
-
const ooFilePath =
|
|
5484
|
+
const completionDir = join5(homedir(), ".zsh");
|
|
5485
|
+
const ooFilePath = join5(completionDir, "_oo");
|
|
5358
5486
|
await Bun.write(ooFilePath, _oo_default);
|
|
5359
|
-
const ooneexFilePath =
|
|
5487
|
+
const ooneexFilePath = join5(completionDir, "_ooneex");
|
|
5360
5488
|
await Bun.write(ooneexFilePath, _ooneex_default);
|
|
5361
|
-
const logger = new
|
|
5489
|
+
const logger = new TerminalLogger5;
|
|
5362
5490
|
logger.success(`${ooFilePath} created successfully`, undefined, {
|
|
5363
5491
|
showTimestamp: false,
|
|
5364
5492
|
showArrow: false,
|
|
@@ -5379,10 +5507,10 @@ class CompletionZshCommand {
|
|
|
5379
5507
|
}
|
|
5380
5508
|
}
|
|
5381
5509
|
CompletionZshCommand = __legacyDecorateClassTS([
|
|
5382
|
-
|
|
5510
|
+
decorator5.command()
|
|
5383
5511
|
], CompletionZshCommand);
|
|
5384
5512
|
// src/commands/HelpCommand.ts
|
|
5385
|
-
import { COMMANDS_CONTAINER, decorator as
|
|
5513
|
+
import { COMMANDS_CONTAINER, decorator as decorator6 } from "@ooneex/command";
|
|
5386
5514
|
class HelpCommand {
|
|
5387
5515
|
getName() {
|
|
5388
5516
|
return "help";
|
|
@@ -5409,12 +5537,12 @@ class HelpCommand {
|
|
|
5409
5537
|
}
|
|
5410
5538
|
}
|
|
5411
5539
|
HelpCommand = __legacyDecorateClassTS([
|
|
5412
|
-
|
|
5540
|
+
decorator6.command()
|
|
5413
5541
|
], HelpCommand);
|
|
5414
5542
|
// src/commands/MakeAiCommand.ts
|
|
5415
|
-
import { join as
|
|
5416
|
-
import { decorator as
|
|
5417
|
-
import { TerminalLogger as
|
|
5543
|
+
import { join as join8 } from "path";
|
|
5544
|
+
import { decorator as decorator8 } from "@ooneex/command";
|
|
5545
|
+
import { TerminalLogger as TerminalLogger7 } from "@ooneex/logger";
|
|
5418
5546
|
import { toPascalCase as toPascalCase2 } from "@ooneex/utils";
|
|
5419
5547
|
|
|
5420
5548
|
// src/prompts/askName.ts
|
|
@@ -5511,12 +5639,12 @@ export class {{NAME}}Ai implements IAiChat<OpenAiConfigType> {
|
|
|
5511
5639
|
`;
|
|
5512
5640
|
|
|
5513
5641
|
// src/utils.ts
|
|
5514
|
-
import { join as
|
|
5642
|
+
import { join as join7 } from "path";
|
|
5515
5643
|
|
|
5516
5644
|
// src/commands/MakeModuleCommand.ts
|
|
5517
|
-
import { join as
|
|
5518
|
-
import { decorator as
|
|
5519
|
-
import { TerminalLogger as
|
|
5645
|
+
import { join as join6 } from "path";
|
|
5646
|
+
import { decorator as decorator7 } from "@ooneex/command";
|
|
5647
|
+
import { TerminalLogger as TerminalLogger6 } from "@ooneex/logger";
|
|
5520
5648
|
import { toKebabCase, toPascalCase } from "@ooneex/utils";
|
|
5521
5649
|
|
|
5522
5650
|
// src/templates/module/module.txt
|
|
@@ -5640,7 +5768,7 @@ class MakeModuleCommand {
|
|
|
5640
5768
|
${newScope},`;
|
|
5641
5769
|
content = content.replace(regex, `$1${newValue}
|
|
5642
5770
|
$3`);
|
|
5643
|
-
await Bun.write(commitlintPath, content);
|
|
5771
|
+
await Bun.write(commitlintPath, content.replace(/,+/g, ","));
|
|
5644
5772
|
}
|
|
5645
5773
|
}
|
|
5646
5774
|
}
|
|
@@ -5654,52 +5782,46 @@ class MakeModuleCommand {
|
|
|
5654
5782
|
`);
|
|
5655
5783
|
}
|
|
5656
5784
|
async run(options) {
|
|
5657
|
-
const { cwd = process.cwd(), silent = false
|
|
5785
|
+
const { cwd = process.cwd(), silent = false } = options;
|
|
5658
5786
|
let { name } = options;
|
|
5659
5787
|
if (!name) {
|
|
5660
5788
|
name = await askName({ message: "Enter module name" });
|
|
5661
5789
|
}
|
|
5662
5790
|
const pascalName = toPascalCase(name).replace(/Module$/, "");
|
|
5663
5791
|
const kebabName = toKebabCase(pascalName);
|
|
5664
|
-
const moduleDir =
|
|
5665
|
-
const srcDir =
|
|
5666
|
-
const testsDir =
|
|
5792
|
+
const moduleDir = join6(cwd, "modules", kebabName);
|
|
5793
|
+
const srcDir = join6(moduleDir, "src");
|
|
5794
|
+
const testsDir = join6(moduleDir, "tests");
|
|
5667
5795
|
const moduleContent = module_default.replace(/{{NAME}}/g, pascalName);
|
|
5668
5796
|
const packageContent = package_default.replace(/{{NAME}}/g, kebabName);
|
|
5669
5797
|
const testContent = test_default.replace(/{{NAME}}/g, pascalName).replace(/{{name}}/g, kebabName);
|
|
5670
|
-
await Bun.write(
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
}
|
|
5674
|
-
if (!skipSeeds) {
|
|
5675
|
-
await Bun.write(join5(srcDir, "seeds", "seeds.ts"), "");
|
|
5676
|
-
}
|
|
5677
|
-
await Bun.write(join5(moduleDir, "package.json"), packageContent);
|
|
5678
|
-
await Bun.write(join5(moduleDir, "tsconfig.json"), tsconfig_default);
|
|
5679
|
-
await Bun.write(join5(testsDir, `${pascalName}Module.spec.ts`), testContent);
|
|
5798
|
+
await Bun.write(join6(srcDir, `${pascalName}Module.ts`), moduleContent);
|
|
5799
|
+
await Bun.write(join6(moduleDir, "package.json"), packageContent);
|
|
5800
|
+
await Bun.write(join6(moduleDir, "tsconfig.json"), tsconfig_default);
|
|
5801
|
+
await Bun.write(join6(testsDir, `${pascalName}Module.spec.ts`), testContent);
|
|
5680
5802
|
if (kebabName !== "app") {
|
|
5681
|
-
const appModulePath =
|
|
5803
|
+
const appModulePath = join6(cwd, "modules", "app", "src", "AppModule.ts");
|
|
5682
5804
|
if (await Bun.file(appModulePath).exists()) {
|
|
5683
5805
|
await this.addToAppModule(appModulePath, pascalName, kebabName);
|
|
5684
5806
|
}
|
|
5685
5807
|
}
|
|
5686
|
-
const appTsconfigPath =
|
|
5808
|
+
const appTsconfigPath = join6(cwd, "tsconfig.json");
|
|
5687
5809
|
if (await Bun.file(appTsconfigPath).exists()) {
|
|
5688
5810
|
await this.addPathAlias(appTsconfigPath, kebabName);
|
|
5689
5811
|
}
|
|
5690
5812
|
if (kebabName !== "app" && kebabName !== "shared") {
|
|
5691
|
-
const sharedModuleDir =
|
|
5692
|
-
const sharedModuleFilePath =
|
|
5813
|
+
const sharedModuleDir = join6(cwd, "modules", "shared");
|
|
5814
|
+
const sharedModuleFilePath = join6(sharedModuleDir, "src", "SharedModule.ts");
|
|
5693
5815
|
if (await Bun.file(sharedModuleFilePath).exists()) {
|
|
5694
5816
|
await this.addToSharedModule(sharedModuleFilePath, pascalName, kebabName);
|
|
5695
5817
|
}
|
|
5696
5818
|
}
|
|
5697
|
-
const commitlintPath =
|
|
5819
|
+
const commitlintPath = join6(cwd, ".commitlintrc.ts");
|
|
5698
5820
|
if (await Bun.file(commitlintPath).exists()) {
|
|
5699
5821
|
await this.addModuleScope(commitlintPath, kebabName);
|
|
5700
5822
|
}
|
|
5701
5823
|
if (!silent) {
|
|
5702
|
-
const logger = new
|
|
5824
|
+
const logger = new TerminalLogger6;
|
|
5703
5825
|
logger.success(`modules/${kebabName} created successfully`, undefined, {
|
|
5704
5826
|
showTimestamp: false,
|
|
5705
5827
|
showArrow: false,
|
|
@@ -5709,13 +5831,13 @@ class MakeModuleCommand {
|
|
|
5709
5831
|
}
|
|
5710
5832
|
}
|
|
5711
5833
|
MakeModuleCommand = __legacyDecorateClassTS([
|
|
5712
|
-
|
|
5834
|
+
decorator7.command()
|
|
5713
5835
|
], MakeModuleCommand);
|
|
5714
5836
|
|
|
5715
5837
|
// src/utils.ts
|
|
5716
5838
|
var ensureModule = async (module) => {
|
|
5717
|
-
const moduleDir =
|
|
5718
|
-
const moduleDirExists = await Bun.file(
|
|
5839
|
+
const moduleDir = join7(process.cwd(), "modules", module);
|
|
5840
|
+
const moduleDirExists = await Bun.file(join7(moduleDir, "package.json")).exists();
|
|
5719
5841
|
if (!moduleDirExists) {
|
|
5720
5842
|
const makeModule = new MakeModuleCommand;
|
|
5721
5843
|
await makeModule.run({ name: module, cwd: process.cwd(), silent: true });
|
|
@@ -5740,28 +5862,28 @@ class MakeAiCommand {
|
|
|
5740
5862
|
await ensureModule(module);
|
|
5741
5863
|
}
|
|
5742
5864
|
const content = ai_default.replace(/{{NAME}}/g, name);
|
|
5743
|
-
const base = module ?
|
|
5744
|
-
const aiLocalDir =
|
|
5745
|
-
const aiDir =
|
|
5746
|
-
const filePath =
|
|
5865
|
+
const base = module ? join8("modules", module) : ".";
|
|
5866
|
+
const aiLocalDir = join8(base, "src", "ai");
|
|
5867
|
+
const aiDir = join8(process.cwd(), aiLocalDir);
|
|
5868
|
+
const filePath = join8(aiDir, `${name}Ai.ts`);
|
|
5747
5869
|
await Bun.write(filePath, content);
|
|
5748
5870
|
const testContent = ai_test_default.replace(/{{NAME}}/g, name);
|
|
5749
|
-
const testsLocalDir =
|
|
5750
|
-
const testsDir =
|
|
5751
|
-
const testFilePath =
|
|
5871
|
+
const testsLocalDir = join8(base, "tests", "ai");
|
|
5872
|
+
const testsDir = join8(process.cwd(), testsLocalDir);
|
|
5873
|
+
const testFilePath = join8(testsDir, `${name}Ai.spec.ts`);
|
|
5752
5874
|
await Bun.write(testFilePath, testContent);
|
|
5753
|
-
const logger = new
|
|
5754
|
-
logger.success(`${
|
|
5875
|
+
const logger = new TerminalLogger7;
|
|
5876
|
+
logger.success(`${join8(aiLocalDir, name)}Ai.ts created successfully`, undefined, {
|
|
5755
5877
|
showTimestamp: false,
|
|
5756
5878
|
showArrow: false,
|
|
5757
5879
|
useSymbol: true
|
|
5758
5880
|
});
|
|
5759
|
-
logger.success(`${
|
|
5881
|
+
logger.success(`${join8(testsLocalDir, name)}Ai.spec.ts created successfully`, undefined, {
|
|
5760
5882
|
showTimestamp: false,
|
|
5761
5883
|
showArrow: false,
|
|
5762
5884
|
useSymbol: true
|
|
5763
5885
|
});
|
|
5764
|
-
const packageJsonPath =
|
|
5886
|
+
const packageJsonPath = join8(process.cwd(), "package.json");
|
|
5765
5887
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
5766
5888
|
const deps = packageJson.dependencies ?? {};
|
|
5767
5889
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -5776,12 +5898,12 @@ class MakeAiCommand {
|
|
|
5776
5898
|
}
|
|
5777
5899
|
}
|
|
5778
5900
|
MakeAiCommand = __legacyDecorateClassTS([
|
|
5779
|
-
|
|
5901
|
+
decorator8.command()
|
|
5780
5902
|
], MakeAiCommand);
|
|
5781
5903
|
// src/commands/MakeAnalyticsCommand.ts
|
|
5782
|
-
import { join as
|
|
5783
|
-
import { decorator as
|
|
5784
|
-
import { TerminalLogger as
|
|
5904
|
+
import { join as join9 } from "path";
|
|
5905
|
+
import { decorator as decorator9 } from "@ooneex/command";
|
|
5906
|
+
import { TerminalLogger as TerminalLogger8 } from "@ooneex/logger";
|
|
5785
5907
|
import { toPascalCase as toPascalCase3 } from "@ooneex/utils";
|
|
5786
5908
|
|
|
5787
5909
|
// src/templates/analytics.test.txt
|
|
@@ -5832,28 +5954,28 @@ class MakeAnalyticsCommand {
|
|
|
5832
5954
|
if (module) {
|
|
5833
5955
|
await ensureModule(module);
|
|
5834
5956
|
}
|
|
5835
|
-
const base = module ?
|
|
5836
|
-
const analyticsLocalDir =
|
|
5837
|
-
const analyticsDir =
|
|
5838
|
-
const filePath =
|
|
5957
|
+
const base = module ? join9("modules", module) : ".";
|
|
5958
|
+
const analyticsLocalDir = join9(base, "src", "analytics");
|
|
5959
|
+
const analyticsDir = join9(process.cwd(), analyticsLocalDir);
|
|
5960
|
+
const filePath = join9(analyticsDir, `${name}Analytics.ts`);
|
|
5839
5961
|
await Bun.write(filePath, content);
|
|
5840
5962
|
const testContent = analytics_test_default.replace(/{{NAME}}/g, name);
|
|
5841
|
-
const testsLocalDir =
|
|
5842
|
-
const testsDir =
|
|
5843
|
-
const testFilePath =
|
|
5963
|
+
const testsLocalDir = join9(base, "tests", "analytics");
|
|
5964
|
+
const testsDir = join9(process.cwd(), testsLocalDir);
|
|
5965
|
+
const testFilePath = join9(testsDir, `${name}Analytics.spec.ts`);
|
|
5844
5966
|
await Bun.write(testFilePath, testContent);
|
|
5845
|
-
const logger = new
|
|
5846
|
-
logger.success(`${
|
|
5967
|
+
const logger = new TerminalLogger8;
|
|
5968
|
+
logger.success(`${join9(analyticsLocalDir, name)}Analytics.ts created successfully`, undefined, {
|
|
5847
5969
|
showTimestamp: false,
|
|
5848
5970
|
showArrow: false,
|
|
5849
5971
|
useSymbol: true
|
|
5850
5972
|
});
|
|
5851
|
-
logger.success(`${
|
|
5973
|
+
logger.success(`${join9(testsLocalDir, name)}Analytics.spec.ts created successfully`, undefined, {
|
|
5852
5974
|
showTimestamp: false,
|
|
5853
5975
|
showArrow: false,
|
|
5854
5976
|
useSymbol: true
|
|
5855
5977
|
});
|
|
5856
|
-
const packageJsonPath =
|
|
5978
|
+
const packageJsonPath = join9(process.cwd(), "package.json");
|
|
5857
5979
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
5858
5980
|
const deps = packageJson.dependencies ?? {};
|
|
5859
5981
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -5868,12 +5990,12 @@ class MakeAnalyticsCommand {
|
|
|
5868
5990
|
}
|
|
5869
5991
|
}
|
|
5870
5992
|
MakeAnalyticsCommand = __legacyDecorateClassTS([
|
|
5871
|
-
|
|
5993
|
+
decorator9.command()
|
|
5872
5994
|
], MakeAnalyticsCommand);
|
|
5873
5995
|
// src/commands/MakeAppCommand.ts
|
|
5874
|
-
import { join as
|
|
5875
|
-
import { decorator as
|
|
5876
|
-
import { TerminalLogger as
|
|
5996
|
+
import { join as join10 } from "path";
|
|
5997
|
+
import { decorator as decorator10 } from "@ooneex/command";
|
|
5998
|
+
import { TerminalLogger as TerminalLogger9 } from "@ooneex/logger";
|
|
5877
5999
|
import { toKebabCase as toKebabCase2, toSnakeCase } from "@ooneex/utils";
|
|
5878
6000
|
|
|
5879
6001
|
// src/prompts/askDestination.ts
|
|
@@ -7012,44 +7134,40 @@ class MakeAppCommand {
|
|
|
7012
7134
|
destination = await askDestination({ message: "Enter destination path", initial: kebabName });
|
|
7013
7135
|
}
|
|
7014
7136
|
const packageContent = package_json_default.replace(/{{NAME}}/g, kebabName);
|
|
7015
|
-
await Bun.write(
|
|
7016
|
-
await Bun.write(
|
|
7017
|
-
await Bun.write(
|
|
7018
|
-
await Bun.write(
|
|
7019
|
-
await Bun.write(
|
|
7020
|
-
await Bun.write(
|
|
7021
|
-
await Bun.write(
|
|
7022
|
-
await Bun.write(
|
|
7023
|
-
await Bun.write(
|
|
7137
|
+
await Bun.write(join10(destination, ".commitlintrc.ts"), _commitlintrc_ts_default);
|
|
7138
|
+
await Bun.write(join10(destination, ".gitignore"), _gitignore_default);
|
|
7139
|
+
await Bun.write(join10(destination, "biome.jsonc"), biome_jsonc_default);
|
|
7140
|
+
await Bun.write(join10(destination, "bunfig.toml"), bunfig_toml_default);
|
|
7141
|
+
await Bun.write(join10(destination, "nx.json"), nx_json_default);
|
|
7142
|
+
await Bun.write(join10(destination, "package.json"), packageContent);
|
|
7143
|
+
await Bun.write(join10(destination, "README.md"), README_md_default.replace(/{{NAME}}/g, kebabName));
|
|
7144
|
+
await Bun.write(join10(destination, "tsconfig.json"), tsconfig_json_default);
|
|
7145
|
+
await Bun.write(join10(destination, ".zed", "settings.json"), zed_settings_json_default);
|
|
7024
7146
|
const makeModuleCommand = new MakeModuleCommand;
|
|
7025
7147
|
await makeModuleCommand.run({
|
|
7026
7148
|
name: "app",
|
|
7027
7149
|
cwd: destination,
|
|
7028
|
-
silent: true
|
|
7029
|
-
skipMigrations: true,
|
|
7030
|
-
skipSeeds: true
|
|
7150
|
+
silent: true
|
|
7031
7151
|
});
|
|
7032
|
-
const appModulePackagePath =
|
|
7152
|
+
const appModulePackagePath = join10(destination, "modules", "app", "package.json");
|
|
7033
7153
|
const appModulePackageJson = await Bun.file(appModulePackagePath).json();
|
|
7034
7154
|
await Bun.write(appModulePackagePath, JSON.stringify(appModulePackageJson, null, 2));
|
|
7035
7155
|
const envContent = env_default.replace(/^DATABASE_URL=/m, 'DATABASE_URL="postgresql://ooneex:ooneex@localhost:5432/ooneex"').replace(/^CACHE_REDIS_URL=/m, 'CACHE_REDIS_URL="redis://localhost:6379"').replace(/^PUBSUB_REDIS_URL=/m, 'PUBSUB_REDIS_URL="redis://localhost:6379"').replace(/^RATE_LIMIT_REDIS_URL=/m, 'RATE_LIMIT_REDIS_URL="redis://localhost:6379"').replace(/^DATABASE_REDIS_URL=/m, 'DATABASE_REDIS_URL="redis://localhost:6379"');
|
|
7036
|
-
await Bun.write(
|
|
7037
|
-
await Bun.write(
|
|
7038
|
-
await Bun.write(
|
|
7156
|
+
await Bun.write(join10(destination, "modules", "app", ".env"), envContent);
|
|
7157
|
+
await Bun.write(join10(destination, "modules", "app", ".env.example"), env_default);
|
|
7158
|
+
await Bun.write(join10(destination, "modules", "app", "src", "index.ts"), index_ts_default);
|
|
7039
7159
|
await makeModuleCommand.run({
|
|
7040
7160
|
name: "shared",
|
|
7041
7161
|
cwd: destination,
|
|
7042
|
-
silent: true
|
|
7043
|
-
skipMigrations: true,
|
|
7044
|
-
skipSeeds: true
|
|
7162
|
+
silent: true
|
|
7045
7163
|
});
|
|
7046
|
-
await Bun.write(
|
|
7164
|
+
await Bun.write(join10(destination, "modules", "shared", "src", "databases", "SharedDatabase.ts"), app_database_default);
|
|
7047
7165
|
const snakeName = toSnakeCase(name);
|
|
7048
7166
|
const dockerComposeContent = docker_compose_yml_default.replace(/{{NAME}}/g, snakeName);
|
|
7049
|
-
await Bun.write(
|
|
7167
|
+
await Bun.write(join10(destination, "modules", "app", "docker-compose.yml"), dockerComposeContent);
|
|
7050
7168
|
const dockerfileContent = Dockerfile_default.replace(/{{NAME}}/g, snakeName);
|
|
7051
|
-
await Bun.write(
|
|
7052
|
-
await Bun.write(
|
|
7169
|
+
await Bun.write(join10(destination, "modules", "app", "Dockerfile"), dockerfileContent);
|
|
7170
|
+
await Bun.write(join10(destination, "modules", "app", "var", ".gitkeep"), "");
|
|
7053
7171
|
const gitInit = Bun.spawn(["git", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
7054
7172
|
await gitInit.exited;
|
|
7055
7173
|
const addDeps = Bun.spawn([
|
|
@@ -7111,9 +7229,9 @@ class MakeAppCommand {
|
|
|
7111
7229
|
await addDevDeps.exited;
|
|
7112
7230
|
const huskyInit = Bun.spawn(["bunx", "husky", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
7113
7231
|
await huskyInit.exited;
|
|
7114
|
-
await Bun.write(
|
|
7115
|
-
await Bun.write(
|
|
7116
|
-
const logger = new
|
|
7232
|
+
await Bun.write(join10(destination, ".husky", "pre-commit"), "lint-staged");
|
|
7233
|
+
await Bun.write(join10(destination, ".husky", "commit-msg"), `bunx commitlint --edit "$1"`);
|
|
7234
|
+
const logger = new TerminalLogger9;
|
|
7117
7235
|
logger.success(`${kebabName} created successfully at ${destination}`, undefined, {
|
|
7118
7236
|
showTimestamp: false,
|
|
7119
7237
|
showArrow: false,
|
|
@@ -7122,12 +7240,12 @@ class MakeAppCommand {
|
|
|
7122
7240
|
}
|
|
7123
7241
|
}
|
|
7124
7242
|
MakeAppCommand = __legacyDecorateClassTS([
|
|
7125
|
-
|
|
7243
|
+
decorator10.command()
|
|
7126
7244
|
], MakeAppCommand);
|
|
7127
7245
|
// src/commands/MakeCacheCommand.ts
|
|
7128
|
-
import { join as
|
|
7129
|
-
import { decorator as
|
|
7130
|
-
import { TerminalLogger as
|
|
7246
|
+
import { join as join11 } from "path";
|
|
7247
|
+
import { decorator as decorator11 } from "@ooneex/command";
|
|
7248
|
+
import { TerminalLogger as TerminalLogger10 } from "@ooneex/logger";
|
|
7131
7249
|
import { toPascalCase as toPascalCase4 } from "@ooneex/utils";
|
|
7132
7250
|
|
|
7133
7251
|
// src/templates/cache.test.txt
|
|
@@ -7203,28 +7321,28 @@ class MakeCacheCommand {
|
|
|
7203
7321
|
if (module) {
|
|
7204
7322
|
await ensureModule(module);
|
|
7205
7323
|
}
|
|
7206
|
-
const base = module ?
|
|
7207
|
-
const cacheLocalDir =
|
|
7208
|
-
const cacheDir =
|
|
7209
|
-
const filePath =
|
|
7324
|
+
const base = module ? join11("modules", module) : ".";
|
|
7325
|
+
const cacheLocalDir = join11(base, "src", "cache");
|
|
7326
|
+
const cacheDir = join11(process.cwd(), cacheLocalDir);
|
|
7327
|
+
const filePath = join11(cacheDir, `${name}Cache.ts`);
|
|
7210
7328
|
await Bun.write(filePath, content);
|
|
7211
7329
|
const testContent = cache_test_default.replace(/{{NAME}}/g, name);
|
|
7212
|
-
const testsLocalDir =
|
|
7213
|
-
const testsDir =
|
|
7214
|
-
const testFilePath =
|
|
7330
|
+
const testsLocalDir = join11(base, "tests", "cache");
|
|
7331
|
+
const testsDir = join11(process.cwd(), testsLocalDir);
|
|
7332
|
+
const testFilePath = join11(testsDir, `${name}Cache.spec.ts`);
|
|
7215
7333
|
await Bun.write(testFilePath, testContent);
|
|
7216
|
-
const logger = new
|
|
7217
|
-
logger.success(`${
|
|
7334
|
+
const logger = new TerminalLogger10;
|
|
7335
|
+
logger.success(`${join11(cacheLocalDir, name)}Cache.ts created successfully`, undefined, {
|
|
7218
7336
|
showTimestamp: false,
|
|
7219
7337
|
showArrow: false,
|
|
7220
7338
|
useSymbol: true
|
|
7221
7339
|
});
|
|
7222
|
-
logger.success(`${
|
|
7340
|
+
logger.success(`${join11(testsLocalDir, name)}Cache.spec.ts created successfully`, undefined, {
|
|
7223
7341
|
showTimestamp: false,
|
|
7224
7342
|
showArrow: false,
|
|
7225
7343
|
useSymbol: true
|
|
7226
7344
|
});
|
|
7227
|
-
const packageJsonPath =
|
|
7345
|
+
const packageJsonPath = join11(process.cwd(), "package.json");
|
|
7228
7346
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
7229
7347
|
const deps = packageJson.dependencies ?? {};
|
|
7230
7348
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -7239,12 +7357,12 @@ class MakeCacheCommand {
|
|
|
7239
7357
|
}
|
|
7240
7358
|
}
|
|
7241
7359
|
MakeCacheCommand = __legacyDecorateClassTS([
|
|
7242
|
-
|
|
7360
|
+
decorator11.command()
|
|
7243
7361
|
], MakeCacheCommand);
|
|
7244
7362
|
// src/commands/MakeClaudeSkillCommand.ts
|
|
7245
|
-
import { join as
|
|
7246
|
-
import { decorator as
|
|
7247
|
-
import { TerminalLogger as
|
|
7363
|
+
import { join as join12 } from "path";
|
|
7364
|
+
import { decorator as decorator12 } from "@ooneex/command";
|
|
7365
|
+
import { TerminalLogger as TerminalLogger11 } from "@ooneex/logger";
|
|
7248
7366
|
|
|
7249
7367
|
// src/templates/claude/skills/commit.md.txt
|
|
7250
7368
|
var commit_md_default = `---
|
|
@@ -7535,14 +7653,14 @@ class MakeClaudeSkillCommand {
|
|
|
7535
7653
|
return "Generate Claude skills from templates";
|
|
7536
7654
|
}
|
|
7537
7655
|
async run() {
|
|
7538
|
-
const skillsLocalDir =
|
|
7539
|
-
const skillsDir =
|
|
7540
|
-
const logger = new
|
|
7656
|
+
const skillsLocalDir = join12(".claude", "skills");
|
|
7657
|
+
const skillsDir = join12(process.cwd(), skillsLocalDir);
|
|
7658
|
+
const logger = new TerminalLogger11;
|
|
7541
7659
|
for (const [skillName, content] of Object.entries(skills)) {
|
|
7542
7660
|
const dirName = skillName.replace(/\./g, "-");
|
|
7543
|
-
const filePath =
|
|
7661
|
+
const filePath = join12(skillsDir, dirName, "SKILL.md");
|
|
7544
7662
|
await Bun.write(filePath, content);
|
|
7545
|
-
logger.success(`${
|
|
7663
|
+
logger.success(`${join12(skillsLocalDir, dirName, "SKILL.md")} created successfully`, undefined, {
|
|
7546
7664
|
showTimestamp: false,
|
|
7547
7665
|
showArrow: false,
|
|
7548
7666
|
useSymbol: true
|
|
@@ -7551,18 +7669,18 @@ class MakeClaudeSkillCommand {
|
|
|
7551
7669
|
}
|
|
7552
7670
|
}
|
|
7553
7671
|
MakeClaudeSkillCommand = __legacyDecorateClassTS([
|
|
7554
|
-
|
|
7672
|
+
decorator12.command()
|
|
7555
7673
|
], MakeClaudeSkillCommand);
|
|
7556
7674
|
// src/commands/MakeCommandCommand.ts
|
|
7557
|
-
import { join as
|
|
7558
|
-
import { commandCreate, decorator as
|
|
7559
|
-
import { TerminalLogger as
|
|
7675
|
+
import { join as join13 } from "path";
|
|
7676
|
+
import { commandCreate, decorator as decorator13 } from "@ooneex/command";
|
|
7677
|
+
import { TerminalLogger as TerminalLogger12 } from "@ooneex/logger";
|
|
7560
7678
|
|
|
7561
7679
|
// src/templates/module/command.run.txt
|
|
7562
7680
|
var command_run_default = `#!/usr/bin/env bun
|
|
7563
7681
|
|
|
7564
7682
|
import { run } from "@ooneex/command";
|
|
7565
|
-
import "
|
|
7683
|
+
import "@module/{{name}}/commands/commands";
|
|
7566
7684
|
|
|
7567
7685
|
await run();
|
|
7568
7686
|
`;
|
|
@@ -7583,20 +7701,19 @@ class MakeCommandCommand {
|
|
|
7583
7701
|
if (module) {
|
|
7584
7702
|
await ensureModule(module);
|
|
7585
7703
|
}
|
|
7586
|
-
const base = module ?
|
|
7587
|
-
const { commandPath, testPath } = await commandCreate({
|
|
7704
|
+
const base = module ? join13("modules", module) : ".";
|
|
7705
|
+
const { commandPath: filePath, testPath } = await commandCreate({
|
|
7588
7706
|
name,
|
|
7589
|
-
commandDir:
|
|
7590
|
-
testsDir:
|
|
7707
|
+
commandDir: join13(base, "src", "commands"),
|
|
7708
|
+
testsDir: join13(base, "tests", "commands")
|
|
7591
7709
|
});
|
|
7592
|
-
const binCommandRunPath =
|
|
7710
|
+
const binCommandRunPath = join13(process.cwd(), base, "bin", "command", "run.ts");
|
|
7593
7711
|
const binCommandRunFile = Bun.file(binCommandRunPath);
|
|
7594
7712
|
if (!await binCommandRunFile.exists()) {
|
|
7595
|
-
await Bun.write(binCommandRunPath, command_run_default);
|
|
7713
|
+
await Bun.write(binCommandRunPath, command_run_default.replace(/{{name}}/g, module ?? ""));
|
|
7596
7714
|
}
|
|
7597
|
-
const
|
|
7598
|
-
|
|
7599
|
-
logger.success(`${commandPath} created successfully`, undefined, {
|
|
7715
|
+
const logger = new TerminalLogger12;
|
|
7716
|
+
logger.success(`${filePath} created successfully`, undefined, {
|
|
7600
7717
|
showTimestamp: false,
|
|
7601
7718
|
showArrow: false,
|
|
7602
7719
|
useSymbol: true
|
|
@@ -7606,26 +7723,15 @@ class MakeCommandCommand {
|
|
|
7606
7723
|
showArrow: false,
|
|
7607
7724
|
useSymbol: true
|
|
7608
7725
|
});
|
|
7609
|
-
const pkgJson = await Bun.file(packageJsonPath).json();
|
|
7610
|
-
const deps = pkgJson.dependencies ?? {};
|
|
7611
|
-
const devDeps = pkgJson.devDependencies ?? {};
|
|
7612
|
-
if (!deps["@ooneex/command"] && !devDeps["@ooneex/command"]) {
|
|
7613
|
-
const install = Bun.spawn(["bun", "add", "--dev", "@ooneex/command"], {
|
|
7614
|
-
cwd: process.cwd(),
|
|
7615
|
-
stdout: "ignore",
|
|
7616
|
-
stderr: "inherit"
|
|
7617
|
-
});
|
|
7618
|
-
await install.exited;
|
|
7619
|
-
}
|
|
7620
7726
|
}
|
|
7621
7727
|
}
|
|
7622
7728
|
MakeCommandCommand = __legacyDecorateClassTS([
|
|
7623
|
-
|
|
7729
|
+
decorator13.command()
|
|
7624
7730
|
], MakeCommandCommand);
|
|
7625
7731
|
// src/commands/MakeControllerCommand.ts
|
|
7626
|
-
import { basename, join as
|
|
7627
|
-
import { decorator as
|
|
7628
|
-
import { TerminalLogger as
|
|
7732
|
+
import { basename, join as join14 } from "path";
|
|
7733
|
+
import { decorator as decorator14 } from "@ooneex/command";
|
|
7734
|
+
import { TerminalLogger as TerminalLogger13 } from "@ooneex/logger";
|
|
7629
7735
|
import { toKebabCase as toKebabCase3, toPascalCase as toPascalCase5, trim } from "@ooneex/utils";
|
|
7630
7736
|
|
|
7631
7737
|
// src/prompts/askConfirm.ts
|
|
@@ -8045,33 +8151,33 @@ class MakeControllerCommand {
|
|
|
8045
8151
|
if (module) {
|
|
8046
8152
|
await ensureModule(module);
|
|
8047
8153
|
}
|
|
8048
|
-
const base = module ?
|
|
8049
|
-
const controllersLocalDir =
|
|
8050
|
-
const controllersDir =
|
|
8051
|
-
const filePath =
|
|
8154
|
+
const base = module ? join14("modules", module) : ".";
|
|
8155
|
+
const controllersLocalDir = join14(base, "src", "controllers");
|
|
8156
|
+
const controllersDir = join14(process.cwd(), controllersLocalDir);
|
|
8157
|
+
const filePath = join14(controllersDir, `${name}Controller.ts`);
|
|
8052
8158
|
await Bun.write(filePath, content);
|
|
8053
8159
|
const testContent = controller_test_default.replace(/{{NAME}}/g, name);
|
|
8054
|
-
const testsLocalDir =
|
|
8055
|
-
const testsDir =
|
|
8056
|
-
const testFilePath =
|
|
8160
|
+
const testsLocalDir = join14(base, "tests", "controllers");
|
|
8161
|
+
const testsDir = join14(process.cwd(), testsLocalDir);
|
|
8162
|
+
const testFilePath = join14(testsDir, `${name}Controller.spec.ts`);
|
|
8057
8163
|
await Bun.write(testFilePath, testContent);
|
|
8058
8164
|
const modulePascalName = module ? toPascalCase5(module) : toPascalCase5(basename(process.cwd()));
|
|
8059
|
-
const modulePath =
|
|
8165
|
+
const modulePath = join14(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
8060
8166
|
if (await Bun.file(modulePath).exists()) {
|
|
8061
8167
|
await this.addToModule(modulePath, name);
|
|
8062
8168
|
}
|
|
8063
|
-
const logger = new
|
|
8064
|
-
logger.success(`${
|
|
8169
|
+
const logger = new TerminalLogger13;
|
|
8170
|
+
logger.success(`${join14(controllersLocalDir, name)}Controller.ts created successfully`, undefined, {
|
|
8065
8171
|
showTimestamp: false,
|
|
8066
8172
|
showArrow: false,
|
|
8067
8173
|
useSymbol: true
|
|
8068
8174
|
});
|
|
8069
|
-
logger.success(`${
|
|
8175
|
+
logger.success(`${join14(testsLocalDir, name)}Controller.spec.ts created successfully`, undefined, {
|
|
8070
8176
|
showTimestamp: false,
|
|
8071
8177
|
showArrow: false,
|
|
8072
8178
|
useSymbol: true
|
|
8073
8179
|
});
|
|
8074
|
-
const packageJsonPath =
|
|
8180
|
+
const packageJsonPath = join14(process.cwd(), "package.json");
|
|
8075
8181
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8076
8182
|
const deps = packageJson.dependencies ?? {};
|
|
8077
8183
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8086,12 +8192,12 @@ class MakeControllerCommand {
|
|
|
8086
8192
|
}
|
|
8087
8193
|
}
|
|
8088
8194
|
MakeControllerCommand = __legacyDecorateClassTS([
|
|
8089
|
-
|
|
8195
|
+
decorator14.command()
|
|
8090
8196
|
], MakeControllerCommand);
|
|
8091
8197
|
// src/commands/MakeCronCommand.ts
|
|
8092
|
-
import { basename as basename2, join as
|
|
8093
|
-
import { decorator as
|
|
8094
|
-
import { TerminalLogger as
|
|
8198
|
+
import { basename as basename2, join as join15 } from "path";
|
|
8199
|
+
import { decorator as decorator15 } from "@ooneex/command";
|
|
8200
|
+
import { TerminalLogger as TerminalLogger14 } from "@ooneex/logger";
|
|
8095
8201
|
import { toPascalCase as toPascalCase6 } from "@ooneex/utils";
|
|
8096
8202
|
|
|
8097
8203
|
// src/templates/cron.test.txt
|
|
@@ -8180,33 +8286,33 @@ class MakeCronCommand {
|
|
|
8180
8286
|
if (module) {
|
|
8181
8287
|
await ensureModule(module);
|
|
8182
8288
|
}
|
|
8183
|
-
const base = module ?
|
|
8184
|
-
const cronLocalDir =
|
|
8185
|
-
const cronDir =
|
|
8186
|
-
const filePath =
|
|
8289
|
+
const base = module ? join15("modules", module) : ".";
|
|
8290
|
+
const cronLocalDir = join15(base, "src", "crons");
|
|
8291
|
+
const cronDir = join15(process.cwd(), cronLocalDir);
|
|
8292
|
+
const filePath = join15(cronDir, `${name}Cron.ts`);
|
|
8187
8293
|
await Bun.write(filePath, content);
|
|
8188
8294
|
const testContent = cron_test_default.replace(/{{NAME}}/g, name);
|
|
8189
|
-
const testsLocalDir =
|
|
8190
|
-
const testsDir =
|
|
8191
|
-
const testFilePath =
|
|
8295
|
+
const testsLocalDir = join15(base, "tests", "crons");
|
|
8296
|
+
const testsDir = join15(process.cwd(), testsLocalDir);
|
|
8297
|
+
const testFilePath = join15(testsDir, `${name}Cron.spec.ts`);
|
|
8192
8298
|
await Bun.write(testFilePath, testContent);
|
|
8193
8299
|
const modulePascalName = module ? toPascalCase6(module) : toPascalCase6(basename2(process.cwd()));
|
|
8194
|
-
const modulePath =
|
|
8300
|
+
const modulePath = join15(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
8195
8301
|
if (await Bun.file(modulePath).exists()) {
|
|
8196
8302
|
await this.addToModule(modulePath, name);
|
|
8197
8303
|
}
|
|
8198
|
-
const logger = new
|
|
8199
|
-
logger.success(`${
|
|
8304
|
+
const logger = new TerminalLogger14;
|
|
8305
|
+
logger.success(`${join15(cronLocalDir, name)}Cron.ts created successfully`, undefined, {
|
|
8200
8306
|
showTimestamp: false,
|
|
8201
8307
|
showArrow: false,
|
|
8202
8308
|
useSymbol: true
|
|
8203
8309
|
});
|
|
8204
|
-
logger.success(`${
|
|
8310
|
+
logger.success(`${join15(testsLocalDir, name)}Cron.spec.ts created successfully`, undefined, {
|
|
8205
8311
|
showTimestamp: false,
|
|
8206
8312
|
showArrow: false,
|
|
8207
8313
|
useSymbol: true
|
|
8208
8314
|
});
|
|
8209
|
-
const packageJsonPath =
|
|
8315
|
+
const packageJsonPath = join15(process.cwd(), "package.json");
|
|
8210
8316
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8211
8317
|
const deps = packageJson.dependencies ?? {};
|
|
8212
8318
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8221,12 +8327,12 @@ class MakeCronCommand {
|
|
|
8221
8327
|
}
|
|
8222
8328
|
}
|
|
8223
8329
|
MakeCronCommand = __legacyDecorateClassTS([
|
|
8224
|
-
|
|
8330
|
+
decorator15.command()
|
|
8225
8331
|
], MakeCronCommand);
|
|
8226
8332
|
// src/commands/MakeDatabaseCommand.ts
|
|
8227
|
-
import { join as
|
|
8228
|
-
import { decorator as
|
|
8229
|
-
import { TerminalLogger as
|
|
8333
|
+
import { join as join16 } from "path";
|
|
8334
|
+
import { decorator as decorator16 } from "@ooneex/command";
|
|
8335
|
+
import { TerminalLogger as TerminalLogger15 } from "@ooneex/logger";
|
|
8230
8336
|
import { toPascalCase as toPascalCase7 } from "@ooneex/utils";
|
|
8231
8337
|
|
|
8232
8338
|
// src/templates/database.test.txt
|
|
@@ -8289,28 +8395,28 @@ class MakeDatabaseCommand {
|
|
|
8289
8395
|
if (module) {
|
|
8290
8396
|
await ensureModule(module);
|
|
8291
8397
|
}
|
|
8292
|
-
const base = module ?
|
|
8293
|
-
const databaseLocalDir =
|
|
8294
|
-
const databaseDir =
|
|
8295
|
-
const filePath =
|
|
8398
|
+
const base = module ? join16("modules", module) : ".";
|
|
8399
|
+
const databaseLocalDir = join16(base, "src", "databases");
|
|
8400
|
+
const databaseDir = join16(process.cwd(), databaseLocalDir);
|
|
8401
|
+
const filePath = join16(databaseDir, `${name}Database.ts`);
|
|
8296
8402
|
await Bun.write(filePath, content);
|
|
8297
8403
|
const testContent = database_test_default.replace(/{{NAME}}/g, name);
|
|
8298
|
-
const testsLocalDir =
|
|
8299
|
-
const testsDir =
|
|
8300
|
-
const testFilePath =
|
|
8404
|
+
const testsLocalDir = join16(base, "tests", "databases");
|
|
8405
|
+
const testsDir = join16(process.cwd(), testsLocalDir);
|
|
8406
|
+
const testFilePath = join16(testsDir, `${name}Database.spec.ts`);
|
|
8301
8407
|
await Bun.write(testFilePath, testContent);
|
|
8302
|
-
const logger = new
|
|
8303
|
-
logger.success(`${
|
|
8408
|
+
const logger = new TerminalLogger15;
|
|
8409
|
+
logger.success(`${join16(databaseLocalDir, name)}Database.ts created successfully`, undefined, {
|
|
8304
8410
|
showTimestamp: false,
|
|
8305
8411
|
showArrow: false,
|
|
8306
8412
|
useSymbol: true
|
|
8307
8413
|
});
|
|
8308
|
-
logger.success(`${
|
|
8414
|
+
logger.success(`${join16(testsLocalDir, name)}Database.spec.ts created successfully`, undefined, {
|
|
8309
8415
|
showTimestamp: false,
|
|
8310
8416
|
showArrow: false,
|
|
8311
8417
|
useSymbol: true
|
|
8312
8418
|
});
|
|
8313
|
-
const packageJsonPath =
|
|
8419
|
+
const packageJsonPath = join16(process.cwd(), "package.json");
|
|
8314
8420
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8315
8421
|
const deps = packageJson.dependencies ?? {};
|
|
8316
8422
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8325,12 +8431,12 @@ class MakeDatabaseCommand {
|
|
|
8325
8431
|
}
|
|
8326
8432
|
}
|
|
8327
8433
|
MakeDatabaseCommand = __legacyDecorateClassTS([
|
|
8328
|
-
|
|
8434
|
+
decorator16.command()
|
|
8329
8435
|
], MakeDatabaseCommand);
|
|
8330
8436
|
// src/commands/MakeDockerCommand.ts
|
|
8331
|
-
import { join as
|
|
8332
|
-
import { decorator as
|
|
8333
|
-
import { TerminalLogger as
|
|
8437
|
+
import { join as join17 } from "path";
|
|
8438
|
+
import { decorator as decorator17 } from "@ooneex/command";
|
|
8439
|
+
import { TerminalLogger as TerminalLogger16 } from "@ooneex/logger";
|
|
8334
8440
|
var {YAML } = globalThis.Bun;
|
|
8335
8441
|
|
|
8336
8442
|
// src/prompts/askDockerService.ts
|
|
@@ -8823,9 +8929,9 @@ class MakeDockerCommand {
|
|
|
8823
8929
|
name = await askDockerService({ message: "Select docker service" });
|
|
8824
8930
|
}
|
|
8825
8931
|
const templateContent = templates[name];
|
|
8826
|
-
const base =
|
|
8827
|
-
const composePath =
|
|
8828
|
-
const logger = new
|
|
8932
|
+
const base = join17("modules", "app");
|
|
8933
|
+
const composePath = join17(process.cwd(), base, "docker-compose.yml");
|
|
8934
|
+
const logger = new TerminalLogger16;
|
|
8829
8935
|
const composeFile = Bun.file(composePath);
|
|
8830
8936
|
if (await composeFile.exists()) {
|
|
8831
8937
|
const existingContent = await composeFile.text();
|
|
@@ -8884,7 +8990,7 @@ volumes:
|
|
|
8884
8990
|
} else {
|
|
8885
8991
|
await Bun.write(composePath, templateContent);
|
|
8886
8992
|
}
|
|
8887
|
-
const packageJsonPath =
|
|
8993
|
+
const packageJsonPath = join17(process.cwd(), base, "package.json");
|
|
8888
8994
|
const packageJsonFile = Bun.file(packageJsonPath);
|
|
8889
8995
|
if (await packageJsonFile.exists()) {
|
|
8890
8996
|
const packageJson = await packageJsonFile.json();
|
|
@@ -8905,13 +9011,13 @@ volumes:
|
|
|
8905
9011
|
}
|
|
8906
9012
|
}
|
|
8907
9013
|
MakeDockerCommand = __legacyDecorateClassTS([
|
|
8908
|
-
|
|
9014
|
+
decorator17.command()
|
|
8909
9015
|
], MakeDockerCommand);
|
|
8910
9016
|
// src/commands/MakeEntityCommand.ts
|
|
8911
9017
|
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
8912
|
-
import { basename as basename3, join as
|
|
8913
|
-
import { decorator as
|
|
8914
|
-
import { TerminalLogger as
|
|
9018
|
+
import { basename as basename3, join as join18 } from "path";
|
|
9019
|
+
import { decorator as decorator18 } from "@ooneex/command";
|
|
9020
|
+
import { TerminalLogger as TerminalLogger17 } from "@ooneex/logger";
|
|
8915
9021
|
import { toPascalCase as toPascalCase8, toSnakeCase as toSnakeCase2 } from "@ooneex/utils";
|
|
8916
9022
|
|
|
8917
9023
|
// src/templates/entity.test.txt
|
|
@@ -9075,28 +9181,28 @@ class MakeEntityCommand {
|
|
|
9075
9181
|
if (module) {
|
|
9076
9182
|
await ensureModule(module);
|
|
9077
9183
|
}
|
|
9078
|
-
const base = module ?
|
|
9079
|
-
const entitiesLocalDir =
|
|
9080
|
-
const entitiesDir =
|
|
9081
|
-
const filePath =
|
|
9184
|
+
const base = module ? join18("modules", module) : ".";
|
|
9185
|
+
const entitiesLocalDir = join18(base, "src", "entities");
|
|
9186
|
+
const entitiesDir = join18(process.cwd(), entitiesLocalDir);
|
|
9187
|
+
const filePath = join18(entitiesDir, `${name}Entity.ts`);
|
|
9082
9188
|
await Bun.write(filePath, content);
|
|
9083
9189
|
const testContent = entity_test_default.replace(/{{NAME}}/g, name);
|
|
9084
|
-
const testsLocalDir =
|
|
9085
|
-
const testsDir =
|
|
9086
|
-
const testFilePath =
|
|
9190
|
+
const testsLocalDir = join18(base, "tests", "entities");
|
|
9191
|
+
const testsDir = join18(process.cwd(), testsLocalDir);
|
|
9192
|
+
const testFilePath = join18(testsDir, `${name}Entity.spec.ts`);
|
|
9087
9193
|
await Bun.write(testFilePath, testContent);
|
|
9088
9194
|
const modulePascalName = module ? toPascalCase8(module) : toPascalCase8(basename3(process.cwd()));
|
|
9089
|
-
const modulePath =
|
|
9195
|
+
const modulePath = join18(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9090
9196
|
if (await Bun.file(modulePath).exists()) {
|
|
9091
9197
|
await this.addToModule(modulePath, name);
|
|
9092
9198
|
}
|
|
9093
|
-
const logger = new
|
|
9094
|
-
logger.success(`${
|
|
9199
|
+
const logger = new TerminalLogger17;
|
|
9200
|
+
logger.success(`${join18(entitiesLocalDir, name)}Entity.ts created successfully`, undefined, {
|
|
9095
9201
|
showTimestamp: false,
|
|
9096
9202
|
showArrow: false,
|
|
9097
9203
|
useSymbol: true
|
|
9098
9204
|
});
|
|
9099
|
-
logger.success(`${
|
|
9205
|
+
logger.success(`${join18(testsLocalDir, name)}Entity.spec.ts created successfully`, undefined, {
|
|
9100
9206
|
showTimestamp: false,
|
|
9101
9207
|
showArrow: false,
|
|
9102
9208
|
useSymbol: true
|
|
@@ -9104,12 +9210,12 @@ class MakeEntityCommand {
|
|
|
9104
9210
|
}
|
|
9105
9211
|
}
|
|
9106
9212
|
MakeEntityCommand = __legacyDecorateClassTS([
|
|
9107
|
-
|
|
9213
|
+
decorator18.command()
|
|
9108
9214
|
], MakeEntityCommand);
|
|
9109
9215
|
// src/commands/MakeLoggerCommand.ts
|
|
9110
|
-
import { join as
|
|
9111
|
-
import { decorator as
|
|
9112
|
-
import { TerminalLogger as
|
|
9216
|
+
import { join as join19 } from "path";
|
|
9217
|
+
import { decorator as decorator19 } from "@ooneex/command";
|
|
9218
|
+
import { TerminalLogger as TerminalLogger18 } from "@ooneex/logger";
|
|
9113
9219
|
import { toPascalCase as toPascalCase9 } from "@ooneex/utils";
|
|
9114
9220
|
|
|
9115
9221
|
// src/templates/logger.test.txt
|
|
@@ -9214,28 +9320,28 @@ class MakeLoggerCommand {
|
|
|
9214
9320
|
if (module) {
|
|
9215
9321
|
await ensureModule(module);
|
|
9216
9322
|
}
|
|
9217
|
-
const base = module ?
|
|
9218
|
-
const loggerLocalDir =
|
|
9219
|
-
const loggerDir =
|
|
9220
|
-
const filePath =
|
|
9323
|
+
const base = module ? join19("modules", module) : ".";
|
|
9324
|
+
const loggerLocalDir = join19(base, "src", "loggers");
|
|
9325
|
+
const loggerDir = join19(process.cwd(), loggerLocalDir);
|
|
9326
|
+
const filePath = join19(loggerDir, `${name}Logger.ts`);
|
|
9221
9327
|
await Bun.write(filePath, content);
|
|
9222
9328
|
const testContent = logger_test_default.replace(/{{NAME}}/g, name);
|
|
9223
|
-
const testsLocalDir =
|
|
9224
|
-
const testsDir =
|
|
9225
|
-
const testFilePath =
|
|
9329
|
+
const testsLocalDir = join19(base, "tests", "loggers");
|
|
9330
|
+
const testsDir = join19(process.cwd(), testsLocalDir);
|
|
9331
|
+
const testFilePath = join19(testsDir, `${name}Logger.spec.ts`);
|
|
9226
9332
|
await Bun.write(testFilePath, testContent);
|
|
9227
|
-
const logger = new
|
|
9228
|
-
logger.success(`${
|
|
9333
|
+
const logger = new TerminalLogger18;
|
|
9334
|
+
logger.success(`${join19(loggerLocalDir, name)}Logger.ts created successfully`, undefined, {
|
|
9229
9335
|
showTimestamp: false,
|
|
9230
9336
|
showArrow: false,
|
|
9231
9337
|
useSymbol: true
|
|
9232
9338
|
});
|
|
9233
|
-
logger.success(`${
|
|
9339
|
+
logger.success(`${join19(testsLocalDir, name)}Logger.spec.ts created successfully`, undefined, {
|
|
9234
9340
|
showTimestamp: false,
|
|
9235
9341
|
showArrow: false,
|
|
9236
9342
|
useSymbol: true
|
|
9237
9343
|
});
|
|
9238
|
-
const packageJsonPath =
|
|
9344
|
+
const packageJsonPath = join19(process.cwd(), "package.json");
|
|
9239
9345
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9240
9346
|
const deps = packageJson.dependencies ?? {};
|
|
9241
9347
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9250,12 +9356,12 @@ class MakeLoggerCommand {
|
|
|
9250
9356
|
}
|
|
9251
9357
|
}
|
|
9252
9358
|
MakeLoggerCommand = __legacyDecorateClassTS([
|
|
9253
|
-
|
|
9359
|
+
decorator19.command()
|
|
9254
9360
|
], MakeLoggerCommand);
|
|
9255
9361
|
// src/commands/MakeMailerCommand.ts
|
|
9256
|
-
import { join as
|
|
9257
|
-
import { decorator as
|
|
9258
|
-
import { TerminalLogger as
|
|
9362
|
+
import { join as join20 } from "path";
|
|
9363
|
+
import { decorator as decorator20 } from "@ooneex/command";
|
|
9364
|
+
import { TerminalLogger as TerminalLogger19 } from "@ooneex/logger";
|
|
9259
9365
|
import { toPascalCase as toPascalCase10 } from "@ooneex/utils";
|
|
9260
9366
|
|
|
9261
9367
|
// src/templates/mailer/mailer.test.txt
|
|
@@ -9353,43 +9459,43 @@ class MakeMailerCommand {
|
|
|
9353
9459
|
if (module) {
|
|
9354
9460
|
await ensureModule(module);
|
|
9355
9461
|
}
|
|
9356
|
-
const base = module ?
|
|
9357
|
-
const mailerLocalDir =
|
|
9358
|
-
const mailerDir =
|
|
9359
|
-
const mailerFilePath =
|
|
9360
|
-
const templateFilePath =
|
|
9462
|
+
const base = module ? join20("modules", module) : ".";
|
|
9463
|
+
const mailerLocalDir = join20(base, "src", "mailers");
|
|
9464
|
+
const mailerDir = join20(process.cwd(), mailerLocalDir);
|
|
9465
|
+
const mailerFilePath = join20(mailerDir, `${name}Mailer.ts`);
|
|
9466
|
+
const templateFilePath = join20(mailerDir, `${name}MailerTemplate.tsx`);
|
|
9361
9467
|
await Bun.write(mailerFilePath, mailerContent);
|
|
9362
9468
|
await Bun.write(templateFilePath, templateContent);
|
|
9363
9469
|
const mailerTestContent = mailer_test_default.replace(/{{NAME}}/g, name);
|
|
9364
9470
|
const templateTestContent = mailer_template_test_default.replace(/{{NAME}}/g, name);
|
|
9365
|
-
const testsLocalDir =
|
|
9366
|
-
const testsDir =
|
|
9367
|
-
const mailerTestFilePath =
|
|
9368
|
-
const templateTestFilePath =
|
|
9471
|
+
const testsLocalDir = join20(base, "tests", "mailers");
|
|
9472
|
+
const testsDir = join20(process.cwd(), testsLocalDir);
|
|
9473
|
+
const mailerTestFilePath = join20(testsDir, `${name}Mailer.spec.ts`);
|
|
9474
|
+
const templateTestFilePath = join20(testsDir, `${name}MailerTemplate.spec.ts`);
|
|
9369
9475
|
await Bun.write(mailerTestFilePath, mailerTestContent);
|
|
9370
9476
|
await Bun.write(templateTestFilePath, templateTestContent);
|
|
9371
|
-
const logger = new
|
|
9372
|
-
logger.success(`${
|
|
9477
|
+
const logger = new TerminalLogger19;
|
|
9478
|
+
logger.success(`${join20(mailerLocalDir, name)}Mailer.ts created successfully`, undefined, {
|
|
9373
9479
|
showTimestamp: false,
|
|
9374
9480
|
showArrow: false,
|
|
9375
9481
|
useSymbol: true
|
|
9376
9482
|
});
|
|
9377
|
-
logger.success(`${
|
|
9483
|
+
logger.success(`${join20(mailerLocalDir, name)}MailerTemplate.tsx created successfully`, undefined, {
|
|
9378
9484
|
showTimestamp: false,
|
|
9379
9485
|
showArrow: false,
|
|
9380
9486
|
useSymbol: true
|
|
9381
9487
|
});
|
|
9382
|
-
logger.success(`${
|
|
9488
|
+
logger.success(`${join20(testsLocalDir, name)}Mailer.spec.ts created successfully`, undefined, {
|
|
9383
9489
|
showTimestamp: false,
|
|
9384
9490
|
showArrow: false,
|
|
9385
9491
|
useSymbol: true
|
|
9386
9492
|
});
|
|
9387
|
-
logger.success(`${
|
|
9493
|
+
logger.success(`${join20(testsLocalDir, name)}MailerTemplate.spec.ts created successfully`, undefined, {
|
|
9388
9494
|
showTimestamp: false,
|
|
9389
9495
|
showArrow: false,
|
|
9390
9496
|
useSymbol: true
|
|
9391
9497
|
});
|
|
9392
|
-
const packageJsonPath =
|
|
9498
|
+
const packageJsonPath = join20(process.cwd(), "package.json");
|
|
9393
9499
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9394
9500
|
const deps = packageJson.dependencies ?? {};
|
|
9395
9501
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9404,12 +9510,12 @@ class MakeMailerCommand {
|
|
|
9404
9510
|
}
|
|
9405
9511
|
}
|
|
9406
9512
|
MakeMailerCommand = __legacyDecorateClassTS([
|
|
9407
|
-
|
|
9513
|
+
decorator20.command()
|
|
9408
9514
|
], MakeMailerCommand);
|
|
9409
9515
|
// src/commands/MakeMiddlewareCommand.ts
|
|
9410
|
-
import { basename as basename4, join as
|
|
9411
|
-
import { decorator as
|
|
9412
|
-
import { TerminalLogger as
|
|
9516
|
+
import { basename as basename4, join as join21 } from "path";
|
|
9517
|
+
import { decorator as decorator21 } from "@ooneex/command";
|
|
9518
|
+
import { TerminalLogger as TerminalLogger20 } from "@ooneex/logger";
|
|
9413
9519
|
import { toPascalCase as toPascalCase11 } from "@ooneex/utils";
|
|
9414
9520
|
|
|
9415
9521
|
// src/templates/middleware.socket.txt
|
|
@@ -9498,33 +9604,33 @@ class MakeMiddlewareCommand {
|
|
|
9498
9604
|
if (module) {
|
|
9499
9605
|
await ensureModule(module);
|
|
9500
9606
|
}
|
|
9501
|
-
const base = module ?
|
|
9502
|
-
const middlewareLocalDir =
|
|
9503
|
-
const middlewareDir =
|
|
9504
|
-
const filePath =
|
|
9607
|
+
const base = module ? join21("modules", module) : ".";
|
|
9608
|
+
const middlewareLocalDir = join21(base, "src", "middlewares");
|
|
9609
|
+
const middlewareDir = join21(process.cwd(), middlewareLocalDir);
|
|
9610
|
+
const filePath = join21(middlewareDir, `${name}Middleware.ts`);
|
|
9505
9611
|
await Bun.write(filePath, content);
|
|
9506
9612
|
const testContent = middleware_test_default.replace(/{{NAME}}/g, name);
|
|
9507
|
-
const testsLocalDir =
|
|
9508
|
-
const testsDir =
|
|
9509
|
-
const testFilePath =
|
|
9613
|
+
const testsLocalDir = join21(base, "tests", "middlewares");
|
|
9614
|
+
const testsDir = join21(process.cwd(), testsLocalDir);
|
|
9615
|
+
const testFilePath = join21(testsDir, `${name}Middleware.spec.ts`);
|
|
9510
9616
|
await Bun.write(testFilePath, testContent);
|
|
9511
9617
|
const modulePascalName = module ? toPascalCase11(module) : toPascalCase11(basename4(process.cwd()));
|
|
9512
|
-
const modulePath =
|
|
9618
|
+
const modulePath = join21(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9513
9619
|
if (await Bun.file(modulePath).exists()) {
|
|
9514
9620
|
await this.addToModule(modulePath, name);
|
|
9515
9621
|
}
|
|
9516
|
-
const logger = new
|
|
9517
|
-
logger.success(`${
|
|
9622
|
+
const logger = new TerminalLogger20;
|
|
9623
|
+
logger.success(`${join21(middlewareLocalDir, name)}Middleware.ts created successfully`, undefined, {
|
|
9518
9624
|
showTimestamp: false,
|
|
9519
9625
|
showArrow: false,
|
|
9520
9626
|
useSymbol: true
|
|
9521
9627
|
});
|
|
9522
|
-
logger.success(`${
|
|
9628
|
+
logger.success(`${join21(testsLocalDir, name)}Middleware.spec.ts created successfully`, undefined, {
|
|
9523
9629
|
showTimestamp: false,
|
|
9524
9630
|
showArrow: false,
|
|
9525
9631
|
useSymbol: true
|
|
9526
9632
|
});
|
|
9527
|
-
const packageJsonPath =
|
|
9633
|
+
const packageJsonPath = join21(process.cwd(), "package.json");
|
|
9528
9634
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9529
9635
|
const deps = packageJson.dependencies ?? {};
|
|
9530
9636
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9539,12 +9645,12 @@ class MakeMiddlewareCommand {
|
|
|
9539
9645
|
}
|
|
9540
9646
|
}
|
|
9541
9647
|
MakeMiddlewareCommand = __legacyDecorateClassTS([
|
|
9542
|
-
|
|
9648
|
+
decorator21.command()
|
|
9543
9649
|
], MakeMiddlewareCommand);
|
|
9544
9650
|
// src/commands/MakeMigrationCommand.ts
|
|
9545
|
-
import { join as
|
|
9546
|
-
import { decorator as
|
|
9547
|
-
import { TerminalLogger as
|
|
9651
|
+
import { join as join22 } from "path";
|
|
9652
|
+
import { decorator as decorator22 } from "@ooneex/command";
|
|
9653
|
+
import { TerminalLogger as TerminalLogger21 } from "@ooneex/logger";
|
|
9548
9654
|
import { migrationCreate } from "@ooneex/migrations";
|
|
9549
9655
|
|
|
9550
9656
|
// src/templates/module/migration.up.txt
|
|
@@ -9572,17 +9678,17 @@ class MakeMigrationCommand {
|
|
|
9572
9678
|
if (module) {
|
|
9573
9679
|
await ensureModule(module);
|
|
9574
9680
|
}
|
|
9575
|
-
const base = module ?
|
|
9681
|
+
const base = module ? join22("modules", module) : ".";
|
|
9576
9682
|
const { migrationPath: filePath } = await migrationCreate({
|
|
9577
|
-
migrationsDir:
|
|
9578
|
-
testsDir:
|
|
9683
|
+
migrationsDir: join22(base, "src", "migrations"),
|
|
9684
|
+
testsDir: join22(base, "tests", "migrations")
|
|
9579
9685
|
});
|
|
9580
|
-
const binMigrationUpPath =
|
|
9686
|
+
const binMigrationUpPath = join22(process.cwd(), base, "bin", "migration", "up.ts");
|
|
9581
9687
|
const binMigrationUpFile = Bun.file(binMigrationUpPath);
|
|
9582
9688
|
if (!await binMigrationUpFile.exists()) {
|
|
9583
9689
|
await Bun.write(binMigrationUpPath, migration_up_default.replace(/{{name}}/g, module ?? ""));
|
|
9584
9690
|
}
|
|
9585
|
-
const logger = new
|
|
9691
|
+
const logger = new TerminalLogger21;
|
|
9586
9692
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
9587
9693
|
showTimestamp: false,
|
|
9588
9694
|
showArrow: false,
|
|
@@ -9591,12 +9697,12 @@ class MakeMigrationCommand {
|
|
|
9591
9697
|
}
|
|
9592
9698
|
}
|
|
9593
9699
|
MakeMigrationCommand = __legacyDecorateClassTS([
|
|
9594
|
-
|
|
9700
|
+
decorator22.command()
|
|
9595
9701
|
], MakeMigrationCommand);
|
|
9596
9702
|
// src/commands/MakePermissionCommand.ts
|
|
9597
|
-
import { join as
|
|
9598
|
-
import { decorator as
|
|
9599
|
-
import { TerminalLogger as
|
|
9703
|
+
import { join as join23 } from "path";
|
|
9704
|
+
import { decorator as decorator23 } from "@ooneex/command";
|
|
9705
|
+
import { TerminalLogger as TerminalLogger22 } from "@ooneex/logger";
|
|
9600
9706
|
import { toPascalCase as toPascalCase12 } from "@ooneex/utils";
|
|
9601
9707
|
|
|
9602
9708
|
// src/templates/permission.test.txt
|
|
@@ -9687,28 +9793,28 @@ class MakePermissionCommand {
|
|
|
9687
9793
|
if (module) {
|
|
9688
9794
|
await ensureModule(module);
|
|
9689
9795
|
}
|
|
9690
|
-
const base = module ?
|
|
9691
|
-
const permissionLocalDir =
|
|
9692
|
-
const permissionDir =
|
|
9693
|
-
const filePath =
|
|
9796
|
+
const base = module ? join23("modules", module) : ".";
|
|
9797
|
+
const permissionLocalDir = join23(base, "src", "permissions");
|
|
9798
|
+
const permissionDir = join23(process.cwd(), permissionLocalDir);
|
|
9799
|
+
const filePath = join23(permissionDir, `${name}Permission.ts`);
|
|
9694
9800
|
await Bun.write(filePath, content);
|
|
9695
9801
|
const testContent = permission_test_default.replace(/{{NAME}}/g, name);
|
|
9696
|
-
const testsLocalDir =
|
|
9697
|
-
const testsDir =
|
|
9698
|
-
const testFilePath =
|
|
9802
|
+
const testsLocalDir = join23(base, "tests", "permissions");
|
|
9803
|
+
const testsDir = join23(process.cwd(), testsLocalDir);
|
|
9804
|
+
const testFilePath = join23(testsDir, `${name}Permission.spec.ts`);
|
|
9699
9805
|
await Bun.write(testFilePath, testContent);
|
|
9700
|
-
const logger = new
|
|
9701
|
-
logger.success(`${
|
|
9806
|
+
const logger = new TerminalLogger22;
|
|
9807
|
+
logger.success(`${join23(permissionLocalDir, name)}Permission.ts created successfully`, undefined, {
|
|
9702
9808
|
showTimestamp: false,
|
|
9703
9809
|
showArrow: false,
|
|
9704
9810
|
useSymbol: true
|
|
9705
9811
|
});
|
|
9706
|
-
logger.success(`${
|
|
9812
|
+
logger.success(`${join23(testsLocalDir, name)}Permission.spec.ts created successfully`, undefined, {
|
|
9707
9813
|
showTimestamp: false,
|
|
9708
9814
|
showArrow: false,
|
|
9709
9815
|
useSymbol: true
|
|
9710
9816
|
});
|
|
9711
|
-
const packageJsonPath =
|
|
9817
|
+
const packageJsonPath = join23(process.cwd(), "package.json");
|
|
9712
9818
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9713
9819
|
const deps = packageJson.dependencies ?? {};
|
|
9714
9820
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9723,12 +9829,12 @@ class MakePermissionCommand {
|
|
|
9723
9829
|
}
|
|
9724
9830
|
}
|
|
9725
9831
|
MakePermissionCommand = __legacyDecorateClassTS([
|
|
9726
|
-
|
|
9832
|
+
decorator23.command()
|
|
9727
9833
|
], MakePermissionCommand);
|
|
9728
9834
|
// src/commands/MakePubSubCommand.ts
|
|
9729
|
-
import { basename as basename5, join as
|
|
9730
|
-
import { decorator as
|
|
9731
|
-
import { TerminalLogger as
|
|
9835
|
+
import { basename as basename5, join as join24 } from "path";
|
|
9836
|
+
import { decorator as decorator24 } from "@ooneex/command";
|
|
9837
|
+
import { TerminalLogger as TerminalLogger23 } from "@ooneex/logger";
|
|
9732
9838
|
import { toKebabCase as toKebabCase4, toPascalCase as toPascalCase13 } from "@ooneex/utils";
|
|
9733
9839
|
|
|
9734
9840
|
// src/templates/pubsub.test.txt
|
|
@@ -9836,33 +9942,33 @@ class MakePubSubCommand {
|
|
|
9836
9942
|
if (module) {
|
|
9837
9943
|
await ensureModule(module);
|
|
9838
9944
|
}
|
|
9839
|
-
const base = module ?
|
|
9840
|
-
const pubSubLocalDir =
|
|
9841
|
-
const pubSubDir =
|
|
9842
|
-
const filePath =
|
|
9945
|
+
const base = module ? join24("modules", module) : ".";
|
|
9946
|
+
const pubSubLocalDir = join24(base, "src", "events");
|
|
9947
|
+
const pubSubDir = join24(process.cwd(), pubSubLocalDir);
|
|
9948
|
+
const filePath = join24(pubSubDir, `${name}Event.ts`);
|
|
9843
9949
|
await Bun.write(filePath, content);
|
|
9844
9950
|
const testContent = pubsub_test_default.replace(/{{NAME}}/g, name);
|
|
9845
|
-
const testsLocalDir =
|
|
9846
|
-
const testsDir =
|
|
9847
|
-
const testFilePath =
|
|
9951
|
+
const testsLocalDir = join24(base, "tests", "events");
|
|
9952
|
+
const testsDir = join24(process.cwd(), testsLocalDir);
|
|
9953
|
+
const testFilePath = join24(testsDir, `${name}Event.spec.ts`);
|
|
9848
9954
|
await Bun.write(testFilePath, testContent);
|
|
9849
9955
|
const modulePascalName = module ? toPascalCase13(module) : toPascalCase13(basename5(process.cwd()));
|
|
9850
|
-
const modulePath =
|
|
9956
|
+
const modulePath = join24(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9851
9957
|
if (await Bun.file(modulePath).exists()) {
|
|
9852
9958
|
await this.addToModule(modulePath, name);
|
|
9853
9959
|
}
|
|
9854
|
-
const logger = new
|
|
9855
|
-
logger.success(`${
|
|
9960
|
+
const logger = new TerminalLogger23;
|
|
9961
|
+
logger.success(`${join24(pubSubLocalDir, name)}Event.ts created successfully`, undefined, {
|
|
9856
9962
|
showTimestamp: false,
|
|
9857
9963
|
showArrow: false,
|
|
9858
9964
|
useSymbol: true
|
|
9859
9965
|
});
|
|
9860
|
-
logger.success(`${
|
|
9966
|
+
logger.success(`${join24(testsLocalDir, name)}Event.spec.ts created successfully`, undefined, {
|
|
9861
9967
|
showTimestamp: false,
|
|
9862
9968
|
showArrow: false,
|
|
9863
9969
|
useSymbol: true
|
|
9864
9970
|
});
|
|
9865
|
-
const packageJsonPath =
|
|
9971
|
+
const packageJsonPath = join24(process.cwd(), "package.json");
|
|
9866
9972
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9867
9973
|
const deps = packageJson.dependencies ?? {};
|
|
9868
9974
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9877,13 +9983,13 @@ class MakePubSubCommand {
|
|
|
9877
9983
|
}
|
|
9878
9984
|
}
|
|
9879
9985
|
MakePubSubCommand = __legacyDecorateClassTS([
|
|
9880
|
-
|
|
9986
|
+
decorator24.command()
|
|
9881
9987
|
], MakePubSubCommand);
|
|
9882
9988
|
// src/commands/MakeReleaseCommand.ts
|
|
9883
9989
|
import { readdir } from "fs/promises";
|
|
9884
|
-
import { join as
|
|
9885
|
-
import { decorator as
|
|
9886
|
-
import { TerminalLogger as
|
|
9990
|
+
import { join as join25 } from "path";
|
|
9991
|
+
import { decorator as decorator25 } from "@ooneex/command";
|
|
9992
|
+
import { TerminalLogger as TerminalLogger24 } from "@ooneex/logger";
|
|
9887
9993
|
var {$ } = globalThis.Bun;
|
|
9888
9994
|
var COMMIT_TYPE_TO_CATEGORY = {
|
|
9889
9995
|
feat: "Added",
|
|
@@ -9906,7 +10012,7 @@ class MakeReleaseCommand {
|
|
|
9906
10012
|
return "Release packages with version bump, changelog, and git tag";
|
|
9907
10013
|
}
|
|
9908
10014
|
async run() {
|
|
9909
|
-
const logger = new
|
|
10015
|
+
const logger = new TerminalLogger24;
|
|
9910
10016
|
const cwd = process.cwd();
|
|
9911
10017
|
const dirs = [];
|
|
9912
10018
|
for (const { name, type } of [
|
|
@@ -9914,8 +10020,8 @@ class MakeReleaseCommand {
|
|
|
9914
10020
|
{ name: "modules", type: "module" }
|
|
9915
10021
|
]) {
|
|
9916
10022
|
try {
|
|
9917
|
-
const entries = await readdir(
|
|
9918
|
-
dirs.push(...entries.filter((d) => d.isDirectory()).map((d) => ({ base:
|
|
10023
|
+
const entries = await readdir(join25(cwd, name), { withFileTypes: true });
|
|
10024
|
+
dirs.push(...entries.filter((d) => d.isDirectory()).map((d) => ({ base: join25(name, d.name), type })));
|
|
9919
10025
|
} catch {}
|
|
9920
10026
|
}
|
|
9921
10027
|
const logOptions = { showTimestamp: false, showArrow: false, useSymbol: true };
|
|
@@ -9925,8 +10031,8 @@ class MakeReleaseCommand {
|
|
|
9925
10031
|
}
|
|
9926
10032
|
let releasedCount = 0;
|
|
9927
10033
|
for (const dir of dirs) {
|
|
9928
|
-
const fullDir =
|
|
9929
|
-
const pkgJsonPath =
|
|
10034
|
+
const fullDir = join25(cwd, dir.base);
|
|
10035
|
+
const pkgJsonPath = join25(fullDir, "package.json");
|
|
9930
10036
|
const pkgJsonFile = Bun.file(pkgJsonPath);
|
|
9931
10037
|
if (!await pkgJsonFile.exists()) {
|
|
9932
10038
|
continue;
|
|
@@ -9944,7 +10050,7 @@ class MakeReleaseCommand {
|
|
|
9944
10050
|
await Bun.write(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}
|
|
9945
10051
|
`);
|
|
9946
10052
|
await this.updateChangelog(fullDir, newVersion, tag, commits);
|
|
9947
|
-
await this.gitAdd(
|
|
10053
|
+
await this.gitAdd(join25(dir.base, "package.json"), join25(dir.base, "CHANGELOG.md"));
|
|
9948
10054
|
await this.gitCommit(`chore(release): ${pkgJson.name}@${newVersion}`);
|
|
9949
10055
|
await this.gitTag(tag, `chore(release): ${pkgJson.name}@${newVersion}`);
|
|
9950
10056
|
logger.success(`${pkgJson.name}@${newVersion} released (${bumpType} bump, ${commits.length} commit(s))`, undefined, logOptions);
|
|
@@ -10045,7 +10151,7 @@ class MakeReleaseCommand {
|
|
|
10045
10151
|
}
|
|
10046
10152
|
}
|
|
10047
10153
|
async updateChangelog(dir, version, tag, commits) {
|
|
10048
|
-
const changelogPath =
|
|
10154
|
+
const changelogPath = join25(dir, "CHANGELOG.md");
|
|
10049
10155
|
const today = new Date().toISOString().split("T")[0];
|
|
10050
10156
|
const repoUrl = await this.getRepoUrl();
|
|
10051
10157
|
const grouped = new Map;
|
|
@@ -10122,12 +10228,12 @@ ${section}
|
|
|
10122
10228
|
}
|
|
10123
10229
|
}
|
|
10124
10230
|
MakeReleaseCommand = __legacyDecorateClassTS([
|
|
10125
|
-
|
|
10231
|
+
decorator25.command()
|
|
10126
10232
|
], MakeReleaseCommand);
|
|
10127
10233
|
// src/commands/MakeRepositoryCommand.ts
|
|
10128
|
-
import { join as
|
|
10129
|
-
import { decorator as
|
|
10130
|
-
import { TerminalLogger as
|
|
10234
|
+
import { join as join26 } from "path";
|
|
10235
|
+
import { decorator as decorator26 } from "@ooneex/command";
|
|
10236
|
+
import { TerminalLogger as TerminalLogger25 } from "@ooneex/logger";
|
|
10131
10237
|
import { toPascalCase as toPascalCase14 } from "@ooneex/utils";
|
|
10132
10238
|
|
|
10133
10239
|
// src/templates/repository.test.txt
|
|
@@ -10341,28 +10447,28 @@ class MakeRepositoryCommand {
|
|
|
10341
10447
|
if (module) {
|
|
10342
10448
|
await ensureModule(module);
|
|
10343
10449
|
}
|
|
10344
|
-
const base = module ?
|
|
10345
|
-
const repositoriesLocalDir =
|
|
10346
|
-
const repositoriesDir =
|
|
10347
|
-
const filePath =
|
|
10450
|
+
const base = module ? join26("modules", module) : ".";
|
|
10451
|
+
const repositoriesLocalDir = join26(base, "src", "repositories");
|
|
10452
|
+
const repositoriesDir = join26(process.cwd(), repositoriesLocalDir);
|
|
10453
|
+
const filePath = join26(repositoriesDir, `${name}Repository.ts`);
|
|
10348
10454
|
await Bun.write(filePath, content);
|
|
10349
10455
|
const testContent = repository_test_default.replace(/{{NAME}}/g, name);
|
|
10350
|
-
const testsLocalDir =
|
|
10351
|
-
const testsDir =
|
|
10352
|
-
const testFilePath =
|
|
10456
|
+
const testsLocalDir = join26(base, "tests", "repositories");
|
|
10457
|
+
const testsDir = join26(process.cwd(), testsLocalDir);
|
|
10458
|
+
const testFilePath = join26(testsDir, `${name}Repository.spec.ts`);
|
|
10353
10459
|
await Bun.write(testFilePath, testContent);
|
|
10354
|
-
const logger = new
|
|
10355
|
-
logger.success(`${
|
|
10460
|
+
const logger = new TerminalLogger25;
|
|
10461
|
+
logger.success(`${join26(repositoriesLocalDir, name)}Repository.ts created successfully`, undefined, {
|
|
10356
10462
|
showTimestamp: false,
|
|
10357
10463
|
showArrow: false,
|
|
10358
10464
|
useSymbol: true
|
|
10359
10465
|
});
|
|
10360
|
-
logger.success(`${
|
|
10466
|
+
logger.success(`${join26(testsLocalDir, name)}Repository.spec.ts created successfully`, undefined, {
|
|
10361
10467
|
showTimestamp: false,
|
|
10362
10468
|
showArrow: false,
|
|
10363
10469
|
useSymbol: true
|
|
10364
10470
|
});
|
|
10365
|
-
const packageJsonPath =
|
|
10471
|
+
const packageJsonPath = join26(process.cwd(), "package.json");
|
|
10366
10472
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
10367
10473
|
const deps = packageJson.dependencies ?? {};
|
|
10368
10474
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -10377,11 +10483,11 @@ class MakeRepositoryCommand {
|
|
|
10377
10483
|
}
|
|
10378
10484
|
}
|
|
10379
10485
|
MakeRepositoryCommand = __legacyDecorateClassTS([
|
|
10380
|
-
|
|
10486
|
+
decorator26.command()
|
|
10381
10487
|
], MakeRepositoryCommand);
|
|
10382
10488
|
// src/commands/MakeResourceBookCommand.ts
|
|
10383
|
-
import { join as
|
|
10384
|
-
import { decorator as
|
|
10489
|
+
import { join as join28 } from "path";
|
|
10490
|
+
import { decorator as decorator28 } from "@ooneex/command";
|
|
10385
10491
|
var {Glob } = globalThis.Bun;
|
|
10386
10492
|
|
|
10387
10493
|
// src/templates/resources/book/BookEntity.txt
|
|
@@ -11077,9 +11183,9 @@ export class UpdateBookService implements IService {
|
|
|
11077
11183
|
`;
|
|
11078
11184
|
|
|
11079
11185
|
// src/commands/MakeServiceCommand.ts
|
|
11080
|
-
import { join as
|
|
11081
|
-
import { decorator as
|
|
11082
|
-
import { TerminalLogger as
|
|
11186
|
+
import { join as join27 } from "path";
|
|
11187
|
+
import { decorator as decorator27 } from "@ooneex/command";
|
|
11188
|
+
import { TerminalLogger as TerminalLogger26 } from "@ooneex/logger";
|
|
11083
11189
|
import { toPascalCase as toPascalCase15 } from "@ooneex/utils";
|
|
11084
11190
|
|
|
11085
11191
|
// src/templates/service.test.txt
|
|
@@ -11131,28 +11237,28 @@ class MakeServiceCommand {
|
|
|
11131
11237
|
if (module) {
|
|
11132
11238
|
await ensureModule(module);
|
|
11133
11239
|
}
|
|
11134
|
-
const base = module ?
|
|
11135
|
-
const serviceLocalDir =
|
|
11136
|
-
const serviceDir =
|
|
11137
|
-
const filePath =
|
|
11240
|
+
const base = module ? join27("modules", module) : ".";
|
|
11241
|
+
const serviceLocalDir = join27(base, "src", "services");
|
|
11242
|
+
const serviceDir = join27(process.cwd(), serviceLocalDir);
|
|
11243
|
+
const filePath = join27(serviceDir, `${name}Service.ts`);
|
|
11138
11244
|
await Bun.write(filePath, content);
|
|
11139
11245
|
const testContent = service_test_default.replace(/{{NAME}}/g, name);
|
|
11140
|
-
const testsLocalDir =
|
|
11141
|
-
const testsDir =
|
|
11142
|
-
const testFilePath =
|
|
11246
|
+
const testsLocalDir = join27(base, "tests", "services");
|
|
11247
|
+
const testsDir = join27(process.cwd(), testsLocalDir);
|
|
11248
|
+
const testFilePath = join27(testsDir, `${name}Service.spec.ts`);
|
|
11143
11249
|
await Bun.write(testFilePath, testContent);
|
|
11144
|
-
const logger = new
|
|
11145
|
-
logger.success(`${
|
|
11250
|
+
const logger = new TerminalLogger26;
|
|
11251
|
+
logger.success(`${join27(serviceLocalDir, name)}Service.ts created successfully`, undefined, {
|
|
11146
11252
|
showTimestamp: false,
|
|
11147
11253
|
showArrow: false,
|
|
11148
11254
|
useSymbol: true
|
|
11149
11255
|
});
|
|
11150
|
-
logger.success(`${
|
|
11256
|
+
logger.success(`${join27(testsLocalDir, name)}Service.spec.ts created successfully`, undefined, {
|
|
11151
11257
|
showTimestamp: false,
|
|
11152
11258
|
showArrow: false,
|
|
11153
11259
|
useSymbol: true
|
|
11154
11260
|
});
|
|
11155
|
-
const packageJsonPath =
|
|
11261
|
+
const packageJsonPath = join27(process.cwd(), "package.json");
|
|
11156
11262
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
11157
11263
|
const deps = packageJson.dependencies ?? {};
|
|
11158
11264
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -11167,7 +11273,7 @@ class MakeServiceCommand {
|
|
|
11167
11273
|
}
|
|
11168
11274
|
}
|
|
11169
11275
|
MakeServiceCommand = __legacyDecorateClassTS([
|
|
11170
|
-
|
|
11276
|
+
decorator27.command()
|
|
11171
11277
|
], MakeServiceCommand);
|
|
11172
11278
|
|
|
11173
11279
|
// src/commands/MakeResourceBookCommand.ts
|
|
@@ -11180,9 +11286,9 @@ class MakeResourceBookCommand {
|
|
|
11180
11286
|
}
|
|
11181
11287
|
async run() {
|
|
11182
11288
|
const module = "book";
|
|
11183
|
-
const base =
|
|
11289
|
+
const base = join28("modules", module);
|
|
11184
11290
|
const makeModuleCommand = new MakeModuleCommand;
|
|
11185
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
11291
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
11186
11292
|
const makeEntityCommand = new MakeEntityCommand;
|
|
11187
11293
|
await makeEntityCommand.run({ name: "Book", module, tableName: "books" });
|
|
11188
11294
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -11200,26 +11306,26 @@ class MakeResourceBookCommand {
|
|
|
11200
11306
|
for (const controller of controllers) {
|
|
11201
11307
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
11202
11308
|
}
|
|
11203
|
-
const controllersDir =
|
|
11204
|
-
await Bun.write(
|
|
11205
|
-
await Bun.write(
|
|
11206
|
-
await Bun.write(
|
|
11207
|
-
await Bun.write(
|
|
11208
|
-
await Bun.write(
|
|
11309
|
+
const controllersDir = join28(process.cwd(), base, "src", "controllers");
|
|
11310
|
+
await Bun.write(join28(controllersDir, "CreateBookController.ts"), CreateBookController_default);
|
|
11311
|
+
await Bun.write(join28(controllersDir, "GetBookController.ts"), GetBookController_default);
|
|
11312
|
+
await Bun.write(join28(controllersDir, "ListBooksController.ts"), ListBooksController_default);
|
|
11313
|
+
await Bun.write(join28(controllersDir, "UpdateBookController.ts"), UpdateBookController_default);
|
|
11314
|
+
await Bun.write(join28(controllersDir, "DeleteBookController.ts"), DeleteBookController_default);
|
|
11209
11315
|
const makeServiceCommand = new MakeServiceCommand;
|
|
11210
11316
|
const services = ["CreateBook", "GetBook", "ListBooks", "UpdateBook", "DeleteBook"];
|
|
11211
11317
|
for (const name of services) {
|
|
11212
11318
|
await makeServiceCommand.run({ name, module });
|
|
11213
11319
|
}
|
|
11214
|
-
const servicesDir =
|
|
11215
|
-
await Bun.write(
|
|
11216
|
-
await Bun.write(
|
|
11217
|
-
await Bun.write(
|
|
11218
|
-
await Bun.write(
|
|
11219
|
-
await Bun.write(
|
|
11220
|
-
const entityPath =
|
|
11320
|
+
const servicesDir = join28(process.cwd(), base, "src", "services");
|
|
11321
|
+
await Bun.write(join28(servicesDir, "CreateBookService.ts"), CreateBookService_default);
|
|
11322
|
+
await Bun.write(join28(servicesDir, "GetBookService.ts"), GetBookService_default);
|
|
11323
|
+
await Bun.write(join28(servicesDir, "ListBooksService.ts"), ListBooksService_default);
|
|
11324
|
+
await Bun.write(join28(servicesDir, "UpdateBookService.ts"), UpdateBookService_default);
|
|
11325
|
+
await Bun.write(join28(servicesDir, "DeleteBookService.ts"), DeleteBookService_default);
|
|
11326
|
+
const entityPath = join28(process.cwd(), base, "src", "entities", "BookEntity.ts");
|
|
11221
11327
|
await Bun.write(entityPath, BookEntity_default);
|
|
11222
|
-
const migrationsDir =
|
|
11328
|
+
const migrationsDir = join28(process.cwd(), base, "src", "migrations");
|
|
11223
11329
|
const glob = new Glob("Migration*.ts");
|
|
11224
11330
|
for await (const file of glob.scan(migrationsDir)) {
|
|
11225
11331
|
if (file === "migrations.ts")
|
|
@@ -11227,18 +11333,18 @@ class MakeResourceBookCommand {
|
|
|
11227
11333
|
const name = file.replace(/\.ts$/, "");
|
|
11228
11334
|
const version = name.replace("Migration", "");
|
|
11229
11335
|
const content = BookMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
11230
|
-
await Bun.write(
|
|
11336
|
+
await Bun.write(join28(migrationsDir, file), content);
|
|
11231
11337
|
}
|
|
11232
|
-
const repositoryPath =
|
|
11338
|
+
const repositoryPath = join28(process.cwd(), base, "src", "repositories", "BookRepository.ts");
|
|
11233
11339
|
await Bun.write(repositoryPath, BookRepository_default);
|
|
11234
11340
|
}
|
|
11235
11341
|
}
|
|
11236
11342
|
MakeResourceBookCommand = __legacyDecorateClassTS([
|
|
11237
|
-
|
|
11343
|
+
decorator28.command()
|
|
11238
11344
|
], MakeResourceBookCommand);
|
|
11239
11345
|
// src/commands/MakeResourceCalendarEventCommand.ts
|
|
11240
|
-
import { join as
|
|
11241
|
-
import { decorator as
|
|
11346
|
+
import { join as join29 } from "path";
|
|
11347
|
+
import { decorator as decorator29 } from "@ooneex/command";
|
|
11242
11348
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
11243
11349
|
|
|
11244
11350
|
// src/templates/resources/calendar-event/CalendarEventEntity.txt
|
|
@@ -11930,9 +12036,9 @@ class MakeResourceCalendarEventCommand {
|
|
|
11930
12036
|
}
|
|
11931
12037
|
async run() {
|
|
11932
12038
|
const module = "calendar-event";
|
|
11933
|
-
const base =
|
|
12039
|
+
const base = join29("modules", module);
|
|
11934
12040
|
const makeModuleCommand = new MakeModuleCommand;
|
|
11935
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
12041
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
11936
12042
|
const makeEntityCommand = new MakeEntityCommand;
|
|
11937
12043
|
await makeEntityCommand.run({ name: "CalendarEvent", module, tableName: "calendar_events" });
|
|
11938
12044
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -11965,12 +12071,12 @@ class MakeResourceCalendarEventCommand {
|
|
|
11965
12071
|
for (const controller of controllers) {
|
|
11966
12072
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
11967
12073
|
}
|
|
11968
|
-
const controllersDir =
|
|
11969
|
-
await Bun.write(
|
|
11970
|
-
await Bun.write(
|
|
11971
|
-
await Bun.write(
|
|
11972
|
-
await Bun.write(
|
|
11973
|
-
await Bun.write(
|
|
12074
|
+
const controllersDir = join29(process.cwd(), base, "src", "controllers");
|
|
12075
|
+
await Bun.write(join29(controllersDir, "CreateCalendarEventController.ts"), CreateCalendarEventController_default);
|
|
12076
|
+
await Bun.write(join29(controllersDir, "GetCalendarEventController.ts"), GetCalendarEventController_default);
|
|
12077
|
+
await Bun.write(join29(controllersDir, "ListCalendarEventsController.ts"), ListCalendarEventsController_default);
|
|
12078
|
+
await Bun.write(join29(controllersDir, "UpdateCalendarEventController.ts"), UpdateCalendarEventController_default);
|
|
12079
|
+
await Bun.write(join29(controllersDir, "DeleteCalendarEventController.ts"), DeleteCalendarEventController_default);
|
|
11974
12080
|
const makeServiceCommand = new MakeServiceCommand;
|
|
11975
12081
|
const services = [
|
|
11976
12082
|
"CreateCalendarEvent",
|
|
@@ -11982,15 +12088,15 @@ class MakeResourceCalendarEventCommand {
|
|
|
11982
12088
|
for (const name of services) {
|
|
11983
12089
|
await makeServiceCommand.run({ name, module });
|
|
11984
12090
|
}
|
|
11985
|
-
const servicesDir =
|
|
11986
|
-
await Bun.write(
|
|
11987
|
-
await Bun.write(
|
|
11988
|
-
await Bun.write(
|
|
11989
|
-
await Bun.write(
|
|
11990
|
-
await Bun.write(
|
|
11991
|
-
const entityPath =
|
|
12091
|
+
const servicesDir = join29(process.cwd(), base, "src", "services");
|
|
12092
|
+
await Bun.write(join29(servicesDir, "CreateCalendarEventService.ts"), CreateCalendarEventService_default);
|
|
12093
|
+
await Bun.write(join29(servicesDir, "GetCalendarEventService.ts"), GetCalendarEventService_default);
|
|
12094
|
+
await Bun.write(join29(servicesDir, "ListCalendarEventsService.ts"), ListCalendarEventsService_default);
|
|
12095
|
+
await Bun.write(join29(servicesDir, "UpdateCalendarEventService.ts"), UpdateCalendarEventService_default);
|
|
12096
|
+
await Bun.write(join29(servicesDir, "DeleteCalendarEventService.ts"), DeleteCalendarEventService_default);
|
|
12097
|
+
const entityPath = join29(process.cwd(), base, "src", "entities", "CalendarEventEntity.ts");
|
|
11992
12098
|
await Bun.write(entityPath, CalendarEventEntity_default);
|
|
11993
|
-
const migrationsDir =
|
|
12099
|
+
const migrationsDir = join29(process.cwd(), base, "src", "migrations");
|
|
11994
12100
|
const glob = new Glob2("Migration*.ts");
|
|
11995
12101
|
for await (const file of glob.scan(migrationsDir)) {
|
|
11996
12102
|
if (file === "migrations.ts")
|
|
@@ -11998,18 +12104,18 @@ class MakeResourceCalendarEventCommand {
|
|
|
11998
12104
|
const name = file.replace(/\.ts$/, "");
|
|
11999
12105
|
const version = name.replace("Migration", "");
|
|
12000
12106
|
const content = CalendarEventMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
12001
|
-
await Bun.write(
|
|
12107
|
+
await Bun.write(join29(migrationsDir, file), content);
|
|
12002
12108
|
}
|
|
12003
|
-
const repositoryPath =
|
|
12109
|
+
const repositoryPath = join29(process.cwd(), base, "src", "repositories", "CalendarEventRepository.ts");
|
|
12004
12110
|
await Bun.write(repositoryPath, CalendarEventRepository_default);
|
|
12005
12111
|
}
|
|
12006
12112
|
}
|
|
12007
12113
|
MakeResourceCalendarEventCommand = __legacyDecorateClassTS([
|
|
12008
|
-
|
|
12114
|
+
decorator29.command()
|
|
12009
12115
|
], MakeResourceCalendarEventCommand);
|
|
12010
12116
|
// src/commands/MakeResourceCategoryCommand.ts
|
|
12011
|
-
import { join as
|
|
12012
|
-
import { decorator as
|
|
12117
|
+
import { join as join30 } from "path";
|
|
12118
|
+
import { decorator as decorator30 } from "@ooneex/command";
|
|
12013
12119
|
var {Glob: Glob3 } = globalThis.Bun;
|
|
12014
12120
|
|
|
12015
12121
|
// src/templates/resources/category/CategoryEntity.txt
|
|
@@ -12600,9 +12706,9 @@ class MakeResourceCategoryCommand {
|
|
|
12600
12706
|
}
|
|
12601
12707
|
async run() {
|
|
12602
12708
|
const module = "category";
|
|
12603
|
-
const base =
|
|
12709
|
+
const base = join30("modules", module);
|
|
12604
12710
|
const makeModuleCommand = new MakeModuleCommand;
|
|
12605
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
12711
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
12606
12712
|
const makeEntityCommand = new MakeEntityCommand;
|
|
12607
12713
|
await makeEntityCommand.run({ name: "Category", module, tableName: "categories" });
|
|
12608
12714
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -12635,26 +12741,26 @@ class MakeResourceCategoryCommand {
|
|
|
12635
12741
|
for (const controller of controllers) {
|
|
12636
12742
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
12637
12743
|
}
|
|
12638
|
-
const controllersDir =
|
|
12639
|
-
await Bun.write(
|
|
12640
|
-
await Bun.write(
|
|
12641
|
-
await Bun.write(
|
|
12642
|
-
await Bun.write(
|
|
12643
|
-
await Bun.write(
|
|
12744
|
+
const controllersDir = join30(process.cwd(), base, "src", "controllers");
|
|
12745
|
+
await Bun.write(join30(controllersDir, "CreateCategoryController.ts"), CreateCategoryController_default);
|
|
12746
|
+
await Bun.write(join30(controllersDir, "GetCategoryController.ts"), GetCategoryController_default);
|
|
12747
|
+
await Bun.write(join30(controllersDir, "ListCategoriesController.ts"), ListCategoriesController_default);
|
|
12748
|
+
await Bun.write(join30(controllersDir, "UpdateCategoryController.ts"), UpdateCategoryController_default);
|
|
12749
|
+
await Bun.write(join30(controllersDir, "DeleteCategoryController.ts"), DeleteCategoryController_default);
|
|
12644
12750
|
const makeServiceCommand = new MakeServiceCommand;
|
|
12645
12751
|
const services = ["CreateCategory", "GetCategory", "ListCategories", "UpdateCategory", "DeleteCategory"];
|
|
12646
12752
|
for (const name of services) {
|
|
12647
12753
|
await makeServiceCommand.run({ name, module });
|
|
12648
12754
|
}
|
|
12649
|
-
const servicesDir =
|
|
12650
|
-
await Bun.write(
|
|
12651
|
-
await Bun.write(
|
|
12652
|
-
await Bun.write(
|
|
12653
|
-
await Bun.write(
|
|
12654
|
-
await Bun.write(
|
|
12655
|
-
const entityPath =
|
|
12755
|
+
const servicesDir = join30(process.cwd(), base, "src", "services");
|
|
12756
|
+
await Bun.write(join30(servicesDir, "CreateCategoryService.ts"), CreateCategoryService_default);
|
|
12757
|
+
await Bun.write(join30(servicesDir, "GetCategoryService.ts"), GetCategoryService_default);
|
|
12758
|
+
await Bun.write(join30(servicesDir, "ListCategoriesService.ts"), ListCategoriesService_default);
|
|
12759
|
+
await Bun.write(join30(servicesDir, "UpdateCategoryService.ts"), UpdateCategoryService_default);
|
|
12760
|
+
await Bun.write(join30(servicesDir, "DeleteCategoryService.ts"), DeleteCategoryService_default);
|
|
12761
|
+
const entityPath = join30(process.cwd(), base, "src", "entities", "CategoryEntity.ts");
|
|
12656
12762
|
await Bun.write(entityPath, CategoryEntity_default);
|
|
12657
|
-
const migrationsDir =
|
|
12763
|
+
const migrationsDir = join30(process.cwd(), base, "src", "migrations");
|
|
12658
12764
|
const glob = new Glob3("Migration*.ts");
|
|
12659
12765
|
for await (const file of glob.scan(migrationsDir)) {
|
|
12660
12766
|
if (file === "migrations.ts")
|
|
@@ -12662,18 +12768,18 @@ class MakeResourceCategoryCommand {
|
|
|
12662
12768
|
const name = file.replace(/\.ts$/, "");
|
|
12663
12769
|
const version = name.replace("Migration", "");
|
|
12664
12770
|
const content = CategoryMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
12665
|
-
await Bun.write(
|
|
12771
|
+
await Bun.write(join30(migrationsDir, file), content);
|
|
12666
12772
|
}
|
|
12667
|
-
const repositoryPath =
|
|
12773
|
+
const repositoryPath = join30(process.cwd(), base, "src", "repositories", "CategoryRepository.ts");
|
|
12668
12774
|
await Bun.write(repositoryPath, CategoryRepository_default);
|
|
12669
12775
|
}
|
|
12670
12776
|
}
|
|
12671
12777
|
MakeResourceCategoryCommand = __legacyDecorateClassTS([
|
|
12672
|
-
|
|
12778
|
+
decorator30.command()
|
|
12673
12779
|
], MakeResourceCategoryCommand);
|
|
12674
12780
|
// src/commands/MakeResourceColorCommand.ts
|
|
12675
|
-
import { join as
|
|
12676
|
-
import { decorator as
|
|
12781
|
+
import { join as join32 } from "path";
|
|
12782
|
+
import { decorator as decorator32 } from "@ooneex/command";
|
|
12677
12783
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
12678
12784
|
|
|
12679
12785
|
// src/templates/resources/color/ColorEntity.txt
|
|
@@ -13111,18 +13217,27 @@ export class UpdateColorController {
|
|
|
13111
13217
|
`;
|
|
13112
13218
|
|
|
13113
13219
|
// src/templates/resources/color/seeds/ColorSeed.txt
|
|
13114
|
-
var ColorSeed_default = `import {
|
|
13220
|
+
var ColorSeed_default = `import { inject } from "@ooneex/container";
|
|
13115
13221
|
import { decorator, type ISeed, type SeedClassType } from "@ooneex/seeds";
|
|
13222
|
+
import type { LocaleType } from "@ooneex/translation";
|
|
13116
13223
|
import { ColorEntity } from "../entities/ColorEntity";
|
|
13117
13224
|
import { ColorRepository } from "../repositories/ColorRepository";
|
|
13118
|
-
import data from "./
|
|
13225
|
+
import data from "./color-seed.yml";
|
|
13226
|
+
|
|
13227
|
+
type ColorSeedDataType = {
|
|
13228
|
+
id: string;
|
|
13229
|
+
name: string;
|
|
13230
|
+
hex: string;
|
|
13231
|
+
description?: string;
|
|
13232
|
+
lang?: LocaleType;
|
|
13233
|
+
};
|
|
13119
13234
|
|
|
13120
13235
|
@decorator.seed()
|
|
13121
13236
|
export class ColorSeed implements ISeed {
|
|
13122
|
-
|
|
13123
|
-
const repository = resolve(ColorRepository);
|
|
13237
|
+
constructor(@inject(ColorRepository) private readonly repository: ColorRepository) {}
|
|
13124
13238
|
|
|
13125
|
-
|
|
13239
|
+
public async run<T>(): Promise<T> {
|
|
13240
|
+
const entities = (data as ColorSeedDataType[]).map((item) => {
|
|
13126
13241
|
const entity = new ColorEntity();
|
|
13127
13242
|
entity.id = item.id;
|
|
13128
13243
|
entity.name = item.name;
|
|
@@ -13133,8 +13248,8 @@ export class ColorSeed implements ISeed {
|
|
|
13133
13248
|
return entity;
|
|
13134
13249
|
});
|
|
13135
13250
|
|
|
13136
|
-
const result = await repository.createMany(entities);
|
|
13137
|
-
await repository.close();
|
|
13251
|
+
const result = await this.repository.createMany(entities);
|
|
13252
|
+
await this.repository.close();
|
|
13138
13253
|
|
|
13139
13254
|
return result as T;
|
|
13140
13255
|
}
|
|
@@ -13456,9 +13571,9 @@ export class UpdateColorService implements IService {
|
|
|
13456
13571
|
`;
|
|
13457
13572
|
|
|
13458
13573
|
// src/commands/MakeSeedCommand.ts
|
|
13459
|
-
import { join as
|
|
13460
|
-
import { decorator as
|
|
13461
|
-
import { TerminalLogger as
|
|
13574
|
+
import { join as join31 } from "path";
|
|
13575
|
+
import { decorator as decorator31 } from "@ooneex/command";
|
|
13576
|
+
import { TerminalLogger as TerminalLogger27 } from "@ooneex/logger";
|
|
13462
13577
|
import { seedCreate } from "@ooneex/seeds";
|
|
13463
13578
|
|
|
13464
13579
|
// src/templates/module/seed.run.txt
|
|
@@ -13497,18 +13612,18 @@ class MakeSeedCommand {
|
|
|
13497
13612
|
if (module) {
|
|
13498
13613
|
await ensureModule(module);
|
|
13499
13614
|
}
|
|
13500
|
-
const base = module ?
|
|
13615
|
+
const base = module ? join31("modules", module) : ".";
|
|
13501
13616
|
const { seedPath: filePath, dataPath } = await seedCreate({
|
|
13502
13617
|
name,
|
|
13503
|
-
seedsDir:
|
|
13504
|
-
testsDir:
|
|
13618
|
+
seedsDir: join31(base, "src", "seeds"),
|
|
13619
|
+
testsDir: join31(base, "tests", "seeds")
|
|
13505
13620
|
});
|
|
13506
|
-
const binSeedRunPath =
|
|
13621
|
+
const binSeedRunPath = join31(process.cwd(), base, "bin", "seed", "run.ts");
|
|
13507
13622
|
const binSeedRunFile = Bun.file(binSeedRunPath);
|
|
13508
13623
|
if (!await binSeedRunFile.exists()) {
|
|
13509
13624
|
await Bun.write(binSeedRunPath, seed_run_default.replace(/{{name}}/g, module ?? ""));
|
|
13510
13625
|
}
|
|
13511
|
-
const logger = new
|
|
13626
|
+
const logger = new TerminalLogger27;
|
|
13512
13627
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
13513
13628
|
showTimestamp: false,
|
|
13514
13629
|
showArrow: false,
|
|
@@ -13522,7 +13637,7 @@ class MakeSeedCommand {
|
|
|
13522
13637
|
}
|
|
13523
13638
|
}
|
|
13524
13639
|
MakeSeedCommand = __legacyDecorateClassTS([
|
|
13525
|
-
|
|
13640
|
+
decorator31.command()
|
|
13526
13641
|
], MakeSeedCommand);
|
|
13527
13642
|
|
|
13528
13643
|
// src/commands/MakeResourceColorCommand.ts
|
|
@@ -13535,9 +13650,9 @@ class MakeResourceColorCommand {
|
|
|
13535
13650
|
}
|
|
13536
13651
|
async run() {
|
|
13537
13652
|
const module = "color";
|
|
13538
|
-
const base =
|
|
13653
|
+
const base = join32("modules", module);
|
|
13539
13654
|
const makeModuleCommand = new MakeModuleCommand;
|
|
13540
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
13655
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
13541
13656
|
const makeEntityCommand = new MakeEntityCommand;
|
|
13542
13657
|
await makeEntityCommand.run({ name: "Color", module, tableName: "colors" });
|
|
13543
13658
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -13558,26 +13673,26 @@ class MakeResourceColorCommand {
|
|
|
13558
13673
|
for (const controller of controllers) {
|
|
13559
13674
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
13560
13675
|
}
|
|
13561
|
-
const controllersDir =
|
|
13562
|
-
await Bun.write(
|
|
13563
|
-
await Bun.write(
|
|
13564
|
-
await Bun.write(
|
|
13565
|
-
await Bun.write(
|
|
13566
|
-
await Bun.write(
|
|
13676
|
+
const controllersDir = join32(process.cwd(), base, "src", "controllers");
|
|
13677
|
+
await Bun.write(join32(controllersDir, "CreateColorController.ts"), CreateColorController_default);
|
|
13678
|
+
await Bun.write(join32(controllersDir, "GetColorController.ts"), GetColorController_default);
|
|
13679
|
+
await Bun.write(join32(controllersDir, "ListColorsController.ts"), ListColorsController_default);
|
|
13680
|
+
await Bun.write(join32(controllersDir, "UpdateColorController.ts"), UpdateColorController_default);
|
|
13681
|
+
await Bun.write(join32(controllersDir, "DeleteColorController.ts"), DeleteColorController_default);
|
|
13567
13682
|
const makeServiceCommand = new MakeServiceCommand;
|
|
13568
13683
|
const services = ["CreateColor", "GetColor", "ListColors", "UpdateColor", "DeleteColor"];
|
|
13569
13684
|
for (const name of services) {
|
|
13570
13685
|
await makeServiceCommand.run({ name, module });
|
|
13571
13686
|
}
|
|
13572
|
-
const servicesDir =
|
|
13573
|
-
await Bun.write(
|
|
13574
|
-
await Bun.write(
|
|
13575
|
-
await Bun.write(
|
|
13576
|
-
await Bun.write(
|
|
13577
|
-
await Bun.write(
|
|
13578
|
-
const entityPath =
|
|
13687
|
+
const servicesDir = join32(process.cwd(), base, "src", "services");
|
|
13688
|
+
await Bun.write(join32(servicesDir, "CreateColorService.ts"), CreateColorService_default);
|
|
13689
|
+
await Bun.write(join32(servicesDir, "GetColorService.ts"), GetColorService_default);
|
|
13690
|
+
await Bun.write(join32(servicesDir, "ListColorsService.ts"), ListColorsService_default);
|
|
13691
|
+
await Bun.write(join32(servicesDir, "UpdateColorService.ts"), UpdateColorService_default);
|
|
13692
|
+
await Bun.write(join32(servicesDir, "DeleteColorService.ts"), DeleteColorService_default);
|
|
13693
|
+
const entityPath = join32(process.cwd(), base, "src", "entities", "ColorEntity.ts");
|
|
13579
13694
|
await Bun.write(entityPath, ColorEntity_default);
|
|
13580
|
-
const migrationsDir =
|
|
13695
|
+
const migrationsDir = join32(process.cwd(), base, "src", "migrations");
|
|
13581
13696
|
const glob = new Glob4("Migration*.ts");
|
|
13582
13697
|
for await (const file of glob.scan(migrationsDir)) {
|
|
13583
13698
|
if (file === "migrations.ts")
|
|
@@ -13585,23 +13700,23 @@ class MakeResourceColorCommand {
|
|
|
13585
13700
|
const name = file.replace(/\.ts$/, "");
|
|
13586
13701
|
const version = name.replace("Migration", "");
|
|
13587
13702
|
const content = ColorMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
13588
|
-
await Bun.write(
|
|
13703
|
+
await Bun.write(join32(migrationsDir, file), content);
|
|
13589
13704
|
}
|
|
13590
|
-
const repositoryPath =
|
|
13705
|
+
const repositoryPath = join32(process.cwd(), base, "src", "repositories", "ColorRepository.ts");
|
|
13591
13706
|
await Bun.write(repositoryPath, ColorRepository_default);
|
|
13592
13707
|
const makeSeedCommand = new MakeSeedCommand;
|
|
13593
13708
|
await makeSeedCommand.run({ name: "Color", module });
|
|
13594
|
-
const seedsDir =
|
|
13595
|
-
await Bun.write(
|
|
13596
|
-
await Bun.write(
|
|
13709
|
+
const seedsDir = join32(process.cwd(), base, "src", "seeds");
|
|
13710
|
+
await Bun.write(join32(seedsDir, "ColorSeed.ts"), ColorSeed_default);
|
|
13711
|
+
await Bun.write(join32(seedsDir, "color-seed.yml"), color_seed_default);
|
|
13597
13712
|
}
|
|
13598
13713
|
}
|
|
13599
13714
|
MakeResourceColorCommand = __legacyDecorateClassTS([
|
|
13600
|
-
|
|
13715
|
+
decorator32.command()
|
|
13601
13716
|
], MakeResourceColorCommand);
|
|
13602
13717
|
// src/commands/MakeResourceDiscountCommand.ts
|
|
13603
|
-
import { join as
|
|
13604
|
-
import { decorator as
|
|
13718
|
+
import { join as join33 } from "path";
|
|
13719
|
+
import { decorator as decorator33 } from "@ooneex/command";
|
|
13605
13720
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
13606
13721
|
|
|
13607
13722
|
// src/templates/resources/discount/controllers/CreateDiscountController.txt
|
|
@@ -14244,9 +14359,9 @@ class MakeResourceDiscountCommand {
|
|
|
14244
14359
|
}
|
|
14245
14360
|
async run() {
|
|
14246
14361
|
const module = "discount";
|
|
14247
|
-
const base =
|
|
14362
|
+
const base = join33("modules", module);
|
|
14248
14363
|
const makeModuleCommand = new MakeModuleCommand;
|
|
14249
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
14364
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
14250
14365
|
const makeEntityCommand = new MakeEntityCommand;
|
|
14251
14366
|
await makeEntityCommand.run({ name: "Discount", module, tableName: "discounts" });
|
|
14252
14367
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -14279,26 +14394,26 @@ class MakeResourceDiscountCommand {
|
|
|
14279
14394
|
for (const controller of controllers) {
|
|
14280
14395
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
14281
14396
|
}
|
|
14282
|
-
const controllersDir =
|
|
14283
|
-
await Bun.write(
|
|
14284
|
-
await Bun.write(
|
|
14285
|
-
await Bun.write(
|
|
14286
|
-
await Bun.write(
|
|
14287
|
-
await Bun.write(
|
|
14397
|
+
const controllersDir = join33(process.cwd(), base, "src", "controllers");
|
|
14398
|
+
await Bun.write(join33(controllersDir, "CreateDiscountController.ts"), CreateDiscountController_default);
|
|
14399
|
+
await Bun.write(join33(controllersDir, "GetDiscountController.ts"), GetDiscountController_default);
|
|
14400
|
+
await Bun.write(join33(controllersDir, "ListDiscountsController.ts"), ListDiscountsController_default);
|
|
14401
|
+
await Bun.write(join33(controllersDir, "UpdateDiscountController.ts"), UpdateDiscountController_default);
|
|
14402
|
+
await Bun.write(join33(controllersDir, "DeleteDiscountController.ts"), DeleteDiscountController_default);
|
|
14288
14403
|
const makeServiceCommand = new MakeServiceCommand;
|
|
14289
14404
|
const services = ["CreateDiscount", "GetDiscount", "ListDiscounts", "UpdateDiscount", "DeleteDiscount"];
|
|
14290
14405
|
for (const name of services) {
|
|
14291
14406
|
await makeServiceCommand.run({ name, module });
|
|
14292
14407
|
}
|
|
14293
|
-
const servicesDir =
|
|
14294
|
-
await Bun.write(
|
|
14295
|
-
await Bun.write(
|
|
14296
|
-
await Bun.write(
|
|
14297
|
-
await Bun.write(
|
|
14298
|
-
await Bun.write(
|
|
14299
|
-
const entityPath =
|
|
14408
|
+
const servicesDir = join33(process.cwd(), base, "src", "services");
|
|
14409
|
+
await Bun.write(join33(servicesDir, "CreateDiscountService.ts"), CreateDiscountService_default);
|
|
14410
|
+
await Bun.write(join33(servicesDir, "GetDiscountService.ts"), GetDiscountService_default);
|
|
14411
|
+
await Bun.write(join33(servicesDir, "ListDiscountsService.ts"), ListDiscountsService_default);
|
|
14412
|
+
await Bun.write(join33(servicesDir, "UpdateDiscountService.ts"), UpdateDiscountService_default);
|
|
14413
|
+
await Bun.write(join33(servicesDir, "DeleteDiscountService.ts"), DeleteDiscountService_default);
|
|
14414
|
+
const entityPath = join33(process.cwd(), base, "src", "entities", "DiscountEntity.ts");
|
|
14300
14415
|
await Bun.write(entityPath, DiscountEntity_default);
|
|
14301
|
-
const migrationsDir =
|
|
14416
|
+
const migrationsDir = join33(process.cwd(), base, "src", "migrations");
|
|
14302
14417
|
const glob = new Glob5("Migration*.ts");
|
|
14303
14418
|
for await (const file of glob.scan(migrationsDir)) {
|
|
14304
14419
|
if (file === "migrations.ts")
|
|
@@ -14306,18 +14421,18 @@ class MakeResourceDiscountCommand {
|
|
|
14306
14421
|
const name = file.replace(/\.ts$/, "");
|
|
14307
14422
|
const version = name.replace("Migration", "");
|
|
14308
14423
|
const content = DiscountMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
14309
|
-
await Bun.write(
|
|
14424
|
+
await Bun.write(join33(migrationsDir, file), content);
|
|
14310
14425
|
}
|
|
14311
|
-
const repositoryPath =
|
|
14426
|
+
const repositoryPath = join33(process.cwd(), base, "src", "repositories", "DiscountRepository.ts");
|
|
14312
14427
|
await Bun.write(repositoryPath, DiscountRepository_default);
|
|
14313
14428
|
}
|
|
14314
14429
|
}
|
|
14315
14430
|
MakeResourceDiscountCommand = __legacyDecorateClassTS([
|
|
14316
|
-
|
|
14431
|
+
decorator33.command()
|
|
14317
14432
|
], MakeResourceDiscountCommand);
|
|
14318
14433
|
// src/commands/MakeResourceFolderCommand.ts
|
|
14319
|
-
import { join as
|
|
14320
|
-
import { decorator as
|
|
14434
|
+
import { join as join34 } from "path";
|
|
14435
|
+
import { decorator as decorator34 } from "@ooneex/command";
|
|
14321
14436
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
14322
14437
|
|
|
14323
14438
|
// src/templates/resources/folder/controllers/CreateFolderController.txt
|
|
@@ -14944,9 +15059,9 @@ class MakeResourceFolderCommand {
|
|
|
14944
15059
|
}
|
|
14945
15060
|
async run() {
|
|
14946
15061
|
const module = "folder";
|
|
14947
|
-
const base =
|
|
15062
|
+
const base = join34("modules", module);
|
|
14948
15063
|
const makeModuleCommand = new MakeModuleCommand;
|
|
14949
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
15064
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
14950
15065
|
const makeEntityCommand = new MakeEntityCommand;
|
|
14951
15066
|
await makeEntityCommand.run({ name: "Folder", module, tableName: "folders" });
|
|
14952
15067
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -14979,26 +15094,26 @@ class MakeResourceFolderCommand {
|
|
|
14979
15094
|
for (const controller of controllers) {
|
|
14980
15095
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
14981
15096
|
}
|
|
14982
|
-
const controllersDir =
|
|
14983
|
-
await Bun.write(
|
|
14984
|
-
await Bun.write(
|
|
14985
|
-
await Bun.write(
|
|
14986
|
-
await Bun.write(
|
|
14987
|
-
await Bun.write(
|
|
15097
|
+
const controllersDir = join34(process.cwd(), base, "src", "controllers");
|
|
15098
|
+
await Bun.write(join34(controllersDir, "CreateFolderController.ts"), CreateFolderController_default);
|
|
15099
|
+
await Bun.write(join34(controllersDir, "GetFolderController.ts"), GetFolderController_default);
|
|
15100
|
+
await Bun.write(join34(controllersDir, "ListFoldersController.ts"), ListFoldersController_default);
|
|
15101
|
+
await Bun.write(join34(controllersDir, "UpdateFolderController.ts"), UpdateFolderController_default);
|
|
15102
|
+
await Bun.write(join34(controllersDir, "DeleteFolderController.ts"), DeleteFolderController_default);
|
|
14988
15103
|
const makeServiceCommand = new MakeServiceCommand;
|
|
14989
15104
|
const services = ["CreateFolder", "GetFolder", "ListFolders", "UpdateFolder", "DeleteFolder"];
|
|
14990
15105
|
for (const name of services) {
|
|
14991
15106
|
await makeServiceCommand.run({ name, module });
|
|
14992
15107
|
}
|
|
14993
|
-
const servicesDir =
|
|
14994
|
-
await Bun.write(
|
|
14995
|
-
await Bun.write(
|
|
14996
|
-
await Bun.write(
|
|
14997
|
-
await Bun.write(
|
|
14998
|
-
await Bun.write(
|
|
14999
|
-
const entityPath =
|
|
15108
|
+
const servicesDir = join34(process.cwd(), base, "src", "services");
|
|
15109
|
+
await Bun.write(join34(servicesDir, "CreateFolderService.ts"), CreateFolderService_default);
|
|
15110
|
+
await Bun.write(join34(servicesDir, "GetFolderService.ts"), GetFolderService_default);
|
|
15111
|
+
await Bun.write(join34(servicesDir, "ListFoldersService.ts"), ListFoldersService_default);
|
|
15112
|
+
await Bun.write(join34(servicesDir, "UpdateFolderService.ts"), UpdateFolderService_default);
|
|
15113
|
+
await Bun.write(join34(servicesDir, "DeleteFolderService.ts"), DeleteFolderService_default);
|
|
15114
|
+
const entityPath = join34(process.cwd(), base, "src", "entities", "FolderEntity.ts");
|
|
15000
15115
|
await Bun.write(entityPath, FolderEntity_default);
|
|
15001
|
-
const migrationsDir =
|
|
15116
|
+
const migrationsDir = join34(process.cwd(), base, "src", "migrations");
|
|
15002
15117
|
const glob = new Glob6("Migration*.ts");
|
|
15003
15118
|
for await (const file of glob.scan(migrationsDir)) {
|
|
15004
15119
|
if (file === "migrations.ts")
|
|
@@ -15006,18 +15121,18 @@ class MakeResourceFolderCommand {
|
|
|
15006
15121
|
const name = file.replace(/\.ts$/, "");
|
|
15007
15122
|
const version = name.replace("Migration", "");
|
|
15008
15123
|
const content = FolderMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
15009
|
-
await Bun.write(
|
|
15124
|
+
await Bun.write(join34(migrationsDir, file), content);
|
|
15010
15125
|
}
|
|
15011
|
-
const repositoryPath =
|
|
15126
|
+
const repositoryPath = join34(process.cwd(), base, "src", "repositories", "FolderRepository.ts");
|
|
15012
15127
|
await Bun.write(repositoryPath, FolderRepository_default);
|
|
15013
15128
|
}
|
|
15014
15129
|
}
|
|
15015
15130
|
MakeResourceFolderCommand = __legacyDecorateClassTS([
|
|
15016
|
-
|
|
15131
|
+
decorator34.command()
|
|
15017
15132
|
], MakeResourceFolderCommand);
|
|
15018
15133
|
// src/commands/MakeResourceImageCommand.ts
|
|
15019
|
-
import { join as
|
|
15020
|
-
import { decorator as
|
|
15134
|
+
import { join as join35 } from "path";
|
|
15135
|
+
import { decorator as decorator35 } from "@ooneex/command";
|
|
15021
15136
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
15022
15137
|
|
|
15023
15138
|
// src/templates/resources/image/controllers/CreateImageController.txt
|
|
@@ -15683,9 +15798,9 @@ class MakeResourceImageCommand {
|
|
|
15683
15798
|
}
|
|
15684
15799
|
async run() {
|
|
15685
15800
|
const module = "image";
|
|
15686
|
-
const base =
|
|
15801
|
+
const base = join35("modules", module);
|
|
15687
15802
|
const makeModuleCommand = new MakeModuleCommand;
|
|
15688
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
15803
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
15689
15804
|
const makeEntityCommand = new MakeEntityCommand;
|
|
15690
15805
|
await makeEntityCommand.run({ name: "Image", module, tableName: "images" });
|
|
15691
15806
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -15718,26 +15833,26 @@ class MakeResourceImageCommand {
|
|
|
15718
15833
|
for (const controller of controllers) {
|
|
15719
15834
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
15720
15835
|
}
|
|
15721
|
-
const controllersDir =
|
|
15722
|
-
await Bun.write(
|
|
15723
|
-
await Bun.write(
|
|
15724
|
-
await Bun.write(
|
|
15725
|
-
await Bun.write(
|
|
15726
|
-
await Bun.write(
|
|
15836
|
+
const controllersDir = join35(process.cwd(), base, "src", "controllers");
|
|
15837
|
+
await Bun.write(join35(controllersDir, "CreateImageController.ts"), CreateImageController_default);
|
|
15838
|
+
await Bun.write(join35(controllersDir, "GetImageController.ts"), GetImageController_default);
|
|
15839
|
+
await Bun.write(join35(controllersDir, "ListImagesController.ts"), ListImagesController_default);
|
|
15840
|
+
await Bun.write(join35(controllersDir, "UpdateImageController.ts"), UpdateImageController_default);
|
|
15841
|
+
await Bun.write(join35(controllersDir, "DeleteImageController.ts"), DeleteImageController_default);
|
|
15727
15842
|
const makeServiceCommand = new MakeServiceCommand;
|
|
15728
15843
|
const services = ["CreateImage", "GetImage", "ListImages", "UpdateImage", "DeleteImage"];
|
|
15729
15844
|
for (const name of services) {
|
|
15730
15845
|
await makeServiceCommand.run({ name, module });
|
|
15731
15846
|
}
|
|
15732
|
-
const servicesDir =
|
|
15733
|
-
await Bun.write(
|
|
15734
|
-
await Bun.write(
|
|
15735
|
-
await Bun.write(
|
|
15736
|
-
await Bun.write(
|
|
15737
|
-
await Bun.write(
|
|
15738
|
-
const entityPath =
|
|
15847
|
+
const servicesDir = join35(process.cwd(), base, "src", "services");
|
|
15848
|
+
await Bun.write(join35(servicesDir, "CreateImageService.ts"), CreateImageService_default);
|
|
15849
|
+
await Bun.write(join35(servicesDir, "GetImageService.ts"), GetImageService_default);
|
|
15850
|
+
await Bun.write(join35(servicesDir, "ListImagesService.ts"), ListImagesService_default);
|
|
15851
|
+
await Bun.write(join35(servicesDir, "UpdateImageService.ts"), UpdateImageService_default);
|
|
15852
|
+
await Bun.write(join35(servicesDir, "DeleteImageService.ts"), DeleteImageService_default);
|
|
15853
|
+
const entityPath = join35(process.cwd(), base, "src", "entities", "ImageEntity.ts");
|
|
15739
15854
|
await Bun.write(entityPath, ImageEntity_default);
|
|
15740
|
-
const migrationsDir =
|
|
15855
|
+
const migrationsDir = join35(process.cwd(), base, "src", "migrations");
|
|
15741
15856
|
const glob = new Glob7("Migration*.ts");
|
|
15742
15857
|
for await (const file of glob.scan(migrationsDir)) {
|
|
15743
15858
|
if (file === "migrations.ts")
|
|
@@ -15745,18 +15860,18 @@ class MakeResourceImageCommand {
|
|
|
15745
15860
|
const name = file.replace(/\.ts$/, "");
|
|
15746
15861
|
const version = name.replace("Migration", "");
|
|
15747
15862
|
const content = ImageMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
15748
|
-
await Bun.write(
|
|
15863
|
+
await Bun.write(join35(migrationsDir, file), content);
|
|
15749
15864
|
}
|
|
15750
|
-
const repositoryPath =
|
|
15865
|
+
const repositoryPath = join35(process.cwd(), base, "src", "repositories", "ImageRepository.ts");
|
|
15751
15866
|
await Bun.write(repositoryPath, ImageRepository_default);
|
|
15752
15867
|
}
|
|
15753
15868
|
}
|
|
15754
15869
|
MakeResourceImageCommand = __legacyDecorateClassTS([
|
|
15755
|
-
|
|
15870
|
+
decorator35.command()
|
|
15756
15871
|
], MakeResourceImageCommand);
|
|
15757
15872
|
// src/commands/MakeResourceNoteCommand.ts
|
|
15758
|
-
import { join as
|
|
15759
|
-
import { decorator as
|
|
15873
|
+
import { join as join36 } from "path";
|
|
15874
|
+
import { decorator as decorator36 } from "@ooneex/command";
|
|
15760
15875
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15761
15876
|
|
|
15762
15877
|
// src/templates/resources/note/controllers/CreateNoteController.txt
|
|
@@ -16461,9 +16576,9 @@ class MakeResourceNoteCommand {
|
|
|
16461
16576
|
}
|
|
16462
16577
|
async run() {
|
|
16463
16578
|
const module = "note";
|
|
16464
|
-
const base =
|
|
16579
|
+
const base = join36("modules", module);
|
|
16465
16580
|
const makeModuleCommand = new MakeModuleCommand;
|
|
16466
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
16581
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
16467
16582
|
const makeEntityCommand = new MakeEntityCommand;
|
|
16468
16583
|
await makeEntityCommand.run({ name: "Note", module, tableName: "notes" });
|
|
16469
16584
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -16496,26 +16611,26 @@ class MakeResourceNoteCommand {
|
|
|
16496
16611
|
for (const controller of controllers) {
|
|
16497
16612
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
16498
16613
|
}
|
|
16499
|
-
const controllersDir =
|
|
16500
|
-
await Bun.write(
|
|
16501
|
-
await Bun.write(
|
|
16502
|
-
await Bun.write(
|
|
16503
|
-
await Bun.write(
|
|
16504
|
-
await Bun.write(
|
|
16614
|
+
const controllersDir = join36(process.cwd(), base, "src", "controllers");
|
|
16615
|
+
await Bun.write(join36(controllersDir, "CreateNoteController.ts"), CreateNoteController_default);
|
|
16616
|
+
await Bun.write(join36(controllersDir, "GetNoteController.ts"), GetNoteController_default);
|
|
16617
|
+
await Bun.write(join36(controllersDir, "ListNotesController.ts"), ListNotesController_default);
|
|
16618
|
+
await Bun.write(join36(controllersDir, "UpdateNoteController.ts"), UpdateNoteController_default);
|
|
16619
|
+
await Bun.write(join36(controllersDir, "DeleteNoteController.ts"), DeleteNoteController_default);
|
|
16505
16620
|
const makeServiceCommand = new MakeServiceCommand;
|
|
16506
16621
|
const services = ["CreateNote", "GetNote", "ListNotes", "UpdateNote", "DeleteNote"];
|
|
16507
16622
|
for (const name of services) {
|
|
16508
16623
|
await makeServiceCommand.run({ name, module });
|
|
16509
16624
|
}
|
|
16510
|
-
const servicesDir =
|
|
16511
|
-
await Bun.write(
|
|
16512
|
-
await Bun.write(
|
|
16513
|
-
await Bun.write(
|
|
16514
|
-
await Bun.write(
|
|
16515
|
-
await Bun.write(
|
|
16516
|
-
const entityPath =
|
|
16625
|
+
const servicesDir = join36(process.cwd(), base, "src", "services");
|
|
16626
|
+
await Bun.write(join36(servicesDir, "CreateNoteService.ts"), CreateNoteService_default);
|
|
16627
|
+
await Bun.write(join36(servicesDir, "GetNoteService.ts"), GetNoteService_default);
|
|
16628
|
+
await Bun.write(join36(servicesDir, "ListNotesService.ts"), ListNotesService_default);
|
|
16629
|
+
await Bun.write(join36(servicesDir, "UpdateNoteService.ts"), UpdateNoteService_default);
|
|
16630
|
+
await Bun.write(join36(servicesDir, "DeleteNoteService.ts"), DeleteNoteService_default);
|
|
16631
|
+
const entityPath = join36(process.cwd(), base, "src", "entities", "NoteEntity.ts");
|
|
16517
16632
|
await Bun.write(entityPath, NoteEntity_default);
|
|
16518
|
-
const migrationsDir =
|
|
16633
|
+
const migrationsDir = join36(process.cwd(), base, "src", "migrations");
|
|
16519
16634
|
const glob = new Glob8("Migration*.ts");
|
|
16520
16635
|
for await (const file of glob.scan(migrationsDir)) {
|
|
16521
16636
|
if (file === "migrations.ts")
|
|
@@ -16523,18 +16638,18 @@ class MakeResourceNoteCommand {
|
|
|
16523
16638
|
const name = file.replace(/\.ts$/, "");
|
|
16524
16639
|
const version = name.replace("Migration", "");
|
|
16525
16640
|
const content = NoteMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
16526
|
-
await Bun.write(
|
|
16641
|
+
await Bun.write(join36(migrationsDir, file), content);
|
|
16527
16642
|
}
|
|
16528
|
-
const repositoryPath =
|
|
16643
|
+
const repositoryPath = join36(process.cwd(), base, "src", "repositories", "NoteRepository.ts");
|
|
16529
16644
|
await Bun.write(repositoryPath, NoteRepository_default);
|
|
16530
16645
|
}
|
|
16531
16646
|
}
|
|
16532
16647
|
MakeResourceNoteCommand = __legacyDecorateClassTS([
|
|
16533
|
-
|
|
16648
|
+
decorator36.command()
|
|
16534
16649
|
], MakeResourceNoteCommand);
|
|
16535
16650
|
// src/commands/MakeResourceStatusCommand.ts
|
|
16536
|
-
import { join as
|
|
16537
|
-
import { decorator as
|
|
16651
|
+
import { join as join37 } from "path";
|
|
16652
|
+
import { decorator as decorator37 } from "@ooneex/command";
|
|
16538
16653
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
16539
16654
|
|
|
16540
16655
|
// src/templates/resources/status/controllers/CreateStatusController.txt
|
|
@@ -16968,18 +17083,27 @@ export class StatusRepository {
|
|
|
16968
17083
|
`;
|
|
16969
17084
|
|
|
16970
17085
|
// src/templates/resources/status/seeds/StatusSeed.txt
|
|
16971
|
-
var StatusSeed_default = `import {
|
|
17086
|
+
var StatusSeed_default = `import { inject } from "@ooneex/container";
|
|
16972
17087
|
import { decorator, type ISeed, type SeedClassType } from "@ooneex/seeds";
|
|
17088
|
+
import type { LocaleType } from "@ooneex/translation";
|
|
16973
17089
|
import { StatusEntity } from "../entities/StatusEntity";
|
|
16974
17090
|
import { StatusRepository } from "../repositories/StatusRepository";
|
|
16975
|
-
import data from "./
|
|
17091
|
+
import data from "./status-seed.yml";
|
|
17092
|
+
|
|
17093
|
+
type StatusSeedDataType = {
|
|
17094
|
+
id: string;
|
|
17095
|
+
name: string;
|
|
17096
|
+
color?: string;
|
|
17097
|
+
description?: string;
|
|
17098
|
+
lang?: LocaleType;
|
|
17099
|
+
};
|
|
16976
17100
|
|
|
16977
17101
|
@decorator.seed()
|
|
16978
17102
|
export class StatusSeed implements ISeed {
|
|
16979
|
-
|
|
16980
|
-
const repository = resolve(StatusRepository);
|
|
17103
|
+
constructor(@inject(StatusRepository) private readonly repository: StatusRepository) {}
|
|
16981
17104
|
|
|
16982
|
-
|
|
17105
|
+
public async run<T>(): Promise<T> {
|
|
17106
|
+
const entities = (data as StatusSeedDataType[]).map((item) => {
|
|
16983
17107
|
const entity = new StatusEntity();
|
|
16984
17108
|
entity.id = item.id;
|
|
16985
17109
|
entity.name = item.name;
|
|
@@ -16990,8 +17114,8 @@ export class StatusSeed implements ISeed {
|
|
|
16990
17114
|
return entity;
|
|
16991
17115
|
});
|
|
16992
17116
|
|
|
16993
|
-
const result = await repository.createMany(entities);
|
|
16994
|
-
await repository.close();
|
|
17117
|
+
const result = await this.repository.createMany(entities);
|
|
17118
|
+
await this.repository.close();
|
|
16995
17119
|
|
|
16996
17120
|
return result as T;
|
|
16997
17121
|
}
|
|
@@ -17386,9 +17510,9 @@ class MakeResourceStatusCommand {
|
|
|
17386
17510
|
}
|
|
17387
17511
|
async run() {
|
|
17388
17512
|
const module = "status";
|
|
17389
|
-
const base =
|
|
17513
|
+
const base = join37("modules", module);
|
|
17390
17514
|
const makeModuleCommand = new MakeModuleCommand;
|
|
17391
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
17515
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
17392
17516
|
const makeEntityCommand = new MakeEntityCommand;
|
|
17393
17517
|
await makeEntityCommand.run({ name: "Status", module, tableName: "statuses" });
|
|
17394
17518
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -17421,26 +17545,26 @@ class MakeResourceStatusCommand {
|
|
|
17421
17545
|
for (const controller of controllers) {
|
|
17422
17546
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
17423
17547
|
}
|
|
17424
|
-
const controllersDir =
|
|
17425
|
-
await Bun.write(
|
|
17426
|
-
await Bun.write(
|
|
17427
|
-
await Bun.write(
|
|
17428
|
-
await Bun.write(
|
|
17429
|
-
await Bun.write(
|
|
17548
|
+
const controllersDir = join37(process.cwd(), base, "src", "controllers");
|
|
17549
|
+
await Bun.write(join37(controllersDir, "CreateStatusController.ts"), CreateStatusController_default);
|
|
17550
|
+
await Bun.write(join37(controllersDir, "GetStatusController.ts"), GetStatusController_default);
|
|
17551
|
+
await Bun.write(join37(controllersDir, "ListStatusesController.ts"), ListStatusesController_default);
|
|
17552
|
+
await Bun.write(join37(controllersDir, "UpdateStatusController.ts"), UpdateStatusController_default);
|
|
17553
|
+
await Bun.write(join37(controllersDir, "DeleteStatusController.ts"), DeleteStatusController_default);
|
|
17430
17554
|
const makeServiceCommand = new MakeServiceCommand;
|
|
17431
17555
|
const services = ["CreateStatus", "GetStatus", "ListStatuses", "UpdateStatus", "DeleteStatus"];
|
|
17432
17556
|
for (const name of services) {
|
|
17433
17557
|
await makeServiceCommand.run({ name, module });
|
|
17434
17558
|
}
|
|
17435
|
-
const servicesDir =
|
|
17436
|
-
await Bun.write(
|
|
17437
|
-
await Bun.write(
|
|
17438
|
-
await Bun.write(
|
|
17439
|
-
await Bun.write(
|
|
17440
|
-
await Bun.write(
|
|
17441
|
-
const entityPath =
|
|
17559
|
+
const servicesDir = join37(process.cwd(), base, "src", "services");
|
|
17560
|
+
await Bun.write(join37(servicesDir, "CreateStatusService.ts"), CreateStatusService_default);
|
|
17561
|
+
await Bun.write(join37(servicesDir, "GetStatusService.ts"), GetStatusService_default);
|
|
17562
|
+
await Bun.write(join37(servicesDir, "ListStatusesService.ts"), ListStatusesService_default);
|
|
17563
|
+
await Bun.write(join37(servicesDir, "UpdateStatusService.ts"), UpdateStatusService_default);
|
|
17564
|
+
await Bun.write(join37(servicesDir, "DeleteStatusService.ts"), DeleteStatusService_default);
|
|
17565
|
+
const entityPath = join37(process.cwd(), base, "src", "entities", "StatusEntity.ts");
|
|
17442
17566
|
await Bun.write(entityPath, StatusEntity_default);
|
|
17443
|
-
const migrationsDir =
|
|
17567
|
+
const migrationsDir = join37(process.cwd(), base, "src", "migrations");
|
|
17444
17568
|
const glob = new Glob9("Migration*.ts");
|
|
17445
17569
|
for await (const file of glob.scan(migrationsDir)) {
|
|
17446
17570
|
if (file === "migrations.ts")
|
|
@@ -17448,23 +17572,23 @@ class MakeResourceStatusCommand {
|
|
|
17448
17572
|
const name = file.replace(/\.ts$/, "");
|
|
17449
17573
|
const version = name.replace("Migration", "");
|
|
17450
17574
|
const content = StatusMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
17451
|
-
await Bun.write(
|
|
17575
|
+
await Bun.write(join37(migrationsDir, file), content);
|
|
17452
17576
|
}
|
|
17453
|
-
const repositoryPath =
|
|
17577
|
+
const repositoryPath = join37(process.cwd(), base, "src", "repositories", "StatusRepository.ts");
|
|
17454
17578
|
await Bun.write(repositoryPath, StatusRepository_default);
|
|
17455
17579
|
const makeSeedCommand = new MakeSeedCommand;
|
|
17456
17580
|
await makeSeedCommand.run({ name: "Status", module });
|
|
17457
|
-
const seedsDir =
|
|
17458
|
-
await Bun.write(
|
|
17459
|
-
await Bun.write(
|
|
17581
|
+
const seedsDir = join37(process.cwd(), base, "src", "seeds");
|
|
17582
|
+
await Bun.write(join37(seedsDir, "StatusSeed.ts"), StatusSeed_default);
|
|
17583
|
+
await Bun.write(join37(seedsDir, "status-seed.yml"), status_seed_default);
|
|
17460
17584
|
}
|
|
17461
17585
|
}
|
|
17462
17586
|
MakeResourceStatusCommand = __legacyDecorateClassTS([
|
|
17463
|
-
|
|
17587
|
+
decorator37.command()
|
|
17464
17588
|
], MakeResourceStatusCommand);
|
|
17465
17589
|
// src/commands/MakeResourceTagCommand.ts
|
|
17466
|
-
import { join as
|
|
17467
|
-
import { decorator as
|
|
17590
|
+
import { join as join38 } from "path";
|
|
17591
|
+
import { decorator as decorator38 } from "@ooneex/command";
|
|
17468
17592
|
var {Glob: Glob10 } = globalThis.Bun;
|
|
17469
17593
|
|
|
17470
17594
|
// src/templates/resources/tag/controllers/CreateTagController.txt
|
|
@@ -18055,9 +18179,9 @@ class MakeResourceTagCommand {
|
|
|
18055
18179
|
}
|
|
18056
18180
|
async run() {
|
|
18057
18181
|
const module = "tag";
|
|
18058
|
-
const base =
|
|
18182
|
+
const base = join38("modules", module);
|
|
18059
18183
|
const makeModuleCommand = new MakeModuleCommand;
|
|
18060
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
18184
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
18061
18185
|
const makeEntityCommand = new MakeEntityCommand;
|
|
18062
18186
|
await makeEntityCommand.run({ name: "Tag", module, tableName: "tags" });
|
|
18063
18187
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -18090,26 +18214,26 @@ class MakeResourceTagCommand {
|
|
|
18090
18214
|
for (const controller of controllers) {
|
|
18091
18215
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
18092
18216
|
}
|
|
18093
|
-
const controllersDir =
|
|
18094
|
-
await Bun.write(
|
|
18095
|
-
await Bun.write(
|
|
18096
|
-
await Bun.write(
|
|
18097
|
-
await Bun.write(
|
|
18098
|
-
await Bun.write(
|
|
18217
|
+
const controllersDir = join38(process.cwd(), base, "src", "controllers");
|
|
18218
|
+
await Bun.write(join38(controllersDir, "CreateTagController.ts"), CreateTagController_default);
|
|
18219
|
+
await Bun.write(join38(controllersDir, "GetTagController.ts"), GetTagController_default);
|
|
18220
|
+
await Bun.write(join38(controllersDir, "ListTagsController.ts"), ListTagsController_default);
|
|
18221
|
+
await Bun.write(join38(controllersDir, "UpdateTagController.ts"), UpdateTagController_default);
|
|
18222
|
+
await Bun.write(join38(controllersDir, "DeleteTagController.ts"), DeleteTagController_default);
|
|
18099
18223
|
const makeServiceCommand = new MakeServiceCommand;
|
|
18100
18224
|
const services = ["CreateTag", "GetTag", "ListTags", "UpdateTag", "DeleteTag"];
|
|
18101
18225
|
for (const name of services) {
|
|
18102
18226
|
await makeServiceCommand.run({ name, module });
|
|
18103
18227
|
}
|
|
18104
|
-
const servicesDir =
|
|
18105
|
-
await Bun.write(
|
|
18106
|
-
await Bun.write(
|
|
18107
|
-
await Bun.write(
|
|
18108
|
-
await Bun.write(
|
|
18109
|
-
await Bun.write(
|
|
18110
|
-
const entityPath =
|
|
18228
|
+
const servicesDir = join38(process.cwd(), base, "src", "services");
|
|
18229
|
+
await Bun.write(join38(servicesDir, "CreateTagService.ts"), CreateTagService_default);
|
|
18230
|
+
await Bun.write(join38(servicesDir, "GetTagService.ts"), GetTagService_default);
|
|
18231
|
+
await Bun.write(join38(servicesDir, "ListTagsService.ts"), ListTagsService_default);
|
|
18232
|
+
await Bun.write(join38(servicesDir, "UpdateTagService.ts"), UpdateTagService_default);
|
|
18233
|
+
await Bun.write(join38(servicesDir, "DeleteTagService.ts"), DeleteTagService_default);
|
|
18234
|
+
const entityPath = join38(process.cwd(), base, "src", "entities", "TagEntity.ts");
|
|
18111
18235
|
await Bun.write(entityPath, TagEntity_default);
|
|
18112
|
-
const migrationsDir =
|
|
18236
|
+
const migrationsDir = join38(process.cwd(), base, "src", "migrations");
|
|
18113
18237
|
const glob = new Glob10("Migration*.ts");
|
|
18114
18238
|
for await (const file of glob.scan(migrationsDir)) {
|
|
18115
18239
|
if (file === "migrations.ts")
|
|
@@ -18117,18 +18241,18 @@ class MakeResourceTagCommand {
|
|
|
18117
18241
|
const name = file.replace(/\.ts$/, "");
|
|
18118
18242
|
const version = name.replace("Migration", "");
|
|
18119
18243
|
const content = TagMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
18120
|
-
await Bun.write(
|
|
18244
|
+
await Bun.write(join38(migrationsDir, file), content);
|
|
18121
18245
|
}
|
|
18122
|
-
const repositoryPath =
|
|
18246
|
+
const repositoryPath = join38(process.cwd(), base, "src", "repositories", "TagRepository.ts");
|
|
18123
18247
|
await Bun.write(repositoryPath, TagRepository_default);
|
|
18124
18248
|
}
|
|
18125
18249
|
}
|
|
18126
18250
|
MakeResourceTagCommand = __legacyDecorateClassTS([
|
|
18127
|
-
|
|
18251
|
+
decorator38.command()
|
|
18128
18252
|
], MakeResourceTagCommand);
|
|
18129
18253
|
// src/commands/MakeResourceTaskCommand.ts
|
|
18130
|
-
import { join as
|
|
18131
|
-
import { decorator as
|
|
18254
|
+
import { join as join39 } from "path";
|
|
18255
|
+
import { decorator as decorator39 } from "@ooneex/command";
|
|
18132
18256
|
var {Glob: Glob11 } = globalThis.Bun;
|
|
18133
18257
|
|
|
18134
18258
|
// src/templates/resources/task/controllers/CreateTaskController.txt
|
|
@@ -18801,9 +18925,9 @@ class MakeResourceTaskCommand {
|
|
|
18801
18925
|
}
|
|
18802
18926
|
async run() {
|
|
18803
18927
|
const module = "task";
|
|
18804
|
-
const base =
|
|
18928
|
+
const base = join39("modules", module);
|
|
18805
18929
|
const makeModuleCommand = new MakeModuleCommand;
|
|
18806
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
18930
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
18807
18931
|
const makeEntityCommand = new MakeEntityCommand;
|
|
18808
18932
|
await makeEntityCommand.run({ name: "Task", module, tableName: "tasks" });
|
|
18809
18933
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -18836,26 +18960,26 @@ class MakeResourceTaskCommand {
|
|
|
18836
18960
|
for (const controller of controllers) {
|
|
18837
18961
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
18838
18962
|
}
|
|
18839
|
-
const controllersDir =
|
|
18840
|
-
await Bun.write(
|
|
18841
|
-
await Bun.write(
|
|
18842
|
-
await Bun.write(
|
|
18843
|
-
await Bun.write(
|
|
18844
|
-
await Bun.write(
|
|
18963
|
+
const controllersDir = join39(process.cwd(), base, "src", "controllers");
|
|
18964
|
+
await Bun.write(join39(controllersDir, "CreateTaskController.ts"), CreateTaskController_default);
|
|
18965
|
+
await Bun.write(join39(controllersDir, "GetTaskController.ts"), GetTaskController_default);
|
|
18966
|
+
await Bun.write(join39(controllersDir, "ListTasksController.ts"), ListTasksController_default);
|
|
18967
|
+
await Bun.write(join39(controllersDir, "UpdateTaskController.ts"), UpdateTaskController_default);
|
|
18968
|
+
await Bun.write(join39(controllersDir, "DeleteTaskController.ts"), DeleteTaskController_default);
|
|
18845
18969
|
const makeServiceCommand = new MakeServiceCommand;
|
|
18846
18970
|
const services = ["CreateTask", "GetTask", "ListTasks", "UpdateTask", "DeleteTask"];
|
|
18847
18971
|
for (const name of services) {
|
|
18848
18972
|
await makeServiceCommand.run({ name, module });
|
|
18849
18973
|
}
|
|
18850
|
-
const servicesDir =
|
|
18851
|
-
await Bun.write(
|
|
18852
|
-
await Bun.write(
|
|
18853
|
-
await Bun.write(
|
|
18854
|
-
await Bun.write(
|
|
18855
|
-
await Bun.write(
|
|
18856
|
-
const entityPath =
|
|
18974
|
+
const servicesDir = join39(process.cwd(), base, "src", "services");
|
|
18975
|
+
await Bun.write(join39(servicesDir, "CreateTaskService.ts"), CreateTaskService_default);
|
|
18976
|
+
await Bun.write(join39(servicesDir, "GetTaskService.ts"), GetTaskService_default);
|
|
18977
|
+
await Bun.write(join39(servicesDir, "ListTasksService.ts"), ListTasksService_default);
|
|
18978
|
+
await Bun.write(join39(servicesDir, "UpdateTaskService.ts"), UpdateTaskService_default);
|
|
18979
|
+
await Bun.write(join39(servicesDir, "DeleteTaskService.ts"), DeleteTaskService_default);
|
|
18980
|
+
const entityPath = join39(process.cwd(), base, "src", "entities", "TaskEntity.ts");
|
|
18857
18981
|
await Bun.write(entityPath, TaskEntity_default);
|
|
18858
|
-
const migrationsDir =
|
|
18982
|
+
const migrationsDir = join39(process.cwd(), base, "src", "migrations");
|
|
18859
18983
|
const glob = new Glob11("Migration*.ts");
|
|
18860
18984
|
for await (const file of glob.scan(migrationsDir)) {
|
|
18861
18985
|
if (file === "migrations.ts")
|
|
@@ -18863,18 +18987,18 @@ class MakeResourceTaskCommand {
|
|
|
18863
18987
|
const name = file.replace(/\.ts$/, "");
|
|
18864
18988
|
const version = name.replace("Migration", "");
|
|
18865
18989
|
const content = TaskMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
18866
|
-
await Bun.write(
|
|
18990
|
+
await Bun.write(join39(migrationsDir, file), content);
|
|
18867
18991
|
}
|
|
18868
|
-
const repositoryPath =
|
|
18992
|
+
const repositoryPath = join39(process.cwd(), base, "src", "repositories", "TaskRepository.ts");
|
|
18869
18993
|
await Bun.write(repositoryPath, TaskRepository_default);
|
|
18870
18994
|
}
|
|
18871
18995
|
}
|
|
18872
18996
|
MakeResourceTaskCommand = __legacyDecorateClassTS([
|
|
18873
|
-
|
|
18997
|
+
decorator39.command()
|
|
18874
18998
|
], MakeResourceTaskCommand);
|
|
18875
18999
|
// src/commands/MakeResourceTopicCommand.ts
|
|
18876
|
-
import { join as
|
|
18877
|
-
import { decorator as
|
|
19000
|
+
import { join as join40 } from "path";
|
|
19001
|
+
import { decorator as decorator40 } from "@ooneex/command";
|
|
18878
19002
|
var {Glob: Glob12 } = globalThis.Bun;
|
|
18879
19003
|
|
|
18880
19004
|
// src/templates/resources/topic/controllers/CreateTopicController.txt
|
|
@@ -19465,9 +19589,9 @@ class MakeResourceTopicCommand {
|
|
|
19465
19589
|
}
|
|
19466
19590
|
async run() {
|
|
19467
19591
|
const module = "topic";
|
|
19468
|
-
const base =
|
|
19592
|
+
const base = join40("modules", module);
|
|
19469
19593
|
const makeModuleCommand = new MakeModuleCommand;
|
|
19470
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
19594
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
19471
19595
|
const makeEntityCommand = new MakeEntityCommand;
|
|
19472
19596
|
await makeEntityCommand.run({ name: "Topic", module, tableName: "topics" });
|
|
19473
19597
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -19500,26 +19624,26 @@ class MakeResourceTopicCommand {
|
|
|
19500
19624
|
for (const controller of controllers) {
|
|
19501
19625
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
19502
19626
|
}
|
|
19503
|
-
const controllersDir =
|
|
19504
|
-
await Bun.write(
|
|
19505
|
-
await Bun.write(
|
|
19506
|
-
await Bun.write(
|
|
19507
|
-
await Bun.write(
|
|
19508
|
-
await Bun.write(
|
|
19627
|
+
const controllersDir = join40(process.cwd(), base, "src", "controllers");
|
|
19628
|
+
await Bun.write(join40(controllersDir, "CreateTopicController.ts"), CreateTopicController_default);
|
|
19629
|
+
await Bun.write(join40(controllersDir, "GetTopicController.ts"), GetTopicController_default);
|
|
19630
|
+
await Bun.write(join40(controllersDir, "ListTopicsController.ts"), ListTopicsController_default);
|
|
19631
|
+
await Bun.write(join40(controllersDir, "UpdateTopicController.ts"), UpdateTopicController_default);
|
|
19632
|
+
await Bun.write(join40(controllersDir, "DeleteTopicController.ts"), DeleteTopicController_default);
|
|
19509
19633
|
const makeServiceCommand = new MakeServiceCommand;
|
|
19510
19634
|
const services = ["CreateTopic", "GetTopic", "ListTopics", "UpdateTopic", "DeleteTopic"];
|
|
19511
19635
|
for (const name of services) {
|
|
19512
19636
|
await makeServiceCommand.run({ name, module });
|
|
19513
19637
|
}
|
|
19514
|
-
const servicesDir =
|
|
19515
|
-
await Bun.write(
|
|
19516
|
-
await Bun.write(
|
|
19517
|
-
await Bun.write(
|
|
19518
|
-
await Bun.write(
|
|
19519
|
-
await Bun.write(
|
|
19520
|
-
const entityPath =
|
|
19638
|
+
const servicesDir = join40(process.cwd(), base, "src", "services");
|
|
19639
|
+
await Bun.write(join40(servicesDir, "CreateTopicService.ts"), CreateTopicService_default);
|
|
19640
|
+
await Bun.write(join40(servicesDir, "GetTopicService.ts"), GetTopicService_default);
|
|
19641
|
+
await Bun.write(join40(servicesDir, "ListTopicsService.ts"), ListTopicsService_default);
|
|
19642
|
+
await Bun.write(join40(servicesDir, "UpdateTopicService.ts"), UpdateTopicService_default);
|
|
19643
|
+
await Bun.write(join40(servicesDir, "DeleteTopicService.ts"), DeleteTopicService_default);
|
|
19644
|
+
const entityPath = join40(process.cwd(), base, "src", "entities", "TopicEntity.ts");
|
|
19521
19645
|
await Bun.write(entityPath, TopicEntity_default);
|
|
19522
|
-
const migrationsDir =
|
|
19646
|
+
const migrationsDir = join40(process.cwd(), base, "src", "migrations");
|
|
19523
19647
|
const glob = new Glob12("Migration*.ts");
|
|
19524
19648
|
for await (const file of glob.scan(migrationsDir)) {
|
|
19525
19649
|
if (file === "migrations.ts")
|
|
@@ -19527,18 +19651,18 @@ class MakeResourceTopicCommand {
|
|
|
19527
19651
|
const name = file.replace(/\.ts$/, "");
|
|
19528
19652
|
const version = name.replace("Migration", "");
|
|
19529
19653
|
const content = TopicMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
19530
|
-
await Bun.write(
|
|
19654
|
+
await Bun.write(join40(migrationsDir, file), content);
|
|
19531
19655
|
}
|
|
19532
|
-
const repositoryPath =
|
|
19656
|
+
const repositoryPath = join40(process.cwd(), base, "src", "repositories", "TopicRepository.ts");
|
|
19533
19657
|
await Bun.write(repositoryPath, TopicRepository_default);
|
|
19534
19658
|
}
|
|
19535
19659
|
}
|
|
19536
19660
|
MakeResourceTopicCommand = __legacyDecorateClassTS([
|
|
19537
|
-
|
|
19661
|
+
decorator40.command()
|
|
19538
19662
|
], MakeResourceTopicCommand);
|
|
19539
19663
|
// src/commands/MakeResourceUserCommand.ts
|
|
19540
|
-
import { join as
|
|
19541
|
-
import { decorator as
|
|
19664
|
+
import { join as join41 } from "path";
|
|
19665
|
+
import { decorator as decorator41 } from "@ooneex/command";
|
|
19542
19666
|
var {Glob: Glob13 } = globalThis.Bun;
|
|
19543
19667
|
|
|
19544
19668
|
// src/templates/resources/user/controllers/BanUserController.txt
|
|
@@ -20359,9 +20483,9 @@ class MakeResourceUserCommand {
|
|
|
20359
20483
|
}
|
|
20360
20484
|
async run() {
|
|
20361
20485
|
const module = "user";
|
|
20362
|
-
const base =
|
|
20486
|
+
const base = join41("modules", module);
|
|
20363
20487
|
const makeModuleCommand = new MakeModuleCommand;
|
|
20364
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
20488
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
20365
20489
|
const makeEntityCommand = new MakeEntityCommand;
|
|
20366
20490
|
await makeEntityCommand.run({ name: "User", module, tableName: "users" });
|
|
20367
20491
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -20410,14 +20534,14 @@ class MakeResourceUserCommand {
|
|
|
20410
20534
|
for (const controller of controllers) {
|
|
20411
20535
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
20412
20536
|
}
|
|
20413
|
-
const controllersDir =
|
|
20414
|
-
await Bun.write(
|
|
20415
|
-
await Bun.write(
|
|
20416
|
-
await Bun.write(
|
|
20417
|
-
await Bun.write(
|
|
20418
|
-
await Bun.write(
|
|
20419
|
-
await Bun.write(
|
|
20420
|
-
await Bun.write(
|
|
20537
|
+
const controllersDir = join41(process.cwd(), base, "src", "controllers");
|
|
20538
|
+
await Bun.write(join41(controllersDir, "BanUserController.ts"), BanUserController_default);
|
|
20539
|
+
await Bun.write(join41(controllersDir, "LockUserController.ts"), LockUserController_default);
|
|
20540
|
+
await Bun.write(join41(controllersDir, "SignOutController.ts"), SignOutController_default);
|
|
20541
|
+
await Bun.write(join41(controllersDir, "UpdateUserProfileController.ts"), UpdateUserProfileController_default);
|
|
20542
|
+
await Bun.write(join41(controllersDir, "UpdateUserProfileImageController.ts"), UpdateUserProfileImageController_default);
|
|
20543
|
+
await Bun.write(join41(controllersDir, "DeleteUserProfileImageController.ts"), DeleteUserProfileImageController_default);
|
|
20544
|
+
await Bun.write(join41(controllersDir, "UpdateUserRolesController.ts"), UpdateUserRolesController_default);
|
|
20421
20545
|
const makeServiceCommand = new MakeServiceCommand;
|
|
20422
20546
|
const services = [
|
|
20423
20547
|
"BanUser",
|
|
@@ -20431,17 +20555,17 @@ class MakeResourceUserCommand {
|
|
|
20431
20555
|
for (const name of services) {
|
|
20432
20556
|
await makeServiceCommand.run({ name, module });
|
|
20433
20557
|
}
|
|
20434
|
-
const servicesDir =
|
|
20435
|
-
await Bun.write(
|
|
20436
|
-
await Bun.write(
|
|
20437
|
-
await Bun.write(
|
|
20438
|
-
await Bun.write(
|
|
20439
|
-
await Bun.write(
|
|
20440
|
-
await Bun.write(
|
|
20441
|
-
await Bun.write(
|
|
20442
|
-
const entityPath =
|
|
20558
|
+
const servicesDir = join41(process.cwd(), base, "src", "services");
|
|
20559
|
+
await Bun.write(join41(servicesDir, "BanUserService.ts"), BanUserService_default);
|
|
20560
|
+
await Bun.write(join41(servicesDir, "LockUserService.ts"), LockUserService_default);
|
|
20561
|
+
await Bun.write(join41(servicesDir, "SignOutService.ts"), SignOutService_default);
|
|
20562
|
+
await Bun.write(join41(servicesDir, "UpdateUserProfileService.ts"), UpdateUserProfileService_default);
|
|
20563
|
+
await Bun.write(join41(servicesDir, "UpdateUserProfileImageService.ts"), UpdateUserProfileImageService_default);
|
|
20564
|
+
await Bun.write(join41(servicesDir, "DeleteUserProfileImageService.ts"), DeleteUserProfileImageService_default);
|
|
20565
|
+
await Bun.write(join41(servicesDir, "UpdateUserRolesService.ts"), UpdateUserRolesService_default);
|
|
20566
|
+
const entityPath = join41(process.cwd(), base, "src", "entities", "UserEntity.ts");
|
|
20443
20567
|
await Bun.write(entityPath, UserEntity_default);
|
|
20444
|
-
const migrationsDir =
|
|
20568
|
+
const migrationsDir = join41(process.cwd(), base, "src", "migrations");
|
|
20445
20569
|
const glob = new Glob13("Migration*.ts");
|
|
20446
20570
|
for await (const file of glob.scan(migrationsDir)) {
|
|
20447
20571
|
if (file === "migrations.ts")
|
|
@@ -20449,18 +20573,18 @@ class MakeResourceUserCommand {
|
|
|
20449
20573
|
const name = file.replace(/\.ts$/, "");
|
|
20450
20574
|
const version = name.replace("Migration", "");
|
|
20451
20575
|
const content = UserMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
20452
|
-
await Bun.write(
|
|
20576
|
+
await Bun.write(join41(migrationsDir, file), content);
|
|
20453
20577
|
}
|
|
20454
|
-
const repositoryPath =
|
|
20578
|
+
const repositoryPath = join41(process.cwd(), base, "src", "repositories", "UserRepository.ts");
|
|
20455
20579
|
await Bun.write(repositoryPath, UserRepository_default);
|
|
20456
20580
|
}
|
|
20457
20581
|
}
|
|
20458
20582
|
MakeResourceUserCommand = __legacyDecorateClassTS([
|
|
20459
|
-
|
|
20583
|
+
decorator41.command()
|
|
20460
20584
|
], MakeResourceUserCommand);
|
|
20461
20585
|
// src/commands/MakeResourceVideoCommand.ts
|
|
20462
|
-
import { join as
|
|
20463
|
-
import { decorator as
|
|
20586
|
+
import { join as join42 } from "path";
|
|
20587
|
+
import { decorator as decorator42 } from "@ooneex/command";
|
|
20464
20588
|
var {Glob: Glob14 } = globalThis.Bun;
|
|
20465
20589
|
|
|
20466
20590
|
// src/templates/resources/video/controllers/CreateVideoController.txt
|
|
@@ -21139,9 +21263,9 @@ class MakeResourceVideoCommand {
|
|
|
21139
21263
|
}
|
|
21140
21264
|
async run() {
|
|
21141
21265
|
const module = "video";
|
|
21142
|
-
const base =
|
|
21266
|
+
const base = join42("modules", module);
|
|
21143
21267
|
const makeModuleCommand = new MakeModuleCommand;
|
|
21144
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
21268
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
21145
21269
|
const makeEntityCommand = new MakeEntityCommand;
|
|
21146
21270
|
await makeEntityCommand.run({ name: "Video", module, tableName: "videos" });
|
|
21147
21271
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -21174,26 +21298,26 @@ class MakeResourceVideoCommand {
|
|
|
21174
21298
|
for (const controller of controllers) {
|
|
21175
21299
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
21176
21300
|
}
|
|
21177
|
-
const controllersDir =
|
|
21178
|
-
await Bun.write(
|
|
21179
|
-
await Bun.write(
|
|
21180
|
-
await Bun.write(
|
|
21181
|
-
await Bun.write(
|
|
21182
|
-
await Bun.write(
|
|
21301
|
+
const controllersDir = join42(process.cwd(), base, "src", "controllers");
|
|
21302
|
+
await Bun.write(join42(controllersDir, "CreateVideoController.ts"), CreateVideoController_default);
|
|
21303
|
+
await Bun.write(join42(controllersDir, "GetVideoController.ts"), GetVideoController_default);
|
|
21304
|
+
await Bun.write(join42(controllersDir, "ListVideosController.ts"), ListVideosController_default);
|
|
21305
|
+
await Bun.write(join42(controllersDir, "UpdateVideoController.ts"), UpdateVideoController_default);
|
|
21306
|
+
await Bun.write(join42(controllersDir, "DeleteVideoController.ts"), DeleteVideoController_default);
|
|
21183
21307
|
const makeServiceCommand = new MakeServiceCommand;
|
|
21184
21308
|
const services = ["CreateVideo", "GetVideo", "ListVideos", "UpdateVideo", "DeleteVideo"];
|
|
21185
21309
|
for (const name of services) {
|
|
21186
21310
|
await makeServiceCommand.run({ name, module });
|
|
21187
21311
|
}
|
|
21188
|
-
const servicesDir =
|
|
21189
|
-
await Bun.write(
|
|
21190
|
-
await Bun.write(
|
|
21191
|
-
await Bun.write(
|
|
21192
|
-
await Bun.write(
|
|
21193
|
-
await Bun.write(
|
|
21194
|
-
const entityPath =
|
|
21312
|
+
const servicesDir = join42(process.cwd(), base, "src", "services");
|
|
21313
|
+
await Bun.write(join42(servicesDir, "CreateVideoService.ts"), CreateVideoService_default);
|
|
21314
|
+
await Bun.write(join42(servicesDir, "GetVideoService.ts"), GetVideoService_default);
|
|
21315
|
+
await Bun.write(join42(servicesDir, "ListVideosService.ts"), ListVideosService_default);
|
|
21316
|
+
await Bun.write(join42(servicesDir, "UpdateVideoService.ts"), UpdateVideoService_default);
|
|
21317
|
+
await Bun.write(join42(servicesDir, "DeleteVideoService.ts"), DeleteVideoService_default);
|
|
21318
|
+
const entityPath = join42(process.cwd(), base, "src", "entities", "VideoEntity.ts");
|
|
21195
21319
|
await Bun.write(entityPath, VideoEntity_default);
|
|
21196
|
-
const migrationsDir =
|
|
21320
|
+
const migrationsDir = join42(process.cwd(), base, "src", "migrations");
|
|
21197
21321
|
const glob = new Glob14("Migration*.ts");
|
|
21198
21322
|
for await (const file of glob.scan(migrationsDir)) {
|
|
21199
21323
|
if (file === "migrations.ts")
|
|
@@ -21201,19 +21325,19 @@ class MakeResourceVideoCommand {
|
|
|
21201
21325
|
const name = file.replace(/\.ts$/, "");
|
|
21202
21326
|
const version = name.replace("Migration", "");
|
|
21203
21327
|
const content = VideoMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
21204
|
-
await Bun.write(
|
|
21328
|
+
await Bun.write(join42(migrationsDir, file), content);
|
|
21205
21329
|
}
|
|
21206
|
-
const repositoryPath =
|
|
21330
|
+
const repositoryPath = join42(process.cwd(), base, "src", "repositories", "VideoRepository.ts");
|
|
21207
21331
|
await Bun.write(repositoryPath, VideoRepository_default);
|
|
21208
21332
|
}
|
|
21209
21333
|
}
|
|
21210
21334
|
MakeResourceVideoCommand = __legacyDecorateClassTS([
|
|
21211
|
-
|
|
21335
|
+
decorator42.command()
|
|
21212
21336
|
], MakeResourceVideoCommand);
|
|
21213
21337
|
// src/commands/MakeStorageCommand.ts
|
|
21214
|
-
import { join as
|
|
21215
|
-
import { decorator as
|
|
21216
|
-
import { TerminalLogger as
|
|
21338
|
+
import { join as join43 } from "path";
|
|
21339
|
+
import { decorator as decorator43 } from "@ooneex/command";
|
|
21340
|
+
import { TerminalLogger as TerminalLogger28 } from "@ooneex/logger";
|
|
21217
21341
|
import { toPascalCase as toPascalCase16, toSnakeCase as toSnakeCase3 } from "@ooneex/utils";
|
|
21218
21342
|
|
|
21219
21343
|
// src/templates/storage.test.txt
|
|
@@ -21313,28 +21437,28 @@ class MakeStorageCommand {
|
|
|
21313
21437
|
if (module) {
|
|
21314
21438
|
await ensureModule(module);
|
|
21315
21439
|
}
|
|
21316
|
-
const base = module ?
|
|
21317
|
-
const storageLocalDir =
|
|
21318
|
-
const storageDir =
|
|
21319
|
-
const filePath =
|
|
21440
|
+
const base = module ? join43("modules", module) : ".";
|
|
21441
|
+
const storageLocalDir = join43(base, "src", "storage");
|
|
21442
|
+
const storageDir = join43(process.cwd(), storageLocalDir);
|
|
21443
|
+
const filePath = join43(storageDir, `${name}Storage.ts`);
|
|
21320
21444
|
await Bun.write(filePath, content);
|
|
21321
21445
|
const testContent = storage_test_default.replace(/{{NAME}}/g, name);
|
|
21322
|
-
const testsLocalDir =
|
|
21323
|
-
const testsDir =
|
|
21324
|
-
const testFilePath =
|
|
21446
|
+
const testsLocalDir = join43(base, "tests", "storage");
|
|
21447
|
+
const testsDir = join43(process.cwd(), testsLocalDir);
|
|
21448
|
+
const testFilePath = join43(testsDir, `${name}Storage.spec.ts`);
|
|
21325
21449
|
await Bun.write(testFilePath, testContent);
|
|
21326
|
-
const logger = new
|
|
21327
|
-
logger.success(`${
|
|
21450
|
+
const logger = new TerminalLogger28;
|
|
21451
|
+
logger.success(`${join43(storageLocalDir, name)}Storage.ts created successfully`, undefined, {
|
|
21328
21452
|
showTimestamp: false,
|
|
21329
21453
|
showArrow: false,
|
|
21330
21454
|
useSymbol: true
|
|
21331
21455
|
});
|
|
21332
|
-
logger.success(`${
|
|
21456
|
+
logger.success(`${join43(testsLocalDir, name)}Storage.spec.ts created successfully`, undefined, {
|
|
21333
21457
|
showTimestamp: false,
|
|
21334
21458
|
showArrow: false,
|
|
21335
21459
|
useSymbol: true
|
|
21336
21460
|
});
|
|
21337
|
-
const packageJsonPath =
|
|
21461
|
+
const packageJsonPath = join43(process.cwd(), "package.json");
|
|
21338
21462
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
21339
21463
|
const deps = packageJson.dependencies ?? {};
|
|
21340
21464
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -21349,12 +21473,12 @@ class MakeStorageCommand {
|
|
|
21349
21473
|
}
|
|
21350
21474
|
}
|
|
21351
21475
|
MakeStorageCommand = __legacyDecorateClassTS([
|
|
21352
|
-
|
|
21476
|
+
decorator43.command()
|
|
21353
21477
|
], MakeStorageCommand);
|
|
21354
21478
|
// src/commands/MakeVectorDatabaseCommand.ts
|
|
21355
|
-
import { join as
|
|
21356
|
-
import { decorator as
|
|
21357
|
-
import { TerminalLogger as
|
|
21479
|
+
import { join as join44 } from "path";
|
|
21480
|
+
import { decorator as decorator44 } from "@ooneex/command";
|
|
21481
|
+
import { TerminalLogger as TerminalLogger29 } from "@ooneex/logger";
|
|
21358
21482
|
import { toPascalCase as toPascalCase17 } from "@ooneex/utils";
|
|
21359
21483
|
|
|
21360
21484
|
// src/templates/vector-database.test.txt
|
|
@@ -21428,28 +21552,28 @@ class MakeVectorDatabaseCommand {
|
|
|
21428
21552
|
if (module) {
|
|
21429
21553
|
await ensureModule(module);
|
|
21430
21554
|
}
|
|
21431
|
-
const base = module ?
|
|
21432
|
-
const vectorDatabaseLocalDir =
|
|
21433
|
-
const vectorDatabaseDir =
|
|
21434
|
-
const filePath =
|
|
21555
|
+
const base = module ? join44("modules", module) : ".";
|
|
21556
|
+
const vectorDatabaseLocalDir = join44(base, "src", "databases");
|
|
21557
|
+
const vectorDatabaseDir = join44(process.cwd(), vectorDatabaseLocalDir);
|
|
21558
|
+
const filePath = join44(vectorDatabaseDir, `${name}VectorDatabase.ts`);
|
|
21435
21559
|
await Bun.write(filePath, content);
|
|
21436
21560
|
const testContent = vector_database_test_default.replace(/{{NAME}}/g, name);
|
|
21437
|
-
const testsLocalDir =
|
|
21438
|
-
const testsDir =
|
|
21439
|
-
const testFilePath =
|
|
21561
|
+
const testsLocalDir = join44(base, "tests", "databases");
|
|
21562
|
+
const testsDir = join44(process.cwd(), testsLocalDir);
|
|
21563
|
+
const testFilePath = join44(testsDir, `${name}VectorDatabase.spec.ts`);
|
|
21440
21564
|
await Bun.write(testFilePath, testContent);
|
|
21441
|
-
const logger = new
|
|
21442
|
-
logger.success(`${
|
|
21565
|
+
const logger = new TerminalLogger29;
|
|
21566
|
+
logger.success(`${join44(vectorDatabaseLocalDir, name)}VectorDatabase.ts created successfully`, undefined, {
|
|
21443
21567
|
showTimestamp: false,
|
|
21444
21568
|
showArrow: false,
|
|
21445
21569
|
useSymbol: true
|
|
21446
21570
|
});
|
|
21447
|
-
logger.success(`${
|
|
21571
|
+
logger.success(`${join44(testsLocalDir, name)}VectorDatabase.spec.ts created successfully`, undefined, {
|
|
21448
21572
|
showTimestamp: false,
|
|
21449
21573
|
showArrow: false,
|
|
21450
21574
|
useSymbol: true
|
|
21451
21575
|
});
|
|
21452
|
-
const packageJsonPath =
|
|
21576
|
+
const packageJsonPath = join44(process.cwd(), "package.json");
|
|
21453
21577
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
21454
21578
|
const deps = packageJson.dependencies ?? {};
|
|
21455
21579
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -21464,13 +21588,13 @@ class MakeVectorDatabaseCommand {
|
|
|
21464
21588
|
}
|
|
21465
21589
|
}
|
|
21466
21590
|
MakeVectorDatabaseCommand = __legacyDecorateClassTS([
|
|
21467
|
-
|
|
21591
|
+
decorator44.command()
|
|
21468
21592
|
], MakeVectorDatabaseCommand);
|
|
21469
21593
|
// src/commands/MigrationUpCommand.ts
|
|
21470
|
-
import { existsSync } from "fs";
|
|
21471
|
-
import { join as
|
|
21472
|
-
import { decorator as
|
|
21473
|
-
import { TerminalLogger as
|
|
21594
|
+
import { existsSync as existsSync2 } from "fs";
|
|
21595
|
+
import { join as join45 } from "path";
|
|
21596
|
+
import { decorator as decorator45 } from "@ooneex/command";
|
|
21597
|
+
import { TerminalLogger as TerminalLogger30 } from "@ooneex/logger";
|
|
21474
21598
|
class MigrationUpCommand {
|
|
21475
21599
|
getName() {
|
|
21476
21600
|
return "migration:up";
|
|
@@ -21478,10 +21602,10 @@ class MigrationUpCommand {
|
|
|
21478
21602
|
getDescription() {
|
|
21479
21603
|
return "Run migrations for all modules";
|
|
21480
21604
|
}
|
|
21481
|
-
async run() {
|
|
21482
|
-
const logger = new
|
|
21483
|
-
const modulesDir =
|
|
21484
|
-
if (!
|
|
21605
|
+
async run(options) {
|
|
21606
|
+
const logger = new TerminalLogger30;
|
|
21607
|
+
const modulesDir = join45(process.cwd(), "modules");
|
|
21608
|
+
if (!existsSync2(modulesDir)) {
|
|
21485
21609
|
logger.warn("No modules with migrations found", undefined, {
|
|
21486
21610
|
showTimestamp: false,
|
|
21487
21611
|
showArrow: false,
|
|
@@ -21493,10 +21617,10 @@ class MigrationUpCommand {
|
|
|
21493
21617
|
const modules = [];
|
|
21494
21618
|
for await (const match of glob.scan({ cwd: modulesDir, onlyFiles: true })) {
|
|
21495
21619
|
const entry = match.replace("/package.json", "");
|
|
21496
|
-
const moduleDir =
|
|
21497
|
-
const migrationUpFile = Bun.file(
|
|
21620
|
+
const moduleDir = join45(modulesDir, entry);
|
|
21621
|
+
const migrationUpFile = Bun.file(join45(moduleDir, "bin", "migration", "up.ts"));
|
|
21498
21622
|
if (await migrationUpFile.exists()) {
|
|
21499
|
-
const packageJson = await Bun.file(
|
|
21623
|
+
const packageJson = await Bun.file(join45(modulesDir, match)).json();
|
|
21500
21624
|
modules.push({ name: packageJson.name ?? entry, dir: moduleDir });
|
|
21501
21625
|
}
|
|
21502
21626
|
}
|
|
@@ -21509,13 +21633,17 @@ class MigrationUpCommand {
|
|
|
21509
21633
|
return;
|
|
21510
21634
|
}
|
|
21511
21635
|
for (const { name, dir } of modules) {
|
|
21512
|
-
const migrationUpPath =
|
|
21636
|
+
const migrationUpPath = join45(dir, "bin", "migration", "up.ts");
|
|
21513
21637
|
logger.info(`Running migrations for ${name}...`, undefined, {
|
|
21514
21638
|
showTimestamp: false,
|
|
21515
21639
|
showArrow: false,
|
|
21516
21640
|
useSymbol: false
|
|
21517
21641
|
});
|
|
21518
|
-
const
|
|
21642
|
+
const args = ["bun", "run", migrationUpPath];
|
|
21643
|
+
if (options.drop) {
|
|
21644
|
+
args.push("--drop");
|
|
21645
|
+
}
|
|
21646
|
+
const proc = Bun.spawn(args, {
|
|
21519
21647
|
cwd: dir,
|
|
21520
21648
|
stdout: "inherit",
|
|
21521
21649
|
stderr: "inherit"
|
|
@@ -21538,13 +21666,13 @@ class MigrationUpCommand {
|
|
|
21538
21666
|
}
|
|
21539
21667
|
}
|
|
21540
21668
|
MigrationUpCommand = __legacyDecorateClassTS([
|
|
21541
|
-
|
|
21669
|
+
decorator45.command()
|
|
21542
21670
|
], MigrationUpCommand);
|
|
21543
21671
|
// src/commands/SeedRunCommand.ts
|
|
21544
|
-
import { existsSync as
|
|
21545
|
-
import { join as
|
|
21546
|
-
import { decorator as
|
|
21547
|
-
import { TerminalLogger as
|
|
21672
|
+
import { existsSync as existsSync3 } from "fs";
|
|
21673
|
+
import { join as join46 } from "path";
|
|
21674
|
+
import { decorator as decorator46 } from "@ooneex/command";
|
|
21675
|
+
import { TerminalLogger as TerminalLogger31 } from "@ooneex/logger";
|
|
21548
21676
|
class SeedRunCommand {
|
|
21549
21677
|
getName() {
|
|
21550
21678
|
return "seed:run";
|
|
@@ -21552,10 +21680,10 @@ class SeedRunCommand {
|
|
|
21552
21680
|
getDescription() {
|
|
21553
21681
|
return "Run seeds for all modules";
|
|
21554
21682
|
}
|
|
21555
|
-
async run() {
|
|
21556
|
-
const logger = new
|
|
21557
|
-
const modulesDir =
|
|
21558
|
-
if (!
|
|
21683
|
+
async run(options) {
|
|
21684
|
+
const logger = new TerminalLogger31;
|
|
21685
|
+
const modulesDir = join46(process.cwd(), "modules");
|
|
21686
|
+
if (!existsSync3(modulesDir)) {
|
|
21559
21687
|
logger.warn("No modules with seeds found", undefined, {
|
|
21560
21688
|
showTimestamp: false,
|
|
21561
21689
|
showArrow: false,
|
|
@@ -21567,10 +21695,10 @@ class SeedRunCommand {
|
|
|
21567
21695
|
const modules = [];
|
|
21568
21696
|
for await (const match of glob.scan({ cwd: modulesDir, onlyFiles: true })) {
|
|
21569
21697
|
const entry = match.replace("/package.json", "");
|
|
21570
|
-
const moduleDir =
|
|
21571
|
-
const seedRunFile = Bun.file(
|
|
21698
|
+
const moduleDir = join46(modulesDir, entry);
|
|
21699
|
+
const seedRunFile = Bun.file(join46(moduleDir, "bin", "seed", "run.ts"));
|
|
21572
21700
|
if (await seedRunFile.exists()) {
|
|
21573
|
-
const packageJson = await Bun.file(
|
|
21701
|
+
const packageJson = await Bun.file(join46(modulesDir, match)).json();
|
|
21574
21702
|
modules.push({ name: packageJson.name ?? entry, dir: moduleDir });
|
|
21575
21703
|
}
|
|
21576
21704
|
}
|
|
@@ -21583,13 +21711,17 @@ class SeedRunCommand {
|
|
|
21583
21711
|
return;
|
|
21584
21712
|
}
|
|
21585
21713
|
for (const { name, dir } of modules) {
|
|
21586
|
-
const seedRunPath =
|
|
21714
|
+
const seedRunPath = join46(dir, "bin", "seed", "run.ts");
|
|
21587
21715
|
logger.info(`Running seeds for ${name}...`, undefined, {
|
|
21588
21716
|
showTimestamp: false,
|
|
21589
21717
|
showArrow: false,
|
|
21590
21718
|
useSymbol: false
|
|
21591
21719
|
});
|
|
21592
|
-
const
|
|
21720
|
+
const args = ["bun", "run", seedRunPath];
|
|
21721
|
+
if (options.drop) {
|
|
21722
|
+
args.push("--drop");
|
|
21723
|
+
}
|
|
21724
|
+
const proc = Bun.spawn(args, {
|
|
21593
21725
|
cwd: dir,
|
|
21594
21726
|
stdout: "inherit",
|
|
21595
21727
|
stderr: "inherit"
|
|
@@ -21612,9 +21744,9 @@ class SeedRunCommand {
|
|
|
21612
21744
|
}
|
|
21613
21745
|
}
|
|
21614
21746
|
SeedRunCommand = __legacyDecorateClassTS([
|
|
21615
|
-
|
|
21747
|
+
decorator46.command()
|
|
21616
21748
|
], SeedRunCommand);
|
|
21617
21749
|
// src/index.ts
|
|
21618
21750
|
await run();
|
|
21619
21751
|
|
|
21620
|
-
//# debugId=
|
|
21752
|
+
//# debugId=B64B6C8BCD62B27464756E2164756E21
|