@ooneex/cli 1.20.3 → 1.22.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 +1055 -774
- package/dist/index.js.map +40 -38
- 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 -A1 'getName' modules/*/src/commands/*Command.ts 2>/dev/null | sed -n 's/.*return "\\(.*\\)".*/\\1/p' | 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'
|
|
@@ -5106,6 +5209,7 @@ _oo() {
|
|
|
5106
5209
|
'make\\:migration:Generate a new migration file'
|
|
5107
5210
|
'migration\\:up:Run migrations for all modules'
|
|
5108
5211
|
'make\\:module:Generate a new module'
|
|
5212
|
+
'remove\\:module:Remove an existing module'
|
|
5109
5213
|
'make\\:permission:Generate a new permission class'
|
|
5110
5214
|
'make\\:pubsub:Generate a new PubSub event class'
|
|
5111
5215
|
'make\\:release:Release packages with version bump, changelog, and git tag'
|
|
@@ -5142,6 +5246,10 @@ _oo() {
|
|
|
5142
5246
|
;;
|
|
5143
5247
|
opts)
|
|
5144
5248
|
case "$words[1]" in
|
|
5249
|
+
command:run)
|
|
5250
|
+
_arguments -s \\
|
|
5251
|
+
'1:command name:_oo_custom_commands'
|
|
5252
|
+
;;
|
|
5145
5253
|
make:controller)
|
|
5146
5254
|
_arguments -s \\
|
|
5147
5255
|
'--name=[Name of the resource]:name' \\
|
|
@@ -5182,6 +5290,10 @@ _oo() {
|
|
|
5182
5290
|
_arguments -s \\
|
|
5183
5291
|
'--name=[Name of the resource]:name'
|
|
5184
5292
|
;;
|
|
5293
|
+
remove:module)
|
|
5294
|
+
_arguments -s \\
|
|
5295
|
+
'--name=[Module name]:name:_oo_modules'
|
|
5296
|
+
;;
|
|
5185
5297
|
make:docker)
|
|
5186
5298
|
_arguments -s \\
|
|
5187
5299
|
'--name=[Docker service name]:name:(clickhouse elasticsearch grafana jaeger keycloak libretranslate maildev memcached minio mongodb mysql nats ooneex-jade postgres prometheus rabbitmq redis temporal vault)' \\
|
|
@@ -5197,7 +5309,11 @@ _oo() {
|
|
|
5197
5309
|
'--name=[Name of the resource]:name' \\
|
|
5198
5310
|
'--module=[Module name]:module:_oo_modules'
|
|
5199
5311
|
;;
|
|
5200
|
-
|
|
5312
|
+
migration:up|seed:run)
|
|
5313
|
+
_arguments -s \\
|
|
5314
|
+
'--drop[Drop the database before running]'
|
|
5315
|
+
;;
|
|
5316
|
+
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
5317
|
;;
|
|
5202
5318
|
esac
|
|
5203
5319
|
;;
|
|
@@ -5218,12 +5334,21 @@ _ooneex_modules() {
|
|
|
5218
5334
|
fi
|
|
5219
5335
|
}
|
|
5220
5336
|
|
|
5337
|
+
_ooneex_custom_commands() {
|
|
5338
|
+
local -a cmds
|
|
5339
|
+
if [[ -d modules ]]; then
|
|
5340
|
+
cmds=(\${(@f)"$(command grep -rh -A1 'getName' modules/*/src/commands/*Command.ts 2>/dev/null | sed -n 's/.*return "\\(.*\\)".*/\\1/p' | sort -u)"})
|
|
5341
|
+
compadd -a cmds
|
|
5342
|
+
fi
|
|
5343
|
+
}
|
|
5344
|
+
|
|
5221
5345
|
_ooneex() {
|
|
5222
5346
|
local -a commands
|
|
5223
5347
|
commands=(
|
|
5224
5348
|
'app\\:build:Build the application'
|
|
5225
5349
|
'app\\:start:Start the application'
|
|
5226
5350
|
'app\\:stop:Stop the application'
|
|
5351
|
+
'command\\:run:Run a custom command from a module'
|
|
5227
5352
|
'completion\\:zsh:Install Zsh completion for oo command'
|
|
5228
5353
|
'help:Show available commands'
|
|
5229
5354
|
'make\\:ai:Generate a new AI class'
|
|
@@ -5243,6 +5368,7 @@ _ooneex() {
|
|
|
5243
5368
|
'make\\:migration:Generate a new migration file'
|
|
5244
5369
|
'migration\\:up:Run migrations for all modules'
|
|
5245
5370
|
'make\\:module:Generate a new module'
|
|
5371
|
+
'remove\\:module:Remove an existing module'
|
|
5246
5372
|
'make\\:permission:Generate a new permission class'
|
|
5247
5373
|
'make\\:pubsub:Generate a new PubSub event class'
|
|
5248
5374
|
'make\\:release:Release packages with version bump, changelog, and git tag'
|
|
@@ -5279,6 +5405,10 @@ _ooneex() {
|
|
|
5279
5405
|
;;
|
|
5280
5406
|
opts)
|
|
5281
5407
|
case "$words[1]" in
|
|
5408
|
+
command:run)
|
|
5409
|
+
_arguments -s \\
|
|
5410
|
+
'1:command name:_ooneex_custom_commands'
|
|
5411
|
+
;;
|
|
5282
5412
|
make:controller)
|
|
5283
5413
|
_arguments -s \\
|
|
5284
5414
|
'--name=[Name of the resource]:name' \\
|
|
@@ -5319,6 +5449,10 @@ _ooneex() {
|
|
|
5319
5449
|
_arguments -s \\
|
|
5320
5450
|
'--name=[Name of the resource]:name'
|
|
5321
5451
|
;;
|
|
5452
|
+
remove:module)
|
|
5453
|
+
_arguments -s \\
|
|
5454
|
+
'--name=[Module name]:name:_ooneex_modules'
|
|
5455
|
+
;;
|
|
5322
5456
|
make:docker)
|
|
5323
5457
|
_arguments -s \\
|
|
5324
5458
|
'--name=[Docker service name]:name:(clickhouse elasticsearch grafana jaeger keycloak libretranslate maildev memcached minio mongodb mysql nats ooneex-jade postgres prometheus rabbitmq redis temporal vault)' \\
|
|
@@ -5334,7 +5468,11 @@ _ooneex() {
|
|
|
5334
5468
|
'--name=[Name of the resource]:name' \\
|
|
5335
5469
|
'--module=[Module name]:module:_ooneex_modules'
|
|
5336
5470
|
;;
|
|
5337
|
-
|
|
5471
|
+
migration:up|seed:run)
|
|
5472
|
+
_arguments -s \\
|
|
5473
|
+
'--drop[Drop the database before running]'
|
|
5474
|
+
;;
|
|
5475
|
+
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
5476
|
;;
|
|
5339
5477
|
esac
|
|
5340
5478
|
;;
|
|
@@ -5353,12 +5491,12 @@ class CompletionZshCommand {
|
|
|
5353
5491
|
return "Install Zsh completion for oo command";
|
|
5354
5492
|
}
|
|
5355
5493
|
async run() {
|
|
5356
|
-
const completionDir =
|
|
5357
|
-
const ooFilePath =
|
|
5494
|
+
const completionDir = join5(homedir(), ".zsh");
|
|
5495
|
+
const ooFilePath = join5(completionDir, "_oo");
|
|
5358
5496
|
await Bun.write(ooFilePath, _oo_default);
|
|
5359
|
-
const ooneexFilePath =
|
|
5497
|
+
const ooneexFilePath = join5(completionDir, "_ooneex");
|
|
5360
5498
|
await Bun.write(ooneexFilePath, _ooneex_default);
|
|
5361
|
-
const logger = new
|
|
5499
|
+
const logger = new TerminalLogger5;
|
|
5362
5500
|
logger.success(`${ooFilePath} created successfully`, undefined, {
|
|
5363
5501
|
showTimestamp: false,
|
|
5364
5502
|
showArrow: false,
|
|
@@ -5379,10 +5517,10 @@ class CompletionZshCommand {
|
|
|
5379
5517
|
}
|
|
5380
5518
|
}
|
|
5381
5519
|
CompletionZshCommand = __legacyDecorateClassTS([
|
|
5382
|
-
|
|
5520
|
+
decorator5.command()
|
|
5383
5521
|
], CompletionZshCommand);
|
|
5384
5522
|
// src/commands/HelpCommand.ts
|
|
5385
|
-
import { COMMANDS_CONTAINER, decorator as
|
|
5523
|
+
import { COMMANDS_CONTAINER, decorator as decorator6 } from "@ooneex/command";
|
|
5386
5524
|
class HelpCommand {
|
|
5387
5525
|
getName() {
|
|
5388
5526
|
return "help";
|
|
@@ -5409,12 +5547,12 @@ class HelpCommand {
|
|
|
5409
5547
|
}
|
|
5410
5548
|
}
|
|
5411
5549
|
HelpCommand = __legacyDecorateClassTS([
|
|
5412
|
-
|
|
5550
|
+
decorator6.command()
|
|
5413
5551
|
], HelpCommand);
|
|
5414
5552
|
// src/commands/MakeAiCommand.ts
|
|
5415
|
-
import { join as
|
|
5416
|
-
import { decorator as
|
|
5417
|
-
import { TerminalLogger as
|
|
5553
|
+
import { join as join8 } from "path";
|
|
5554
|
+
import { decorator as decorator8 } from "@ooneex/command";
|
|
5555
|
+
import { TerminalLogger as TerminalLogger7 } from "@ooneex/logger";
|
|
5418
5556
|
import { toPascalCase as toPascalCase2 } from "@ooneex/utils";
|
|
5419
5557
|
|
|
5420
5558
|
// src/prompts/askName.ts
|
|
@@ -5470,7 +5608,7 @@ var askName = async (config) => {
|
|
|
5470
5608
|
|
|
5471
5609
|
// src/templates/ai.test.txt
|
|
5472
5610
|
var ai_test_default = `import { describe, expect, test } from "bun:test";
|
|
5473
|
-
import { {{NAME}}Ai } from "
|
|
5611
|
+
import { {{NAME}}Ai } from "@module/{{MODULE}}/ai/{{NAME}}Ai";
|
|
5474
5612
|
|
|
5475
5613
|
describe("{{NAME}}Ai", () => {
|
|
5476
5614
|
test("should have class name ending with 'Ai'", () => {
|
|
@@ -5511,12 +5649,12 @@ export class {{NAME}}Ai implements IAiChat<OpenAiConfigType> {
|
|
|
5511
5649
|
`;
|
|
5512
5650
|
|
|
5513
5651
|
// src/utils.ts
|
|
5514
|
-
import { join as
|
|
5652
|
+
import { join as join7 } from "path";
|
|
5515
5653
|
|
|
5516
5654
|
// src/commands/MakeModuleCommand.ts
|
|
5517
|
-
import { join as
|
|
5518
|
-
import { decorator as
|
|
5519
|
-
import { TerminalLogger as
|
|
5655
|
+
import { join as join6 } from "path";
|
|
5656
|
+
import { decorator as decorator7 } from "@ooneex/command";
|
|
5657
|
+
import { TerminalLogger as TerminalLogger6 } from "@ooneex/logger";
|
|
5520
5658
|
import { toKebabCase, toPascalCase } from "@ooneex/utils";
|
|
5521
5659
|
|
|
5522
5660
|
// src/templates/module/module.txt
|
|
@@ -5640,7 +5778,7 @@ class MakeModuleCommand {
|
|
|
5640
5778
|
${newScope},`;
|
|
5641
5779
|
content = content.replace(regex, `$1${newValue}
|
|
5642
5780
|
$3`);
|
|
5643
|
-
await Bun.write(commitlintPath, content);
|
|
5781
|
+
await Bun.write(commitlintPath, content.replace(/,+/g, ","));
|
|
5644
5782
|
}
|
|
5645
5783
|
}
|
|
5646
5784
|
}
|
|
@@ -5654,52 +5792,46 @@ class MakeModuleCommand {
|
|
|
5654
5792
|
`);
|
|
5655
5793
|
}
|
|
5656
5794
|
async run(options) {
|
|
5657
|
-
const { cwd = process.cwd(), silent = false
|
|
5795
|
+
const { cwd = process.cwd(), silent = false } = options;
|
|
5658
5796
|
let { name } = options;
|
|
5659
5797
|
if (!name) {
|
|
5660
5798
|
name = await askName({ message: "Enter module name" });
|
|
5661
5799
|
}
|
|
5662
5800
|
const pascalName = toPascalCase(name).replace(/Module$/, "");
|
|
5663
5801
|
const kebabName = toKebabCase(pascalName);
|
|
5664
|
-
const moduleDir =
|
|
5665
|
-
const srcDir =
|
|
5666
|
-
const testsDir =
|
|
5802
|
+
const moduleDir = join6(cwd, "modules", kebabName);
|
|
5803
|
+
const srcDir = join6(moduleDir, "src");
|
|
5804
|
+
const testsDir = join6(moduleDir, "tests");
|
|
5667
5805
|
const moduleContent = module_default.replace(/{{NAME}}/g, pascalName);
|
|
5668
5806
|
const packageContent = package_default.replace(/{{NAME}}/g, kebabName);
|
|
5669
5807
|
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);
|
|
5808
|
+
await Bun.write(join6(srcDir, `${pascalName}Module.ts`), moduleContent);
|
|
5809
|
+
await Bun.write(join6(moduleDir, "package.json"), packageContent);
|
|
5810
|
+
await Bun.write(join6(moduleDir, "tsconfig.json"), tsconfig_default);
|
|
5811
|
+
await Bun.write(join6(testsDir, `${pascalName}Module.spec.ts`), testContent);
|
|
5680
5812
|
if (kebabName !== "app") {
|
|
5681
|
-
const appModulePath =
|
|
5813
|
+
const appModulePath = join6(cwd, "modules", "app", "src", "AppModule.ts");
|
|
5682
5814
|
if (await Bun.file(appModulePath).exists()) {
|
|
5683
5815
|
await this.addToAppModule(appModulePath, pascalName, kebabName);
|
|
5684
5816
|
}
|
|
5685
5817
|
}
|
|
5686
|
-
const appTsconfigPath =
|
|
5818
|
+
const appTsconfigPath = join6(cwd, "tsconfig.json");
|
|
5687
5819
|
if (await Bun.file(appTsconfigPath).exists()) {
|
|
5688
5820
|
await this.addPathAlias(appTsconfigPath, kebabName);
|
|
5689
5821
|
}
|
|
5690
5822
|
if (kebabName !== "app" && kebabName !== "shared") {
|
|
5691
|
-
const sharedModuleDir =
|
|
5692
|
-
const sharedModuleFilePath =
|
|
5823
|
+
const sharedModuleDir = join6(cwd, "modules", "shared");
|
|
5824
|
+
const sharedModuleFilePath = join6(sharedModuleDir, "src", "SharedModule.ts");
|
|
5693
5825
|
if (await Bun.file(sharedModuleFilePath).exists()) {
|
|
5694
5826
|
await this.addToSharedModule(sharedModuleFilePath, pascalName, kebabName);
|
|
5695
5827
|
}
|
|
5696
5828
|
}
|
|
5697
|
-
const commitlintPath =
|
|
5829
|
+
const commitlintPath = join6(cwd, ".commitlintrc.ts");
|
|
5698
5830
|
if (await Bun.file(commitlintPath).exists()) {
|
|
5699
5831
|
await this.addModuleScope(commitlintPath, kebabName);
|
|
5700
5832
|
}
|
|
5701
5833
|
if (!silent) {
|
|
5702
|
-
const logger = new
|
|
5834
|
+
const logger = new TerminalLogger6;
|
|
5703
5835
|
logger.success(`modules/${kebabName} created successfully`, undefined, {
|
|
5704
5836
|
showTimestamp: false,
|
|
5705
5837
|
showArrow: false,
|
|
@@ -5709,13 +5841,13 @@ class MakeModuleCommand {
|
|
|
5709
5841
|
}
|
|
5710
5842
|
}
|
|
5711
5843
|
MakeModuleCommand = __legacyDecorateClassTS([
|
|
5712
|
-
|
|
5844
|
+
decorator7.command()
|
|
5713
5845
|
], MakeModuleCommand);
|
|
5714
5846
|
|
|
5715
5847
|
// src/utils.ts
|
|
5716
5848
|
var ensureModule = async (module) => {
|
|
5717
|
-
const moduleDir =
|
|
5718
|
-
const moduleDirExists = await Bun.file(
|
|
5849
|
+
const moduleDir = join7(process.cwd(), "modules", module);
|
|
5850
|
+
const moduleDirExists = await Bun.file(join7(moduleDir, "package.json")).exists();
|
|
5719
5851
|
if (!moduleDirExists) {
|
|
5720
5852
|
const makeModule = new MakeModuleCommand;
|
|
5721
5853
|
await makeModule.run({ name: module, cwd: process.cwd(), silent: true });
|
|
@@ -5740,28 +5872,28 @@ class MakeAiCommand {
|
|
|
5740
5872
|
await ensureModule(module);
|
|
5741
5873
|
}
|
|
5742
5874
|
const content = ai_default.replace(/{{NAME}}/g, name);
|
|
5743
|
-
const base = module ?
|
|
5744
|
-
const aiLocalDir =
|
|
5745
|
-
const aiDir =
|
|
5746
|
-
const filePath =
|
|
5875
|
+
const base = module ? join8("modules", module) : ".";
|
|
5876
|
+
const aiLocalDir = join8(base, "src", "ai");
|
|
5877
|
+
const aiDir = join8(process.cwd(), aiLocalDir);
|
|
5878
|
+
const filePath = join8(aiDir, `${name}Ai.ts`);
|
|
5747
5879
|
await Bun.write(filePath, content);
|
|
5748
|
-
const testContent = ai_test_default.replace(/{{NAME}}/g, name);
|
|
5749
|
-
const testsLocalDir =
|
|
5750
|
-
const testsDir =
|
|
5751
|
-
const testFilePath =
|
|
5880
|
+
const testContent = ai_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
5881
|
+
const testsLocalDir = join8(base, "tests", "ai");
|
|
5882
|
+
const testsDir = join8(process.cwd(), testsLocalDir);
|
|
5883
|
+
const testFilePath = join8(testsDir, `${name}Ai.spec.ts`);
|
|
5752
5884
|
await Bun.write(testFilePath, testContent);
|
|
5753
|
-
const logger = new
|
|
5754
|
-
logger.success(`${
|
|
5885
|
+
const logger = new TerminalLogger7;
|
|
5886
|
+
logger.success(`${join8(aiLocalDir, name)}Ai.ts created successfully`, undefined, {
|
|
5755
5887
|
showTimestamp: false,
|
|
5756
5888
|
showArrow: false,
|
|
5757
5889
|
useSymbol: true
|
|
5758
5890
|
});
|
|
5759
|
-
logger.success(`${
|
|
5891
|
+
logger.success(`${join8(testsLocalDir, name)}Ai.spec.ts created successfully`, undefined, {
|
|
5760
5892
|
showTimestamp: false,
|
|
5761
5893
|
showArrow: false,
|
|
5762
5894
|
useSymbol: true
|
|
5763
5895
|
});
|
|
5764
|
-
const packageJsonPath =
|
|
5896
|
+
const packageJsonPath = join8(process.cwd(), "package.json");
|
|
5765
5897
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
5766
5898
|
const deps = packageJson.dependencies ?? {};
|
|
5767
5899
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -5776,17 +5908,17 @@ class MakeAiCommand {
|
|
|
5776
5908
|
}
|
|
5777
5909
|
}
|
|
5778
5910
|
MakeAiCommand = __legacyDecorateClassTS([
|
|
5779
|
-
|
|
5911
|
+
decorator8.command()
|
|
5780
5912
|
], MakeAiCommand);
|
|
5781
5913
|
// src/commands/MakeAnalyticsCommand.ts
|
|
5782
|
-
import { join as
|
|
5783
|
-
import { decorator as
|
|
5784
|
-
import { TerminalLogger as
|
|
5914
|
+
import { join as join9 } from "path";
|
|
5915
|
+
import { decorator as decorator9 } from "@ooneex/command";
|
|
5916
|
+
import { TerminalLogger as TerminalLogger8 } from "@ooneex/logger";
|
|
5785
5917
|
import { toPascalCase as toPascalCase3 } from "@ooneex/utils";
|
|
5786
5918
|
|
|
5787
5919
|
// src/templates/analytics.test.txt
|
|
5788
5920
|
var analytics_test_default = `import { describe, expect, test } from "bun:test";
|
|
5789
|
-
import { {{NAME}}Analytics } from "
|
|
5921
|
+
import { {{NAME}}Analytics } from "@module/{{MODULE}}/analytics/{{NAME}}Analytics";
|
|
5790
5922
|
|
|
5791
5923
|
describe("{{NAME}}Analytics", () => {
|
|
5792
5924
|
test("should have class name ending with 'Analytics'", () => {
|
|
@@ -5832,28 +5964,28 @@ class MakeAnalyticsCommand {
|
|
|
5832
5964
|
if (module) {
|
|
5833
5965
|
await ensureModule(module);
|
|
5834
5966
|
}
|
|
5835
|
-
const base = module ?
|
|
5836
|
-
const analyticsLocalDir =
|
|
5837
|
-
const analyticsDir =
|
|
5838
|
-
const filePath =
|
|
5967
|
+
const base = module ? join9("modules", module) : ".";
|
|
5968
|
+
const analyticsLocalDir = join9(base, "src", "analytics");
|
|
5969
|
+
const analyticsDir = join9(process.cwd(), analyticsLocalDir);
|
|
5970
|
+
const filePath = join9(analyticsDir, `${name}Analytics.ts`);
|
|
5839
5971
|
await Bun.write(filePath, content);
|
|
5840
|
-
const testContent = analytics_test_default.replace(/{{NAME}}/g, name);
|
|
5841
|
-
const testsLocalDir =
|
|
5842
|
-
const testsDir =
|
|
5843
|
-
const testFilePath =
|
|
5972
|
+
const testContent = analytics_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
5973
|
+
const testsLocalDir = join9(base, "tests", "analytics");
|
|
5974
|
+
const testsDir = join9(process.cwd(), testsLocalDir);
|
|
5975
|
+
const testFilePath = join9(testsDir, `${name}Analytics.spec.ts`);
|
|
5844
5976
|
await Bun.write(testFilePath, testContent);
|
|
5845
|
-
const logger = new
|
|
5846
|
-
logger.success(`${
|
|
5977
|
+
const logger = new TerminalLogger8;
|
|
5978
|
+
logger.success(`${join9(analyticsLocalDir, name)}Analytics.ts created successfully`, undefined, {
|
|
5847
5979
|
showTimestamp: false,
|
|
5848
5980
|
showArrow: false,
|
|
5849
5981
|
useSymbol: true
|
|
5850
5982
|
});
|
|
5851
|
-
logger.success(`${
|
|
5983
|
+
logger.success(`${join9(testsLocalDir, name)}Analytics.spec.ts created successfully`, undefined, {
|
|
5852
5984
|
showTimestamp: false,
|
|
5853
5985
|
showArrow: false,
|
|
5854
5986
|
useSymbol: true
|
|
5855
5987
|
});
|
|
5856
|
-
const packageJsonPath =
|
|
5988
|
+
const packageJsonPath = join9(process.cwd(), "package.json");
|
|
5857
5989
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
5858
5990
|
const deps = packageJson.dependencies ?? {};
|
|
5859
5991
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -5868,12 +6000,12 @@ class MakeAnalyticsCommand {
|
|
|
5868
6000
|
}
|
|
5869
6001
|
}
|
|
5870
6002
|
MakeAnalyticsCommand = __legacyDecorateClassTS([
|
|
5871
|
-
|
|
6003
|
+
decorator9.command()
|
|
5872
6004
|
], MakeAnalyticsCommand);
|
|
5873
6005
|
// src/commands/MakeAppCommand.ts
|
|
5874
|
-
import { join as
|
|
5875
|
-
import { decorator as
|
|
5876
|
-
import { TerminalLogger as
|
|
6006
|
+
import { join as join10 } from "path";
|
|
6007
|
+
import { decorator as decorator10 } from "@ooneex/command";
|
|
6008
|
+
import { TerminalLogger as TerminalLogger9 } from "@ooneex/logger";
|
|
5877
6009
|
import { toKebabCase as toKebabCase2, toSnakeCase } from "@ooneex/utils";
|
|
5878
6010
|
|
|
5879
6011
|
// src/prompts/askDestination.ts
|
|
@@ -6194,11 +6326,11 @@ var/
|
|
|
6194
6326
|
`;
|
|
6195
6327
|
|
|
6196
6328
|
// src/templates/app/app-database.txt
|
|
6197
|
-
var app_database_default = `import {
|
|
6329
|
+
var app_database_default = `import { SharedModule } from "@module/shared/SharedModule";
|
|
6198
6330
|
import { AppEnv } from "@ooneex/app-env";
|
|
6331
|
+
import { inject } from "@ooneex/container";
|
|
6332
|
+
import { DatabaseException, decorator, TypeormDatabase } from "@ooneex/database";
|
|
6199
6333
|
import { DataSource } from "typeorm";
|
|
6200
|
-
import { TypeormDatabase, DatabaseException, decorator } from "@ooneex/database";
|
|
6201
|
-
import { SharedModule } from "@module/shared/SharedModule";
|
|
6202
6334
|
|
|
6203
6335
|
@decorator.database()
|
|
6204
6336
|
export class SharedDatabase extends TypeormDatabase {
|
|
@@ -6207,6 +6339,10 @@ export class SharedDatabase extends TypeormDatabase {
|
|
|
6207
6339
|
}
|
|
6208
6340
|
|
|
6209
6341
|
public getSource(): DataSource {
|
|
6342
|
+
if (this.source) {
|
|
6343
|
+
return this.source;
|
|
6344
|
+
}
|
|
6345
|
+
|
|
6210
6346
|
const url = this.env.DATABASE_URL;
|
|
6211
6347
|
|
|
6212
6348
|
if (!url) {
|
|
@@ -6217,13 +6353,21 @@ export class SharedDatabase extends TypeormDatabase {
|
|
|
6217
6353
|
}
|
|
6218
6354
|
|
|
6219
6355
|
this.source = new DataSource({
|
|
6356
|
+
type: "postgres",
|
|
6357
|
+
url,
|
|
6220
6358
|
synchronize: false,
|
|
6221
6359
|
entities: SharedModule.entities,
|
|
6360
|
+
poolSize: 10,
|
|
6222
6361
|
extra: {
|
|
6223
6362
|
max: 10,
|
|
6363
|
+
min: 2,
|
|
6364
|
+
idleTimeoutMillis: 30_000,
|
|
6365
|
+
connectionTimeoutMillis: 5_000,
|
|
6366
|
+
allowExitOnIdle: false,
|
|
6367
|
+
maxLifetimeSeconds: 1_800,
|
|
6224
6368
|
},
|
|
6225
|
-
|
|
6226
|
-
|
|
6369
|
+
logging: ["error", "warn", "migration"],
|
|
6370
|
+
maxQueryExecutionTime: 1_000,
|
|
6227
6371
|
});
|
|
6228
6372
|
|
|
6229
6373
|
return this.source;
|
|
@@ -7012,44 +7156,40 @@ class MakeAppCommand {
|
|
|
7012
7156
|
destination = await askDestination({ message: "Enter destination path", initial: kebabName });
|
|
7013
7157
|
}
|
|
7014
7158
|
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(
|
|
7159
|
+
await Bun.write(join10(destination, ".commitlintrc.ts"), _commitlintrc_ts_default);
|
|
7160
|
+
await Bun.write(join10(destination, ".gitignore"), _gitignore_default);
|
|
7161
|
+
await Bun.write(join10(destination, "biome.jsonc"), biome_jsonc_default);
|
|
7162
|
+
await Bun.write(join10(destination, "bunfig.toml"), bunfig_toml_default);
|
|
7163
|
+
await Bun.write(join10(destination, "nx.json"), nx_json_default);
|
|
7164
|
+
await Bun.write(join10(destination, "package.json"), packageContent);
|
|
7165
|
+
await Bun.write(join10(destination, "README.md"), README_md_default.replace(/{{NAME}}/g, kebabName));
|
|
7166
|
+
await Bun.write(join10(destination, "tsconfig.json"), tsconfig_json_default);
|
|
7167
|
+
await Bun.write(join10(destination, ".zed", "settings.json"), zed_settings_json_default);
|
|
7024
7168
|
const makeModuleCommand = new MakeModuleCommand;
|
|
7025
7169
|
await makeModuleCommand.run({
|
|
7026
7170
|
name: "app",
|
|
7027
7171
|
cwd: destination,
|
|
7028
|
-
silent: true
|
|
7029
|
-
skipMigrations: true,
|
|
7030
|
-
skipSeeds: true
|
|
7172
|
+
silent: true
|
|
7031
7173
|
});
|
|
7032
|
-
const appModulePackagePath =
|
|
7174
|
+
const appModulePackagePath = join10(destination, "modules", "app", "package.json");
|
|
7033
7175
|
const appModulePackageJson = await Bun.file(appModulePackagePath).json();
|
|
7034
7176
|
await Bun.write(appModulePackagePath, JSON.stringify(appModulePackageJson, null, 2));
|
|
7035
7177
|
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(
|
|
7178
|
+
await Bun.write(join10(destination, "modules", "app", ".env"), envContent);
|
|
7179
|
+
await Bun.write(join10(destination, "modules", "app", ".env.example"), env_default);
|
|
7180
|
+
await Bun.write(join10(destination, "modules", "app", "src", "index.ts"), index_ts_default);
|
|
7039
7181
|
await makeModuleCommand.run({
|
|
7040
7182
|
name: "shared",
|
|
7041
7183
|
cwd: destination,
|
|
7042
|
-
silent: true
|
|
7043
|
-
skipMigrations: true,
|
|
7044
|
-
skipSeeds: true
|
|
7184
|
+
silent: true
|
|
7045
7185
|
});
|
|
7046
|
-
await Bun.write(
|
|
7186
|
+
await Bun.write(join10(destination, "modules", "shared", "src", "databases", "SharedDatabase.ts"), app_database_default);
|
|
7047
7187
|
const snakeName = toSnakeCase(name);
|
|
7048
7188
|
const dockerComposeContent = docker_compose_yml_default.replace(/{{NAME}}/g, snakeName);
|
|
7049
|
-
await Bun.write(
|
|
7189
|
+
await Bun.write(join10(destination, "modules", "app", "docker-compose.yml"), dockerComposeContent);
|
|
7050
7190
|
const dockerfileContent = Dockerfile_default.replace(/{{NAME}}/g, snakeName);
|
|
7051
|
-
await Bun.write(
|
|
7052
|
-
await Bun.write(
|
|
7191
|
+
await Bun.write(join10(destination, "modules", "app", "Dockerfile"), dockerfileContent);
|
|
7192
|
+
await Bun.write(join10(destination, "modules", "app", "var", ".gitkeep"), "");
|
|
7053
7193
|
const gitInit = Bun.spawn(["git", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
7054
7194
|
await gitInit.exited;
|
|
7055
7195
|
const addDeps = Bun.spawn([
|
|
@@ -7111,9 +7251,9 @@ class MakeAppCommand {
|
|
|
7111
7251
|
await addDevDeps.exited;
|
|
7112
7252
|
const huskyInit = Bun.spawn(["bunx", "husky", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
7113
7253
|
await huskyInit.exited;
|
|
7114
|
-
await Bun.write(
|
|
7115
|
-
await Bun.write(
|
|
7116
|
-
const logger = new
|
|
7254
|
+
await Bun.write(join10(destination, ".husky", "pre-commit"), "lint-staged");
|
|
7255
|
+
await Bun.write(join10(destination, ".husky", "commit-msg"), `bunx commitlint --edit "$1"`);
|
|
7256
|
+
const logger = new TerminalLogger9;
|
|
7117
7257
|
logger.success(`${kebabName} created successfully at ${destination}`, undefined, {
|
|
7118
7258
|
showTimestamp: false,
|
|
7119
7259
|
showArrow: false,
|
|
@@ -7122,17 +7262,17 @@ class MakeAppCommand {
|
|
|
7122
7262
|
}
|
|
7123
7263
|
}
|
|
7124
7264
|
MakeAppCommand = __legacyDecorateClassTS([
|
|
7125
|
-
|
|
7265
|
+
decorator10.command()
|
|
7126
7266
|
], MakeAppCommand);
|
|
7127
7267
|
// src/commands/MakeCacheCommand.ts
|
|
7128
|
-
import { join as
|
|
7129
|
-
import { decorator as
|
|
7130
|
-
import { TerminalLogger as
|
|
7268
|
+
import { join as join11 } from "path";
|
|
7269
|
+
import { decorator as decorator11 } from "@ooneex/command";
|
|
7270
|
+
import { TerminalLogger as TerminalLogger10 } from "@ooneex/logger";
|
|
7131
7271
|
import { toPascalCase as toPascalCase4 } from "@ooneex/utils";
|
|
7132
7272
|
|
|
7133
7273
|
// src/templates/cache.test.txt
|
|
7134
7274
|
var cache_test_default = `import { describe, expect, test } from "bun:test";
|
|
7135
|
-
import { {{NAME}}Cache } from "
|
|
7275
|
+
import { {{NAME}}Cache } from "@module/{{MODULE}}/cache/{{NAME}}Cache";
|
|
7136
7276
|
|
|
7137
7277
|
describe("{{NAME}}Cache", () => {
|
|
7138
7278
|
test("should have class name ending with 'Cache'", () => {
|
|
@@ -7203,28 +7343,28 @@ class MakeCacheCommand {
|
|
|
7203
7343
|
if (module) {
|
|
7204
7344
|
await ensureModule(module);
|
|
7205
7345
|
}
|
|
7206
|
-
const base = module ?
|
|
7207
|
-
const cacheLocalDir =
|
|
7208
|
-
const cacheDir =
|
|
7209
|
-
const filePath =
|
|
7346
|
+
const base = module ? join11("modules", module) : ".";
|
|
7347
|
+
const cacheLocalDir = join11(base, "src", "cache");
|
|
7348
|
+
const cacheDir = join11(process.cwd(), cacheLocalDir);
|
|
7349
|
+
const filePath = join11(cacheDir, `${name}Cache.ts`);
|
|
7210
7350
|
await Bun.write(filePath, content);
|
|
7211
|
-
const testContent = cache_test_default.replace(/{{NAME}}/g, name);
|
|
7212
|
-
const testsLocalDir =
|
|
7213
|
-
const testsDir =
|
|
7214
|
-
const testFilePath =
|
|
7351
|
+
const testContent = cache_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
7352
|
+
const testsLocalDir = join11(base, "tests", "cache");
|
|
7353
|
+
const testsDir = join11(process.cwd(), testsLocalDir);
|
|
7354
|
+
const testFilePath = join11(testsDir, `${name}Cache.spec.ts`);
|
|
7215
7355
|
await Bun.write(testFilePath, testContent);
|
|
7216
|
-
const logger = new
|
|
7217
|
-
logger.success(`${
|
|
7356
|
+
const logger = new TerminalLogger10;
|
|
7357
|
+
logger.success(`${join11(cacheLocalDir, name)}Cache.ts created successfully`, undefined, {
|
|
7218
7358
|
showTimestamp: false,
|
|
7219
7359
|
showArrow: false,
|
|
7220
7360
|
useSymbol: true
|
|
7221
7361
|
});
|
|
7222
|
-
logger.success(`${
|
|
7362
|
+
logger.success(`${join11(testsLocalDir, name)}Cache.spec.ts created successfully`, undefined, {
|
|
7223
7363
|
showTimestamp: false,
|
|
7224
7364
|
showArrow: false,
|
|
7225
7365
|
useSymbol: true
|
|
7226
7366
|
});
|
|
7227
|
-
const packageJsonPath =
|
|
7367
|
+
const packageJsonPath = join11(process.cwd(), "package.json");
|
|
7228
7368
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
7229
7369
|
const deps = packageJson.dependencies ?? {};
|
|
7230
7370
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -7239,12 +7379,12 @@ class MakeCacheCommand {
|
|
|
7239
7379
|
}
|
|
7240
7380
|
}
|
|
7241
7381
|
MakeCacheCommand = __legacyDecorateClassTS([
|
|
7242
|
-
|
|
7382
|
+
decorator11.command()
|
|
7243
7383
|
], MakeCacheCommand);
|
|
7244
7384
|
// src/commands/MakeClaudeSkillCommand.ts
|
|
7245
|
-
import { join as
|
|
7246
|
-
import { decorator as
|
|
7247
|
-
import { TerminalLogger as
|
|
7385
|
+
import { join as join12 } from "path";
|
|
7386
|
+
import { decorator as decorator12 } from "@ooneex/command";
|
|
7387
|
+
import { TerminalLogger as TerminalLogger11 } from "@ooneex/logger";
|
|
7248
7388
|
|
|
7249
7389
|
// src/templates/claude/skills/commit.md.txt
|
|
7250
7390
|
var commit_md_default = `---
|
|
@@ -7535,14 +7675,14 @@ class MakeClaudeSkillCommand {
|
|
|
7535
7675
|
return "Generate Claude skills from templates";
|
|
7536
7676
|
}
|
|
7537
7677
|
async run() {
|
|
7538
|
-
const skillsLocalDir =
|
|
7539
|
-
const skillsDir =
|
|
7540
|
-
const logger = new
|
|
7678
|
+
const skillsLocalDir = join12(".claude", "skills");
|
|
7679
|
+
const skillsDir = join12(process.cwd(), skillsLocalDir);
|
|
7680
|
+
const logger = new TerminalLogger11;
|
|
7541
7681
|
for (const [skillName, content] of Object.entries(skills)) {
|
|
7542
7682
|
const dirName = skillName.replace(/\./g, "-");
|
|
7543
|
-
const filePath =
|
|
7683
|
+
const filePath = join12(skillsDir, dirName, "SKILL.md");
|
|
7544
7684
|
await Bun.write(filePath, content);
|
|
7545
|
-
logger.success(`${
|
|
7685
|
+
logger.success(`${join12(skillsLocalDir, dirName, "SKILL.md")} created successfully`, undefined, {
|
|
7546
7686
|
showTimestamp: false,
|
|
7547
7687
|
showArrow: false,
|
|
7548
7688
|
useSymbol: true
|
|
@@ -7551,18 +7691,18 @@ class MakeClaudeSkillCommand {
|
|
|
7551
7691
|
}
|
|
7552
7692
|
}
|
|
7553
7693
|
MakeClaudeSkillCommand = __legacyDecorateClassTS([
|
|
7554
|
-
|
|
7694
|
+
decorator12.command()
|
|
7555
7695
|
], MakeClaudeSkillCommand);
|
|
7556
7696
|
// src/commands/MakeCommandCommand.ts
|
|
7557
|
-
import { join as
|
|
7558
|
-
import { commandCreate, decorator as
|
|
7559
|
-
import { TerminalLogger as
|
|
7697
|
+
import { join as join13 } from "path";
|
|
7698
|
+
import { commandCreate, decorator as decorator13 } from "@ooneex/command";
|
|
7699
|
+
import { TerminalLogger as TerminalLogger12 } from "@ooneex/logger";
|
|
7560
7700
|
|
|
7561
7701
|
// src/templates/module/command.run.txt
|
|
7562
7702
|
var command_run_default = `#!/usr/bin/env bun
|
|
7563
7703
|
|
|
7564
7704
|
import { run } from "@ooneex/command";
|
|
7565
|
-
import "
|
|
7705
|
+
import "@module/{{name}}/commands/commands";
|
|
7566
7706
|
|
|
7567
7707
|
await run();
|
|
7568
7708
|
`;
|
|
@@ -7583,20 +7723,19 @@ class MakeCommandCommand {
|
|
|
7583
7723
|
if (module) {
|
|
7584
7724
|
await ensureModule(module);
|
|
7585
7725
|
}
|
|
7586
|
-
const base = module ?
|
|
7587
|
-
const { commandPath, testPath } = await commandCreate({
|
|
7726
|
+
const base = module ? join13("modules", module) : ".";
|
|
7727
|
+
const { commandPath: filePath, testPath } = await commandCreate({
|
|
7588
7728
|
name,
|
|
7589
|
-
commandDir:
|
|
7590
|
-
testsDir:
|
|
7729
|
+
commandDir: join13(base, "src", "commands"),
|
|
7730
|
+
testsDir: join13(base, "tests", "commands")
|
|
7591
7731
|
});
|
|
7592
|
-
const binCommandRunPath =
|
|
7732
|
+
const binCommandRunPath = join13(process.cwd(), base, "bin", "command", "run.ts");
|
|
7593
7733
|
const binCommandRunFile = Bun.file(binCommandRunPath);
|
|
7594
7734
|
if (!await binCommandRunFile.exists()) {
|
|
7595
|
-
await Bun.write(binCommandRunPath, command_run_default);
|
|
7735
|
+
await Bun.write(binCommandRunPath, command_run_default.replace(/{{name}}/g, module ?? ""));
|
|
7596
7736
|
}
|
|
7597
|
-
const
|
|
7598
|
-
|
|
7599
|
-
logger.success(`${commandPath} created successfully`, undefined, {
|
|
7737
|
+
const logger = new TerminalLogger12;
|
|
7738
|
+
logger.success(`${filePath} created successfully`, undefined, {
|
|
7600
7739
|
showTimestamp: false,
|
|
7601
7740
|
showArrow: false,
|
|
7602
7741
|
useSymbol: true
|
|
@@ -7606,26 +7745,15 @@ class MakeCommandCommand {
|
|
|
7606
7745
|
showArrow: false,
|
|
7607
7746
|
useSymbol: true
|
|
7608
7747
|
});
|
|
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
7748
|
}
|
|
7621
7749
|
}
|
|
7622
7750
|
MakeCommandCommand = __legacyDecorateClassTS([
|
|
7623
|
-
|
|
7751
|
+
decorator13.command()
|
|
7624
7752
|
], MakeCommandCommand);
|
|
7625
7753
|
// src/commands/MakeControllerCommand.ts
|
|
7626
|
-
import { basename, join as
|
|
7627
|
-
import { decorator as
|
|
7628
|
-
import { TerminalLogger as
|
|
7754
|
+
import { basename, join as join14 } from "path";
|
|
7755
|
+
import { decorator as decorator14 } from "@ooneex/command";
|
|
7756
|
+
import { TerminalLogger as TerminalLogger13 } from "@ooneex/logger";
|
|
7629
7757
|
import { toKebabCase as toKebabCase3, toPascalCase as toPascalCase5, trim } from "@ooneex/utils";
|
|
7630
7758
|
|
|
7631
7759
|
// src/prompts/askConfirm.ts
|
|
@@ -7924,7 +8052,7 @@ export class {{NAME}}Controller {
|
|
|
7924
8052
|
|
|
7925
8053
|
// src/templates/controller.test.txt
|
|
7926
8054
|
var controller_test_default = `import { describe, expect, test } from "bun:test";
|
|
7927
|
-
import { {{NAME}}Controller } from "
|
|
8055
|
+
import { {{NAME}}Controller } from "@module/{{MODULE}}/controllers/{{NAME}}Controller";
|
|
7928
8056
|
|
|
7929
8057
|
describe("{{NAME}}Controller", () => {
|
|
7930
8058
|
test("should have class name ending with 'Controller'", () => {
|
|
@@ -8045,33 +8173,33 @@ class MakeControllerCommand {
|
|
|
8045
8173
|
if (module) {
|
|
8046
8174
|
await ensureModule(module);
|
|
8047
8175
|
}
|
|
8048
|
-
const base = module ?
|
|
8049
|
-
const controllersLocalDir =
|
|
8050
|
-
const controllersDir =
|
|
8051
|
-
const filePath =
|
|
8176
|
+
const base = module ? join14("modules", module) : ".";
|
|
8177
|
+
const controllersLocalDir = join14(base, "src", "controllers");
|
|
8178
|
+
const controllersDir = join14(process.cwd(), controllersLocalDir);
|
|
8179
|
+
const filePath = join14(controllersDir, `${name}Controller.ts`);
|
|
8052
8180
|
await Bun.write(filePath, content);
|
|
8053
|
-
const testContent = controller_test_default.replace(/{{NAME}}/g, name);
|
|
8054
|
-
const testsLocalDir =
|
|
8055
|
-
const testsDir =
|
|
8056
|
-
const testFilePath =
|
|
8181
|
+
const testContent = controller_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
8182
|
+
const testsLocalDir = join14(base, "tests", "controllers");
|
|
8183
|
+
const testsDir = join14(process.cwd(), testsLocalDir);
|
|
8184
|
+
const testFilePath = join14(testsDir, `${name}Controller.spec.ts`);
|
|
8057
8185
|
await Bun.write(testFilePath, testContent);
|
|
8058
8186
|
const modulePascalName = module ? toPascalCase5(module) : toPascalCase5(basename(process.cwd()));
|
|
8059
|
-
const modulePath =
|
|
8187
|
+
const modulePath = join14(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
8060
8188
|
if (await Bun.file(modulePath).exists()) {
|
|
8061
8189
|
await this.addToModule(modulePath, name);
|
|
8062
8190
|
}
|
|
8063
|
-
const logger = new
|
|
8064
|
-
logger.success(`${
|
|
8191
|
+
const logger = new TerminalLogger13;
|
|
8192
|
+
logger.success(`${join14(controllersLocalDir, name)}Controller.ts created successfully`, undefined, {
|
|
8065
8193
|
showTimestamp: false,
|
|
8066
8194
|
showArrow: false,
|
|
8067
8195
|
useSymbol: true
|
|
8068
8196
|
});
|
|
8069
|
-
logger.success(`${
|
|
8197
|
+
logger.success(`${join14(testsLocalDir, name)}Controller.spec.ts created successfully`, undefined, {
|
|
8070
8198
|
showTimestamp: false,
|
|
8071
8199
|
showArrow: false,
|
|
8072
8200
|
useSymbol: true
|
|
8073
8201
|
});
|
|
8074
|
-
const packageJsonPath =
|
|
8202
|
+
const packageJsonPath = join14(process.cwd(), "package.json");
|
|
8075
8203
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8076
8204
|
const deps = packageJson.dependencies ?? {};
|
|
8077
8205
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8086,17 +8214,17 @@ class MakeControllerCommand {
|
|
|
8086
8214
|
}
|
|
8087
8215
|
}
|
|
8088
8216
|
MakeControllerCommand = __legacyDecorateClassTS([
|
|
8089
|
-
|
|
8217
|
+
decorator14.command()
|
|
8090
8218
|
], MakeControllerCommand);
|
|
8091
8219
|
// src/commands/MakeCronCommand.ts
|
|
8092
|
-
import { basename as basename2, join as
|
|
8093
|
-
import { decorator as
|
|
8094
|
-
import { TerminalLogger as
|
|
8220
|
+
import { basename as basename2, join as join15 } from "path";
|
|
8221
|
+
import { decorator as decorator15 } from "@ooneex/command";
|
|
8222
|
+
import { TerminalLogger as TerminalLogger14 } from "@ooneex/logger";
|
|
8095
8223
|
import { toPascalCase as toPascalCase6 } from "@ooneex/utils";
|
|
8096
8224
|
|
|
8097
8225
|
// src/templates/cron.test.txt
|
|
8098
8226
|
var cron_test_default = `import { describe, expect, test } from "bun:test";
|
|
8099
|
-
import { {{NAME}}Cron } from "
|
|
8227
|
+
import { {{NAME}}Cron } from "@module/{{MODULE}}/cron/{{NAME}}Cron";
|
|
8100
8228
|
|
|
8101
8229
|
describe("{{NAME}}Cron", () => {
|
|
8102
8230
|
test("should have class name ending with 'Cron'", () => {
|
|
@@ -8180,33 +8308,33 @@ class MakeCronCommand {
|
|
|
8180
8308
|
if (module) {
|
|
8181
8309
|
await ensureModule(module);
|
|
8182
8310
|
}
|
|
8183
|
-
const base = module ?
|
|
8184
|
-
const cronLocalDir =
|
|
8185
|
-
const cronDir =
|
|
8186
|
-
const filePath =
|
|
8311
|
+
const base = module ? join15("modules", module) : ".";
|
|
8312
|
+
const cronLocalDir = join15(base, "src", "crons");
|
|
8313
|
+
const cronDir = join15(process.cwd(), cronLocalDir);
|
|
8314
|
+
const filePath = join15(cronDir, `${name}Cron.ts`);
|
|
8187
8315
|
await Bun.write(filePath, content);
|
|
8188
|
-
const testContent = cron_test_default.replace(/{{NAME}}/g, name);
|
|
8189
|
-
const testsLocalDir =
|
|
8190
|
-
const testsDir =
|
|
8191
|
-
const testFilePath =
|
|
8316
|
+
const testContent = cron_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
8317
|
+
const testsLocalDir = join15(base, "tests", "crons");
|
|
8318
|
+
const testsDir = join15(process.cwd(), testsLocalDir);
|
|
8319
|
+
const testFilePath = join15(testsDir, `${name}Cron.spec.ts`);
|
|
8192
8320
|
await Bun.write(testFilePath, testContent);
|
|
8193
8321
|
const modulePascalName = module ? toPascalCase6(module) : toPascalCase6(basename2(process.cwd()));
|
|
8194
|
-
const modulePath =
|
|
8322
|
+
const modulePath = join15(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
8195
8323
|
if (await Bun.file(modulePath).exists()) {
|
|
8196
8324
|
await this.addToModule(modulePath, name);
|
|
8197
8325
|
}
|
|
8198
|
-
const logger = new
|
|
8199
|
-
logger.success(`${
|
|
8326
|
+
const logger = new TerminalLogger14;
|
|
8327
|
+
logger.success(`${join15(cronLocalDir, name)}Cron.ts created successfully`, undefined, {
|
|
8200
8328
|
showTimestamp: false,
|
|
8201
8329
|
showArrow: false,
|
|
8202
8330
|
useSymbol: true
|
|
8203
8331
|
});
|
|
8204
|
-
logger.success(`${
|
|
8332
|
+
logger.success(`${join15(testsLocalDir, name)}Cron.spec.ts created successfully`, undefined, {
|
|
8205
8333
|
showTimestamp: false,
|
|
8206
8334
|
showArrow: false,
|
|
8207
8335
|
useSymbol: true
|
|
8208
8336
|
});
|
|
8209
|
-
const packageJsonPath =
|
|
8337
|
+
const packageJsonPath = join15(process.cwd(), "package.json");
|
|
8210
8338
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8211
8339
|
const deps = packageJson.dependencies ?? {};
|
|
8212
8340
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8221,17 +8349,17 @@ class MakeCronCommand {
|
|
|
8221
8349
|
}
|
|
8222
8350
|
}
|
|
8223
8351
|
MakeCronCommand = __legacyDecorateClassTS([
|
|
8224
|
-
|
|
8352
|
+
decorator15.command()
|
|
8225
8353
|
], MakeCronCommand);
|
|
8226
8354
|
// src/commands/MakeDatabaseCommand.ts
|
|
8227
|
-
import { join as
|
|
8228
|
-
import { decorator as
|
|
8229
|
-
import { TerminalLogger as
|
|
8355
|
+
import { join as join16 } from "path";
|
|
8356
|
+
import { decorator as decorator16 } from "@ooneex/command";
|
|
8357
|
+
import { TerminalLogger as TerminalLogger15 } from "@ooneex/logger";
|
|
8230
8358
|
import { toPascalCase as toPascalCase7 } from "@ooneex/utils";
|
|
8231
8359
|
|
|
8232
8360
|
// src/templates/database.test.txt
|
|
8233
8361
|
var database_test_default = `import { describe, expect, test } from "bun:test";
|
|
8234
|
-
import { {{NAME}}Database } from "
|
|
8362
|
+
import { {{NAME}}Database } from "@module/{{MODULE}}/databases/{{NAME}}Database";
|
|
8235
8363
|
|
|
8236
8364
|
describe("{{NAME}}Database", () => {
|
|
8237
8365
|
test("should have class name ending with 'Database'", () => {
|
|
@@ -8289,28 +8417,28 @@ class MakeDatabaseCommand {
|
|
|
8289
8417
|
if (module) {
|
|
8290
8418
|
await ensureModule(module);
|
|
8291
8419
|
}
|
|
8292
|
-
const base = module ?
|
|
8293
|
-
const databaseLocalDir =
|
|
8294
|
-
const databaseDir =
|
|
8295
|
-
const filePath =
|
|
8420
|
+
const base = module ? join16("modules", module) : ".";
|
|
8421
|
+
const databaseLocalDir = join16(base, "src", "databases");
|
|
8422
|
+
const databaseDir = join16(process.cwd(), databaseLocalDir);
|
|
8423
|
+
const filePath = join16(databaseDir, `${name}Database.ts`);
|
|
8296
8424
|
await Bun.write(filePath, content);
|
|
8297
|
-
const testContent = database_test_default.replace(/{{NAME}}/g, name);
|
|
8298
|
-
const testsLocalDir =
|
|
8299
|
-
const testsDir =
|
|
8300
|
-
const testFilePath =
|
|
8425
|
+
const testContent = database_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
8426
|
+
const testsLocalDir = join16(base, "tests", "databases");
|
|
8427
|
+
const testsDir = join16(process.cwd(), testsLocalDir);
|
|
8428
|
+
const testFilePath = join16(testsDir, `${name}Database.spec.ts`);
|
|
8301
8429
|
await Bun.write(testFilePath, testContent);
|
|
8302
|
-
const logger = new
|
|
8303
|
-
logger.success(`${
|
|
8430
|
+
const logger = new TerminalLogger15;
|
|
8431
|
+
logger.success(`${join16(databaseLocalDir, name)}Database.ts created successfully`, undefined, {
|
|
8304
8432
|
showTimestamp: false,
|
|
8305
8433
|
showArrow: false,
|
|
8306
8434
|
useSymbol: true
|
|
8307
8435
|
});
|
|
8308
|
-
logger.success(`${
|
|
8436
|
+
logger.success(`${join16(testsLocalDir, name)}Database.spec.ts created successfully`, undefined, {
|
|
8309
8437
|
showTimestamp: false,
|
|
8310
8438
|
showArrow: false,
|
|
8311
8439
|
useSymbol: true
|
|
8312
8440
|
});
|
|
8313
|
-
const packageJsonPath =
|
|
8441
|
+
const packageJsonPath = join16(process.cwd(), "package.json");
|
|
8314
8442
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8315
8443
|
const deps = packageJson.dependencies ?? {};
|
|
8316
8444
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8325,12 +8453,12 @@ class MakeDatabaseCommand {
|
|
|
8325
8453
|
}
|
|
8326
8454
|
}
|
|
8327
8455
|
MakeDatabaseCommand = __legacyDecorateClassTS([
|
|
8328
|
-
|
|
8456
|
+
decorator16.command()
|
|
8329
8457
|
], MakeDatabaseCommand);
|
|
8330
8458
|
// src/commands/MakeDockerCommand.ts
|
|
8331
|
-
import { join as
|
|
8332
|
-
import { decorator as
|
|
8333
|
-
import { TerminalLogger as
|
|
8459
|
+
import { join as join17 } from "path";
|
|
8460
|
+
import { decorator as decorator17 } from "@ooneex/command";
|
|
8461
|
+
import { TerminalLogger as TerminalLogger16 } from "@ooneex/logger";
|
|
8334
8462
|
var {YAML } = globalThis.Bun;
|
|
8335
8463
|
|
|
8336
8464
|
// src/prompts/askDockerService.ts
|
|
@@ -8823,9 +8951,9 @@ class MakeDockerCommand {
|
|
|
8823
8951
|
name = await askDockerService({ message: "Select docker service" });
|
|
8824
8952
|
}
|
|
8825
8953
|
const templateContent = templates[name];
|
|
8826
|
-
const base =
|
|
8827
|
-
const composePath =
|
|
8828
|
-
const logger = new
|
|
8954
|
+
const base = join17("modules", "app");
|
|
8955
|
+
const composePath = join17(process.cwd(), base, "docker-compose.yml");
|
|
8956
|
+
const logger = new TerminalLogger16;
|
|
8829
8957
|
const composeFile = Bun.file(composePath);
|
|
8830
8958
|
if (await composeFile.exists()) {
|
|
8831
8959
|
const existingContent = await composeFile.text();
|
|
@@ -8884,7 +9012,7 @@ volumes:
|
|
|
8884
9012
|
} else {
|
|
8885
9013
|
await Bun.write(composePath, templateContent);
|
|
8886
9014
|
}
|
|
8887
|
-
const packageJsonPath =
|
|
9015
|
+
const packageJsonPath = join17(process.cwd(), base, "package.json");
|
|
8888
9016
|
const packageJsonFile = Bun.file(packageJsonPath);
|
|
8889
9017
|
if (await packageJsonFile.exists()) {
|
|
8890
9018
|
const packageJson = await packageJsonFile.json();
|
|
@@ -8905,18 +9033,18 @@ volumes:
|
|
|
8905
9033
|
}
|
|
8906
9034
|
}
|
|
8907
9035
|
MakeDockerCommand = __legacyDecorateClassTS([
|
|
8908
|
-
|
|
9036
|
+
decorator17.command()
|
|
8909
9037
|
], MakeDockerCommand);
|
|
8910
9038
|
// src/commands/MakeEntityCommand.ts
|
|
8911
9039
|
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
8912
|
-
import { basename as basename3, join as
|
|
8913
|
-
import { decorator as
|
|
8914
|
-
import { TerminalLogger as
|
|
9040
|
+
import { basename as basename3, join as join18 } from "path";
|
|
9041
|
+
import { decorator as decorator18 } from "@ooneex/command";
|
|
9042
|
+
import { TerminalLogger as TerminalLogger17 } from "@ooneex/logger";
|
|
8915
9043
|
import { toPascalCase as toPascalCase8, toSnakeCase as toSnakeCase2 } from "@ooneex/utils";
|
|
8916
9044
|
|
|
8917
9045
|
// src/templates/entity.test.txt
|
|
8918
9046
|
var entity_test_default = `import { describe, expect, test } from "bun:test";
|
|
8919
|
-
import { {{NAME}}Entity } from "
|
|
9047
|
+
import { {{NAME}}Entity } from "@module/{{MODULE}}/entities/{{NAME}}Entity";
|
|
8920
9048
|
|
|
8921
9049
|
describe("{{NAME}}Entity", () => {
|
|
8922
9050
|
test("should have class name ending with 'Entity'", () => {
|
|
@@ -9075,28 +9203,28 @@ class MakeEntityCommand {
|
|
|
9075
9203
|
if (module) {
|
|
9076
9204
|
await ensureModule(module);
|
|
9077
9205
|
}
|
|
9078
|
-
const base = module ?
|
|
9079
|
-
const entitiesLocalDir =
|
|
9080
|
-
const entitiesDir =
|
|
9081
|
-
const filePath =
|
|
9206
|
+
const base = module ? join18("modules", module) : ".";
|
|
9207
|
+
const entitiesLocalDir = join18(base, "src", "entities");
|
|
9208
|
+
const entitiesDir = join18(process.cwd(), entitiesLocalDir);
|
|
9209
|
+
const filePath = join18(entitiesDir, `${name}Entity.ts`);
|
|
9082
9210
|
await Bun.write(filePath, content);
|
|
9083
|
-
const testContent = entity_test_default.replace(/{{NAME}}/g, name);
|
|
9084
|
-
const testsLocalDir =
|
|
9085
|
-
const testsDir =
|
|
9086
|
-
const testFilePath =
|
|
9211
|
+
const testContent = entity_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9212
|
+
const testsLocalDir = join18(base, "tests", "entities");
|
|
9213
|
+
const testsDir = join18(process.cwd(), testsLocalDir);
|
|
9214
|
+
const testFilePath = join18(testsDir, `${name}Entity.spec.ts`);
|
|
9087
9215
|
await Bun.write(testFilePath, testContent);
|
|
9088
9216
|
const modulePascalName = module ? toPascalCase8(module) : toPascalCase8(basename3(process.cwd()));
|
|
9089
|
-
const modulePath =
|
|
9217
|
+
const modulePath = join18(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9090
9218
|
if (await Bun.file(modulePath).exists()) {
|
|
9091
9219
|
await this.addToModule(modulePath, name);
|
|
9092
9220
|
}
|
|
9093
|
-
const logger = new
|
|
9094
|
-
logger.success(`${
|
|
9221
|
+
const logger = new TerminalLogger17;
|
|
9222
|
+
logger.success(`${join18(entitiesLocalDir, name)}Entity.ts created successfully`, undefined, {
|
|
9095
9223
|
showTimestamp: false,
|
|
9096
9224
|
showArrow: false,
|
|
9097
9225
|
useSymbol: true
|
|
9098
9226
|
});
|
|
9099
|
-
logger.success(`${
|
|
9227
|
+
logger.success(`${join18(testsLocalDir, name)}Entity.spec.ts created successfully`, undefined, {
|
|
9100
9228
|
showTimestamp: false,
|
|
9101
9229
|
showArrow: false,
|
|
9102
9230
|
useSymbol: true
|
|
@@ -9104,17 +9232,17 @@ class MakeEntityCommand {
|
|
|
9104
9232
|
}
|
|
9105
9233
|
}
|
|
9106
9234
|
MakeEntityCommand = __legacyDecorateClassTS([
|
|
9107
|
-
|
|
9235
|
+
decorator18.command()
|
|
9108
9236
|
], MakeEntityCommand);
|
|
9109
9237
|
// src/commands/MakeLoggerCommand.ts
|
|
9110
|
-
import { join as
|
|
9111
|
-
import { decorator as
|
|
9112
|
-
import { TerminalLogger as
|
|
9238
|
+
import { join as join19 } from "path";
|
|
9239
|
+
import { decorator as decorator19 } from "@ooneex/command";
|
|
9240
|
+
import { TerminalLogger as TerminalLogger18 } from "@ooneex/logger";
|
|
9113
9241
|
import { toPascalCase as toPascalCase9 } from "@ooneex/utils";
|
|
9114
9242
|
|
|
9115
9243
|
// src/templates/logger.test.txt
|
|
9116
9244
|
var logger_test_default = `import { describe, expect, test } from "bun:test";
|
|
9117
|
-
import { {{NAME}}Logger } from "
|
|
9245
|
+
import { {{NAME}}Logger } from "@module/{{MODULE}}/loggers/{{NAME}}Logger";
|
|
9118
9246
|
|
|
9119
9247
|
describe("{{NAME}}Logger", () => {
|
|
9120
9248
|
test("should have class name ending with 'Logger'", () => {
|
|
@@ -9214,28 +9342,28 @@ class MakeLoggerCommand {
|
|
|
9214
9342
|
if (module) {
|
|
9215
9343
|
await ensureModule(module);
|
|
9216
9344
|
}
|
|
9217
|
-
const base = module ?
|
|
9218
|
-
const loggerLocalDir =
|
|
9219
|
-
const loggerDir =
|
|
9220
|
-
const filePath =
|
|
9345
|
+
const base = module ? join19("modules", module) : ".";
|
|
9346
|
+
const loggerLocalDir = join19(base, "src", "loggers");
|
|
9347
|
+
const loggerDir = join19(process.cwd(), loggerLocalDir);
|
|
9348
|
+
const filePath = join19(loggerDir, `${name}Logger.ts`);
|
|
9221
9349
|
await Bun.write(filePath, content);
|
|
9222
|
-
const testContent = logger_test_default.replace(/{{NAME}}/g, name);
|
|
9223
|
-
const testsLocalDir =
|
|
9224
|
-
const testsDir =
|
|
9225
|
-
const testFilePath =
|
|
9350
|
+
const testContent = logger_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9351
|
+
const testsLocalDir = join19(base, "tests", "loggers");
|
|
9352
|
+
const testsDir = join19(process.cwd(), testsLocalDir);
|
|
9353
|
+
const testFilePath = join19(testsDir, `${name}Logger.spec.ts`);
|
|
9226
9354
|
await Bun.write(testFilePath, testContent);
|
|
9227
|
-
const logger = new
|
|
9228
|
-
logger.success(`${
|
|
9355
|
+
const logger = new TerminalLogger18;
|
|
9356
|
+
logger.success(`${join19(loggerLocalDir, name)}Logger.ts created successfully`, undefined, {
|
|
9229
9357
|
showTimestamp: false,
|
|
9230
9358
|
showArrow: false,
|
|
9231
9359
|
useSymbol: true
|
|
9232
9360
|
});
|
|
9233
|
-
logger.success(`${
|
|
9361
|
+
logger.success(`${join19(testsLocalDir, name)}Logger.spec.ts created successfully`, undefined, {
|
|
9234
9362
|
showTimestamp: false,
|
|
9235
9363
|
showArrow: false,
|
|
9236
9364
|
useSymbol: true
|
|
9237
9365
|
});
|
|
9238
|
-
const packageJsonPath =
|
|
9366
|
+
const packageJsonPath = join19(process.cwd(), "package.json");
|
|
9239
9367
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9240
9368
|
const deps = packageJson.dependencies ?? {};
|
|
9241
9369
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9250,17 +9378,17 @@ class MakeLoggerCommand {
|
|
|
9250
9378
|
}
|
|
9251
9379
|
}
|
|
9252
9380
|
MakeLoggerCommand = __legacyDecorateClassTS([
|
|
9253
|
-
|
|
9381
|
+
decorator19.command()
|
|
9254
9382
|
], MakeLoggerCommand);
|
|
9255
9383
|
// src/commands/MakeMailerCommand.ts
|
|
9256
|
-
import { join as
|
|
9257
|
-
import { decorator as
|
|
9258
|
-
import { TerminalLogger as
|
|
9384
|
+
import { join as join20 } from "path";
|
|
9385
|
+
import { decorator as decorator20 } from "@ooneex/command";
|
|
9386
|
+
import { TerminalLogger as TerminalLogger19 } from "@ooneex/logger";
|
|
9259
9387
|
import { toPascalCase as toPascalCase10 } from "@ooneex/utils";
|
|
9260
9388
|
|
|
9261
9389
|
// src/templates/mailer/mailer.test.txt
|
|
9262
9390
|
var mailer_test_default = `import { describe, expect, test } from "bun:test";
|
|
9263
|
-
import { {{NAME}}Mailer } from "
|
|
9391
|
+
import { {{NAME}}Mailer } from "@module/{{MODULE}}/mailers/{{NAME}}Mailer";
|
|
9264
9392
|
|
|
9265
9393
|
describe("{{NAME}}Mailer", () => {
|
|
9266
9394
|
test("should have class name ending with 'Mailer'", () => {
|
|
@@ -9303,7 +9431,7 @@ export class {{NAME}}Mailer implements IMailer {
|
|
|
9303
9431
|
|
|
9304
9432
|
// src/templates/mailer/mailer-template.test.txt
|
|
9305
9433
|
var mailer_template_test_default = `import { describe, expect, test } from "bun:test";
|
|
9306
|
-
import { {{NAME}}MailerTemplate } from "
|
|
9434
|
+
import { {{NAME}}MailerTemplate } from "@module/{{MODULE}}/mailers/{{NAME}}MailerTemplate";
|
|
9307
9435
|
|
|
9308
9436
|
describe("{{NAME}}MailerTemplate", () => {
|
|
9309
9437
|
test("should have function name ending with 'MailerTemplate'", () => {
|
|
@@ -9353,43 +9481,43 @@ class MakeMailerCommand {
|
|
|
9353
9481
|
if (module) {
|
|
9354
9482
|
await ensureModule(module);
|
|
9355
9483
|
}
|
|
9356
|
-
const base = module ?
|
|
9357
|
-
const mailerLocalDir =
|
|
9358
|
-
const mailerDir =
|
|
9359
|
-
const mailerFilePath =
|
|
9360
|
-
const templateFilePath =
|
|
9484
|
+
const base = module ? join20("modules", module) : ".";
|
|
9485
|
+
const mailerLocalDir = join20(base, "src", "mailers");
|
|
9486
|
+
const mailerDir = join20(process.cwd(), mailerLocalDir);
|
|
9487
|
+
const mailerFilePath = join20(mailerDir, `${name}Mailer.ts`);
|
|
9488
|
+
const templateFilePath = join20(mailerDir, `${name}MailerTemplate.tsx`);
|
|
9361
9489
|
await Bun.write(mailerFilePath, mailerContent);
|
|
9362
9490
|
await Bun.write(templateFilePath, templateContent);
|
|
9363
|
-
const mailerTestContent = mailer_test_default.replace(/{{NAME}}/g, name);
|
|
9364
|
-
const templateTestContent = mailer_template_test_default.replace(/{{NAME}}/g, name);
|
|
9365
|
-
const testsLocalDir =
|
|
9366
|
-
const testsDir =
|
|
9367
|
-
const mailerTestFilePath =
|
|
9368
|
-
const templateTestFilePath =
|
|
9491
|
+
const mailerTestContent = mailer_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9492
|
+
const templateTestContent = mailer_template_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9493
|
+
const testsLocalDir = join20(base, "tests", "mailers");
|
|
9494
|
+
const testsDir = join20(process.cwd(), testsLocalDir);
|
|
9495
|
+
const mailerTestFilePath = join20(testsDir, `${name}Mailer.spec.ts`);
|
|
9496
|
+
const templateTestFilePath = join20(testsDir, `${name}MailerTemplate.spec.ts`);
|
|
9369
9497
|
await Bun.write(mailerTestFilePath, mailerTestContent);
|
|
9370
9498
|
await Bun.write(templateTestFilePath, templateTestContent);
|
|
9371
|
-
const logger = new
|
|
9372
|
-
logger.success(`${
|
|
9499
|
+
const logger = new TerminalLogger19;
|
|
9500
|
+
logger.success(`${join20(mailerLocalDir, name)}Mailer.ts created successfully`, undefined, {
|
|
9373
9501
|
showTimestamp: false,
|
|
9374
9502
|
showArrow: false,
|
|
9375
9503
|
useSymbol: true
|
|
9376
9504
|
});
|
|
9377
|
-
logger.success(`${
|
|
9505
|
+
logger.success(`${join20(mailerLocalDir, name)}MailerTemplate.tsx created successfully`, undefined, {
|
|
9378
9506
|
showTimestamp: false,
|
|
9379
9507
|
showArrow: false,
|
|
9380
9508
|
useSymbol: true
|
|
9381
9509
|
});
|
|
9382
|
-
logger.success(`${
|
|
9510
|
+
logger.success(`${join20(testsLocalDir, name)}Mailer.spec.ts created successfully`, undefined, {
|
|
9383
9511
|
showTimestamp: false,
|
|
9384
9512
|
showArrow: false,
|
|
9385
9513
|
useSymbol: true
|
|
9386
9514
|
});
|
|
9387
|
-
logger.success(`${
|
|
9515
|
+
logger.success(`${join20(testsLocalDir, name)}MailerTemplate.spec.ts created successfully`, undefined, {
|
|
9388
9516
|
showTimestamp: false,
|
|
9389
9517
|
showArrow: false,
|
|
9390
9518
|
useSymbol: true
|
|
9391
9519
|
});
|
|
9392
|
-
const packageJsonPath =
|
|
9520
|
+
const packageJsonPath = join20(process.cwd(), "package.json");
|
|
9393
9521
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9394
9522
|
const deps = packageJson.dependencies ?? {};
|
|
9395
9523
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9404,12 +9532,12 @@ class MakeMailerCommand {
|
|
|
9404
9532
|
}
|
|
9405
9533
|
}
|
|
9406
9534
|
MakeMailerCommand = __legacyDecorateClassTS([
|
|
9407
|
-
|
|
9535
|
+
decorator20.command()
|
|
9408
9536
|
], MakeMailerCommand);
|
|
9409
9537
|
// src/commands/MakeMiddlewareCommand.ts
|
|
9410
|
-
import { basename as basename4, join as
|
|
9411
|
-
import { decorator as
|
|
9412
|
-
import { TerminalLogger as
|
|
9538
|
+
import { basename as basename4, join as join21 } from "path";
|
|
9539
|
+
import { decorator as decorator21 } from "@ooneex/command";
|
|
9540
|
+
import { TerminalLogger as TerminalLogger20 } from "@ooneex/logger";
|
|
9413
9541
|
import { toPascalCase as toPascalCase11 } from "@ooneex/utils";
|
|
9414
9542
|
|
|
9415
9543
|
// src/templates/middleware.socket.txt
|
|
@@ -9429,7 +9557,7 @@ export class {{NAME}}Middleware implements IMiddleware {
|
|
|
9429
9557
|
|
|
9430
9558
|
// src/templates/middleware.test.txt
|
|
9431
9559
|
var middleware_test_default = `import { describe, expect, test } from "bun:test";
|
|
9432
|
-
import { {{NAME}}Middleware } from "
|
|
9560
|
+
import { {{NAME}}Middleware } from "@module/{{MODULE}}/middlewares/{{NAME}}Middleware";
|
|
9433
9561
|
|
|
9434
9562
|
describe("{{NAME}}Middleware", () => {
|
|
9435
9563
|
test("should have class name ending with 'Middleware'", () => {
|
|
@@ -9498,33 +9626,33 @@ class MakeMiddlewareCommand {
|
|
|
9498
9626
|
if (module) {
|
|
9499
9627
|
await ensureModule(module);
|
|
9500
9628
|
}
|
|
9501
|
-
const base = module ?
|
|
9502
|
-
const middlewareLocalDir =
|
|
9503
|
-
const middlewareDir =
|
|
9504
|
-
const filePath =
|
|
9629
|
+
const base = module ? join21("modules", module) : ".";
|
|
9630
|
+
const middlewareLocalDir = join21(base, "src", "middlewares");
|
|
9631
|
+
const middlewareDir = join21(process.cwd(), middlewareLocalDir);
|
|
9632
|
+
const filePath = join21(middlewareDir, `${name}Middleware.ts`);
|
|
9505
9633
|
await Bun.write(filePath, content);
|
|
9506
|
-
const testContent = middleware_test_default.replace(/{{NAME}}/g, name);
|
|
9507
|
-
const testsLocalDir =
|
|
9508
|
-
const testsDir =
|
|
9509
|
-
const testFilePath =
|
|
9634
|
+
const testContent = middleware_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9635
|
+
const testsLocalDir = join21(base, "tests", "middlewares");
|
|
9636
|
+
const testsDir = join21(process.cwd(), testsLocalDir);
|
|
9637
|
+
const testFilePath = join21(testsDir, `${name}Middleware.spec.ts`);
|
|
9510
9638
|
await Bun.write(testFilePath, testContent);
|
|
9511
9639
|
const modulePascalName = module ? toPascalCase11(module) : toPascalCase11(basename4(process.cwd()));
|
|
9512
|
-
const modulePath =
|
|
9640
|
+
const modulePath = join21(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9513
9641
|
if (await Bun.file(modulePath).exists()) {
|
|
9514
9642
|
await this.addToModule(modulePath, name);
|
|
9515
9643
|
}
|
|
9516
|
-
const logger = new
|
|
9517
|
-
logger.success(`${
|
|
9644
|
+
const logger = new TerminalLogger20;
|
|
9645
|
+
logger.success(`${join21(middlewareLocalDir, name)}Middleware.ts created successfully`, undefined, {
|
|
9518
9646
|
showTimestamp: false,
|
|
9519
9647
|
showArrow: false,
|
|
9520
9648
|
useSymbol: true
|
|
9521
9649
|
});
|
|
9522
|
-
logger.success(`${
|
|
9650
|
+
logger.success(`${join21(testsLocalDir, name)}Middleware.spec.ts created successfully`, undefined, {
|
|
9523
9651
|
showTimestamp: false,
|
|
9524
9652
|
showArrow: false,
|
|
9525
9653
|
useSymbol: true
|
|
9526
9654
|
});
|
|
9527
|
-
const packageJsonPath =
|
|
9655
|
+
const packageJsonPath = join21(process.cwd(), "package.json");
|
|
9528
9656
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9529
9657
|
const deps = packageJson.dependencies ?? {};
|
|
9530
9658
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9539,12 +9667,12 @@ class MakeMiddlewareCommand {
|
|
|
9539
9667
|
}
|
|
9540
9668
|
}
|
|
9541
9669
|
MakeMiddlewareCommand = __legacyDecorateClassTS([
|
|
9542
|
-
|
|
9670
|
+
decorator21.command()
|
|
9543
9671
|
], MakeMiddlewareCommand);
|
|
9544
9672
|
// src/commands/MakeMigrationCommand.ts
|
|
9545
|
-
import { join as
|
|
9546
|
-
import { decorator as
|
|
9547
|
-
import { TerminalLogger as
|
|
9673
|
+
import { join as join22 } from "path";
|
|
9674
|
+
import { decorator as decorator22 } from "@ooneex/command";
|
|
9675
|
+
import { TerminalLogger as TerminalLogger21 } from "@ooneex/logger";
|
|
9548
9676
|
import { migrationCreate } from "@ooneex/migrations";
|
|
9549
9677
|
|
|
9550
9678
|
// src/templates/module/migration.up.txt
|
|
@@ -9572,17 +9700,17 @@ class MakeMigrationCommand {
|
|
|
9572
9700
|
if (module) {
|
|
9573
9701
|
await ensureModule(module);
|
|
9574
9702
|
}
|
|
9575
|
-
const base = module ?
|
|
9703
|
+
const base = module ? join22("modules", module) : ".";
|
|
9576
9704
|
const { migrationPath: filePath } = await migrationCreate({
|
|
9577
|
-
migrationsDir:
|
|
9578
|
-
testsDir:
|
|
9705
|
+
migrationsDir: join22(base, "src", "migrations"),
|
|
9706
|
+
testsDir: join22(base, "tests", "migrations")
|
|
9579
9707
|
});
|
|
9580
|
-
const binMigrationUpPath =
|
|
9708
|
+
const binMigrationUpPath = join22(process.cwd(), base, "bin", "migration", "up.ts");
|
|
9581
9709
|
const binMigrationUpFile = Bun.file(binMigrationUpPath);
|
|
9582
9710
|
if (!await binMigrationUpFile.exists()) {
|
|
9583
9711
|
await Bun.write(binMigrationUpPath, migration_up_default.replace(/{{name}}/g, module ?? ""));
|
|
9584
9712
|
}
|
|
9585
|
-
const logger = new
|
|
9713
|
+
const logger = new TerminalLogger21;
|
|
9586
9714
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
9587
9715
|
showTimestamp: false,
|
|
9588
9716
|
showArrow: false,
|
|
@@ -9591,18 +9719,18 @@ class MakeMigrationCommand {
|
|
|
9591
9719
|
}
|
|
9592
9720
|
}
|
|
9593
9721
|
MakeMigrationCommand = __legacyDecorateClassTS([
|
|
9594
|
-
|
|
9722
|
+
decorator22.command()
|
|
9595
9723
|
], MakeMigrationCommand);
|
|
9596
9724
|
// src/commands/MakePermissionCommand.ts
|
|
9597
|
-
import { join as
|
|
9598
|
-
import { decorator as
|
|
9599
|
-
import { TerminalLogger as
|
|
9725
|
+
import { join as join23 } from "path";
|
|
9726
|
+
import { decorator as decorator23 } from "@ooneex/command";
|
|
9727
|
+
import { TerminalLogger as TerminalLogger22 } from "@ooneex/logger";
|
|
9600
9728
|
import { toPascalCase as toPascalCase12 } from "@ooneex/utils";
|
|
9601
9729
|
|
|
9602
9730
|
// src/templates/permission.test.txt
|
|
9603
9731
|
var permission_test_default = `import { describe, expect, test } from "bun:test";
|
|
9604
9732
|
import { Permission } from "@ooneex/permission";
|
|
9605
|
-
import { {{NAME}}Permission } from "
|
|
9733
|
+
import { {{NAME}}Permission } from "@module/{{MODULE}}/permissions/{{NAME}}Permission";
|
|
9606
9734
|
|
|
9607
9735
|
describe("{{NAME}}Permission", () => {
|
|
9608
9736
|
test("should have class name ending with 'Permission'", () => {
|
|
@@ -9687,28 +9815,28 @@ class MakePermissionCommand {
|
|
|
9687
9815
|
if (module) {
|
|
9688
9816
|
await ensureModule(module);
|
|
9689
9817
|
}
|
|
9690
|
-
const base = module ?
|
|
9691
|
-
const permissionLocalDir =
|
|
9692
|
-
const permissionDir =
|
|
9693
|
-
const filePath =
|
|
9818
|
+
const base = module ? join23("modules", module) : ".";
|
|
9819
|
+
const permissionLocalDir = join23(base, "src", "permissions");
|
|
9820
|
+
const permissionDir = join23(process.cwd(), permissionLocalDir);
|
|
9821
|
+
const filePath = join23(permissionDir, `${name}Permission.ts`);
|
|
9694
9822
|
await Bun.write(filePath, content);
|
|
9695
|
-
const testContent = permission_test_default.replace(/{{NAME}}/g, name);
|
|
9696
|
-
const testsLocalDir =
|
|
9697
|
-
const testsDir =
|
|
9698
|
-
const testFilePath =
|
|
9823
|
+
const testContent = permission_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9824
|
+
const testsLocalDir = join23(base, "tests", "permissions");
|
|
9825
|
+
const testsDir = join23(process.cwd(), testsLocalDir);
|
|
9826
|
+
const testFilePath = join23(testsDir, `${name}Permission.spec.ts`);
|
|
9699
9827
|
await Bun.write(testFilePath, testContent);
|
|
9700
|
-
const logger = new
|
|
9701
|
-
logger.success(`${
|
|
9828
|
+
const logger = new TerminalLogger22;
|
|
9829
|
+
logger.success(`${join23(permissionLocalDir, name)}Permission.ts created successfully`, undefined, {
|
|
9702
9830
|
showTimestamp: false,
|
|
9703
9831
|
showArrow: false,
|
|
9704
9832
|
useSymbol: true
|
|
9705
9833
|
});
|
|
9706
|
-
logger.success(`${
|
|
9834
|
+
logger.success(`${join23(testsLocalDir, name)}Permission.spec.ts created successfully`, undefined, {
|
|
9707
9835
|
showTimestamp: false,
|
|
9708
9836
|
showArrow: false,
|
|
9709
9837
|
useSymbol: true
|
|
9710
9838
|
});
|
|
9711
|
-
const packageJsonPath =
|
|
9839
|
+
const packageJsonPath = join23(process.cwd(), "package.json");
|
|
9712
9840
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9713
9841
|
const deps = packageJson.dependencies ?? {};
|
|
9714
9842
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9723,17 +9851,17 @@ class MakePermissionCommand {
|
|
|
9723
9851
|
}
|
|
9724
9852
|
}
|
|
9725
9853
|
MakePermissionCommand = __legacyDecorateClassTS([
|
|
9726
|
-
|
|
9854
|
+
decorator23.command()
|
|
9727
9855
|
], MakePermissionCommand);
|
|
9728
9856
|
// src/commands/MakePubSubCommand.ts
|
|
9729
|
-
import { basename as basename5, join as
|
|
9730
|
-
import { decorator as
|
|
9731
|
-
import { TerminalLogger as
|
|
9857
|
+
import { basename as basename5, join as join24 } from "path";
|
|
9858
|
+
import { decorator as decorator24 } from "@ooneex/command";
|
|
9859
|
+
import { TerminalLogger as TerminalLogger23 } from "@ooneex/logger";
|
|
9732
9860
|
import { toKebabCase as toKebabCase4, toPascalCase as toPascalCase13 } from "@ooneex/utils";
|
|
9733
9861
|
|
|
9734
9862
|
// src/templates/pubsub.test.txt
|
|
9735
9863
|
var pubsub_test_default = `import { describe, expect, test } from "bun:test";
|
|
9736
|
-
import { {{NAME}}PubSub } from "
|
|
9864
|
+
import { {{NAME}}PubSub } from "@module/{{MODULE}}/pubsub/{{NAME}}PubSub";
|
|
9737
9865
|
|
|
9738
9866
|
describe("{{NAME}}PubSub", () => {
|
|
9739
9867
|
test("should have class name ending with 'PubSub'", () => {
|
|
@@ -9836,33 +9964,33 @@ class MakePubSubCommand {
|
|
|
9836
9964
|
if (module) {
|
|
9837
9965
|
await ensureModule(module);
|
|
9838
9966
|
}
|
|
9839
|
-
const base = module ?
|
|
9840
|
-
const pubSubLocalDir =
|
|
9841
|
-
const pubSubDir =
|
|
9842
|
-
const filePath =
|
|
9967
|
+
const base = module ? join24("modules", module) : ".";
|
|
9968
|
+
const pubSubLocalDir = join24(base, "src", "events");
|
|
9969
|
+
const pubSubDir = join24(process.cwd(), pubSubLocalDir);
|
|
9970
|
+
const filePath = join24(pubSubDir, `${name}Event.ts`);
|
|
9843
9971
|
await Bun.write(filePath, content);
|
|
9844
|
-
const testContent = pubsub_test_default.replace(/{{NAME}}/g, name);
|
|
9845
|
-
const testsLocalDir =
|
|
9846
|
-
const testsDir =
|
|
9847
|
-
const testFilePath =
|
|
9972
|
+
const testContent = pubsub_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9973
|
+
const testsLocalDir = join24(base, "tests", "events");
|
|
9974
|
+
const testsDir = join24(process.cwd(), testsLocalDir);
|
|
9975
|
+
const testFilePath = join24(testsDir, `${name}Event.spec.ts`);
|
|
9848
9976
|
await Bun.write(testFilePath, testContent);
|
|
9849
9977
|
const modulePascalName = module ? toPascalCase13(module) : toPascalCase13(basename5(process.cwd()));
|
|
9850
|
-
const modulePath =
|
|
9978
|
+
const modulePath = join24(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9851
9979
|
if (await Bun.file(modulePath).exists()) {
|
|
9852
9980
|
await this.addToModule(modulePath, name);
|
|
9853
9981
|
}
|
|
9854
|
-
const logger = new
|
|
9855
|
-
logger.success(`${
|
|
9982
|
+
const logger = new TerminalLogger23;
|
|
9983
|
+
logger.success(`${join24(pubSubLocalDir, name)}Event.ts created successfully`, undefined, {
|
|
9856
9984
|
showTimestamp: false,
|
|
9857
9985
|
showArrow: false,
|
|
9858
9986
|
useSymbol: true
|
|
9859
9987
|
});
|
|
9860
|
-
logger.success(`${
|
|
9988
|
+
logger.success(`${join24(testsLocalDir, name)}Event.spec.ts created successfully`, undefined, {
|
|
9861
9989
|
showTimestamp: false,
|
|
9862
9990
|
showArrow: false,
|
|
9863
9991
|
useSymbol: true
|
|
9864
9992
|
});
|
|
9865
|
-
const packageJsonPath =
|
|
9993
|
+
const packageJsonPath = join24(process.cwd(), "package.json");
|
|
9866
9994
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9867
9995
|
const deps = packageJson.dependencies ?? {};
|
|
9868
9996
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9877,13 +10005,13 @@ class MakePubSubCommand {
|
|
|
9877
10005
|
}
|
|
9878
10006
|
}
|
|
9879
10007
|
MakePubSubCommand = __legacyDecorateClassTS([
|
|
9880
|
-
|
|
10008
|
+
decorator24.command()
|
|
9881
10009
|
], MakePubSubCommand);
|
|
9882
10010
|
// src/commands/MakeReleaseCommand.ts
|
|
9883
10011
|
import { readdir } from "fs/promises";
|
|
9884
|
-
import { join as
|
|
9885
|
-
import { decorator as
|
|
9886
|
-
import { TerminalLogger as
|
|
10012
|
+
import { join as join25 } from "path";
|
|
10013
|
+
import { decorator as decorator25 } from "@ooneex/command";
|
|
10014
|
+
import { TerminalLogger as TerminalLogger24 } from "@ooneex/logger";
|
|
9887
10015
|
var {$ } = globalThis.Bun;
|
|
9888
10016
|
var COMMIT_TYPE_TO_CATEGORY = {
|
|
9889
10017
|
feat: "Added",
|
|
@@ -9906,7 +10034,7 @@ class MakeReleaseCommand {
|
|
|
9906
10034
|
return "Release packages with version bump, changelog, and git tag";
|
|
9907
10035
|
}
|
|
9908
10036
|
async run() {
|
|
9909
|
-
const logger = new
|
|
10037
|
+
const logger = new TerminalLogger24;
|
|
9910
10038
|
const cwd = process.cwd();
|
|
9911
10039
|
const dirs = [];
|
|
9912
10040
|
for (const { name, type } of [
|
|
@@ -9914,8 +10042,8 @@ class MakeReleaseCommand {
|
|
|
9914
10042
|
{ name: "modules", type: "module" }
|
|
9915
10043
|
]) {
|
|
9916
10044
|
try {
|
|
9917
|
-
const entries = await readdir(
|
|
9918
|
-
dirs.push(...entries.filter((d) => d.isDirectory()).map((d) => ({ base:
|
|
10045
|
+
const entries = await readdir(join25(cwd, name), { withFileTypes: true });
|
|
10046
|
+
dirs.push(...entries.filter((d) => d.isDirectory()).map((d) => ({ base: join25(name, d.name), type })));
|
|
9919
10047
|
} catch {}
|
|
9920
10048
|
}
|
|
9921
10049
|
const logOptions = { showTimestamp: false, showArrow: false, useSymbol: true };
|
|
@@ -9925,8 +10053,8 @@ class MakeReleaseCommand {
|
|
|
9925
10053
|
}
|
|
9926
10054
|
let releasedCount = 0;
|
|
9927
10055
|
for (const dir of dirs) {
|
|
9928
|
-
const fullDir =
|
|
9929
|
-
const pkgJsonPath =
|
|
10056
|
+
const fullDir = join25(cwd, dir.base);
|
|
10057
|
+
const pkgJsonPath = join25(fullDir, "package.json");
|
|
9930
10058
|
const pkgJsonFile = Bun.file(pkgJsonPath);
|
|
9931
10059
|
if (!await pkgJsonFile.exists()) {
|
|
9932
10060
|
continue;
|
|
@@ -9944,7 +10072,7 @@ class MakeReleaseCommand {
|
|
|
9944
10072
|
await Bun.write(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}
|
|
9945
10073
|
`);
|
|
9946
10074
|
await this.updateChangelog(fullDir, newVersion, tag, commits);
|
|
9947
|
-
await this.gitAdd(
|
|
10075
|
+
await this.gitAdd(join25(dir.base, "package.json"), join25(dir.base, "CHANGELOG.md"));
|
|
9948
10076
|
await this.gitCommit(`chore(release): ${pkgJson.name}@${newVersion}`);
|
|
9949
10077
|
await this.gitTag(tag, `chore(release): ${pkgJson.name}@${newVersion}`);
|
|
9950
10078
|
logger.success(`${pkgJson.name}@${newVersion} released (${bumpType} bump, ${commits.length} commit(s))`, undefined, logOptions);
|
|
@@ -10045,7 +10173,7 @@ class MakeReleaseCommand {
|
|
|
10045
10173
|
}
|
|
10046
10174
|
}
|
|
10047
10175
|
async updateChangelog(dir, version, tag, commits) {
|
|
10048
|
-
const changelogPath =
|
|
10176
|
+
const changelogPath = join25(dir, "CHANGELOG.md");
|
|
10049
10177
|
const today = new Date().toISOString().split("T")[0];
|
|
10050
10178
|
const repoUrl = await this.getRepoUrl();
|
|
10051
10179
|
const grouped = new Map;
|
|
@@ -10122,17 +10250,17 @@ ${section}
|
|
|
10122
10250
|
}
|
|
10123
10251
|
}
|
|
10124
10252
|
MakeReleaseCommand = __legacyDecorateClassTS([
|
|
10125
|
-
|
|
10253
|
+
decorator25.command()
|
|
10126
10254
|
], MakeReleaseCommand);
|
|
10127
10255
|
// src/commands/MakeRepositoryCommand.ts
|
|
10128
|
-
import { join as
|
|
10129
|
-
import { decorator as
|
|
10130
|
-
import { TerminalLogger as
|
|
10256
|
+
import { join as join26 } from "path";
|
|
10257
|
+
import { decorator as decorator26 } from "@ooneex/command";
|
|
10258
|
+
import { TerminalLogger as TerminalLogger25 } from "@ooneex/logger";
|
|
10131
10259
|
import { toPascalCase as toPascalCase14 } from "@ooneex/utils";
|
|
10132
10260
|
|
|
10133
10261
|
// src/templates/repository.test.txt
|
|
10134
10262
|
var repository_test_default = `import { describe, expect, test } from "bun:test";
|
|
10135
|
-
import { {{NAME}}Repository } from "
|
|
10263
|
+
import { {{NAME}}Repository } from "@module/{{MODULE}}/repositories/{{NAME}}Repository";
|
|
10136
10264
|
|
|
10137
10265
|
describe("{{NAME}}Repository", () => {
|
|
10138
10266
|
test("should have class name ending with 'Repository'", () => {
|
|
@@ -10341,28 +10469,28 @@ class MakeRepositoryCommand {
|
|
|
10341
10469
|
if (module) {
|
|
10342
10470
|
await ensureModule(module);
|
|
10343
10471
|
}
|
|
10344
|
-
const base = module ?
|
|
10345
|
-
const repositoriesLocalDir =
|
|
10346
|
-
const repositoriesDir =
|
|
10347
|
-
const filePath =
|
|
10472
|
+
const base = module ? join26("modules", module) : ".";
|
|
10473
|
+
const repositoriesLocalDir = join26(base, "src", "repositories");
|
|
10474
|
+
const repositoriesDir = join26(process.cwd(), repositoriesLocalDir);
|
|
10475
|
+
const filePath = join26(repositoriesDir, `${name}Repository.ts`);
|
|
10348
10476
|
await Bun.write(filePath, content);
|
|
10349
|
-
const testContent = repository_test_default.replace(/{{NAME}}/g, name);
|
|
10350
|
-
const testsLocalDir =
|
|
10351
|
-
const testsDir =
|
|
10352
|
-
const testFilePath =
|
|
10477
|
+
const testContent = repository_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
10478
|
+
const testsLocalDir = join26(base, "tests", "repositories");
|
|
10479
|
+
const testsDir = join26(process.cwd(), testsLocalDir);
|
|
10480
|
+
const testFilePath = join26(testsDir, `${name}Repository.spec.ts`);
|
|
10353
10481
|
await Bun.write(testFilePath, testContent);
|
|
10354
|
-
const logger = new
|
|
10355
|
-
logger.success(`${
|
|
10482
|
+
const logger = new TerminalLogger25;
|
|
10483
|
+
logger.success(`${join26(repositoriesLocalDir, name)}Repository.ts created successfully`, undefined, {
|
|
10356
10484
|
showTimestamp: false,
|
|
10357
10485
|
showArrow: false,
|
|
10358
10486
|
useSymbol: true
|
|
10359
10487
|
});
|
|
10360
|
-
logger.success(`${
|
|
10488
|
+
logger.success(`${join26(testsLocalDir, name)}Repository.spec.ts created successfully`, undefined, {
|
|
10361
10489
|
showTimestamp: false,
|
|
10362
10490
|
showArrow: false,
|
|
10363
10491
|
useSymbol: true
|
|
10364
10492
|
});
|
|
10365
|
-
const packageJsonPath =
|
|
10493
|
+
const packageJsonPath = join26(process.cwd(), "package.json");
|
|
10366
10494
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
10367
10495
|
const deps = packageJson.dependencies ?? {};
|
|
10368
10496
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -10377,11 +10505,11 @@ class MakeRepositoryCommand {
|
|
|
10377
10505
|
}
|
|
10378
10506
|
}
|
|
10379
10507
|
MakeRepositoryCommand = __legacyDecorateClassTS([
|
|
10380
|
-
|
|
10508
|
+
decorator26.command()
|
|
10381
10509
|
], MakeRepositoryCommand);
|
|
10382
10510
|
// src/commands/MakeResourceBookCommand.ts
|
|
10383
|
-
import { join as
|
|
10384
|
-
import { decorator as
|
|
10511
|
+
import { join as join28 } from "path";
|
|
10512
|
+
import { decorator as decorator28 } from "@ooneex/command";
|
|
10385
10513
|
var {Glob } = globalThis.Bun;
|
|
10386
10514
|
|
|
10387
10515
|
// src/templates/resources/book/BookEntity.txt
|
|
@@ -11077,14 +11205,14 @@ export class UpdateBookService implements IService {
|
|
|
11077
11205
|
`;
|
|
11078
11206
|
|
|
11079
11207
|
// src/commands/MakeServiceCommand.ts
|
|
11080
|
-
import { join as
|
|
11081
|
-
import { decorator as
|
|
11082
|
-
import { TerminalLogger as
|
|
11208
|
+
import { join as join27 } from "path";
|
|
11209
|
+
import { decorator as decorator27 } from "@ooneex/command";
|
|
11210
|
+
import { TerminalLogger as TerminalLogger26 } from "@ooneex/logger";
|
|
11083
11211
|
import { toPascalCase as toPascalCase15 } from "@ooneex/utils";
|
|
11084
11212
|
|
|
11085
11213
|
// src/templates/service.test.txt
|
|
11086
11214
|
var service_test_default = `import { describe, expect, test } from "bun:test";
|
|
11087
|
-
import { {{NAME}}Service } from "
|
|
11215
|
+
import { {{NAME}}Service } from "@module/{{MODULE}}/services/{{NAME}}Service";
|
|
11088
11216
|
|
|
11089
11217
|
describe("{{NAME}}Service", () => {
|
|
11090
11218
|
test("should have class name ending with 'Service'", () => {
|
|
@@ -11131,28 +11259,28 @@ class MakeServiceCommand {
|
|
|
11131
11259
|
if (module) {
|
|
11132
11260
|
await ensureModule(module);
|
|
11133
11261
|
}
|
|
11134
|
-
const base = module ?
|
|
11135
|
-
const serviceLocalDir =
|
|
11136
|
-
const serviceDir =
|
|
11137
|
-
const filePath =
|
|
11262
|
+
const base = module ? join27("modules", module) : ".";
|
|
11263
|
+
const serviceLocalDir = join27(base, "src", "services");
|
|
11264
|
+
const serviceDir = join27(process.cwd(), serviceLocalDir);
|
|
11265
|
+
const filePath = join27(serviceDir, `${name}Service.ts`);
|
|
11138
11266
|
await Bun.write(filePath, content);
|
|
11139
|
-
const testContent = service_test_default.replace(/{{NAME}}/g, name);
|
|
11140
|
-
const testsLocalDir =
|
|
11141
|
-
const testsDir =
|
|
11142
|
-
const testFilePath =
|
|
11267
|
+
const testContent = service_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
11268
|
+
const testsLocalDir = join27(base, "tests", "services");
|
|
11269
|
+
const testsDir = join27(process.cwd(), testsLocalDir);
|
|
11270
|
+
const testFilePath = join27(testsDir, `${name}Service.spec.ts`);
|
|
11143
11271
|
await Bun.write(testFilePath, testContent);
|
|
11144
|
-
const logger = new
|
|
11145
|
-
logger.success(`${
|
|
11272
|
+
const logger = new TerminalLogger26;
|
|
11273
|
+
logger.success(`${join27(serviceLocalDir, name)}Service.ts created successfully`, undefined, {
|
|
11146
11274
|
showTimestamp: false,
|
|
11147
11275
|
showArrow: false,
|
|
11148
11276
|
useSymbol: true
|
|
11149
11277
|
});
|
|
11150
|
-
logger.success(`${
|
|
11278
|
+
logger.success(`${join27(testsLocalDir, name)}Service.spec.ts created successfully`, undefined, {
|
|
11151
11279
|
showTimestamp: false,
|
|
11152
11280
|
showArrow: false,
|
|
11153
11281
|
useSymbol: true
|
|
11154
11282
|
});
|
|
11155
|
-
const packageJsonPath =
|
|
11283
|
+
const packageJsonPath = join27(process.cwd(), "package.json");
|
|
11156
11284
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
11157
11285
|
const deps = packageJson.dependencies ?? {};
|
|
11158
11286
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -11167,7 +11295,7 @@ class MakeServiceCommand {
|
|
|
11167
11295
|
}
|
|
11168
11296
|
}
|
|
11169
11297
|
MakeServiceCommand = __legacyDecorateClassTS([
|
|
11170
|
-
|
|
11298
|
+
decorator27.command()
|
|
11171
11299
|
], MakeServiceCommand);
|
|
11172
11300
|
|
|
11173
11301
|
// src/commands/MakeResourceBookCommand.ts
|
|
@@ -11180,9 +11308,9 @@ class MakeResourceBookCommand {
|
|
|
11180
11308
|
}
|
|
11181
11309
|
async run() {
|
|
11182
11310
|
const module = "book";
|
|
11183
|
-
const base =
|
|
11311
|
+
const base = join28("modules", module);
|
|
11184
11312
|
const makeModuleCommand = new MakeModuleCommand;
|
|
11185
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
11313
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
11186
11314
|
const makeEntityCommand = new MakeEntityCommand;
|
|
11187
11315
|
await makeEntityCommand.run({ name: "Book", module, tableName: "books" });
|
|
11188
11316
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -11200,26 +11328,26 @@ class MakeResourceBookCommand {
|
|
|
11200
11328
|
for (const controller of controllers) {
|
|
11201
11329
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
11202
11330
|
}
|
|
11203
|
-
const controllersDir =
|
|
11204
|
-
await Bun.write(
|
|
11205
|
-
await Bun.write(
|
|
11206
|
-
await Bun.write(
|
|
11207
|
-
await Bun.write(
|
|
11208
|
-
await Bun.write(
|
|
11331
|
+
const controllersDir = join28(process.cwd(), base, "src", "controllers");
|
|
11332
|
+
await Bun.write(join28(controllersDir, "CreateBookController.ts"), CreateBookController_default);
|
|
11333
|
+
await Bun.write(join28(controllersDir, "GetBookController.ts"), GetBookController_default);
|
|
11334
|
+
await Bun.write(join28(controllersDir, "ListBooksController.ts"), ListBooksController_default);
|
|
11335
|
+
await Bun.write(join28(controllersDir, "UpdateBookController.ts"), UpdateBookController_default);
|
|
11336
|
+
await Bun.write(join28(controllersDir, "DeleteBookController.ts"), DeleteBookController_default);
|
|
11209
11337
|
const makeServiceCommand = new MakeServiceCommand;
|
|
11210
11338
|
const services = ["CreateBook", "GetBook", "ListBooks", "UpdateBook", "DeleteBook"];
|
|
11211
11339
|
for (const name of services) {
|
|
11212
11340
|
await makeServiceCommand.run({ name, module });
|
|
11213
11341
|
}
|
|
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 =
|
|
11342
|
+
const servicesDir = join28(process.cwd(), base, "src", "services");
|
|
11343
|
+
await Bun.write(join28(servicesDir, "CreateBookService.ts"), CreateBookService_default);
|
|
11344
|
+
await Bun.write(join28(servicesDir, "GetBookService.ts"), GetBookService_default);
|
|
11345
|
+
await Bun.write(join28(servicesDir, "ListBooksService.ts"), ListBooksService_default);
|
|
11346
|
+
await Bun.write(join28(servicesDir, "UpdateBookService.ts"), UpdateBookService_default);
|
|
11347
|
+
await Bun.write(join28(servicesDir, "DeleteBookService.ts"), DeleteBookService_default);
|
|
11348
|
+
const entityPath = join28(process.cwd(), base, "src", "entities", "BookEntity.ts");
|
|
11221
11349
|
await Bun.write(entityPath, BookEntity_default);
|
|
11222
|
-
const migrationsDir =
|
|
11350
|
+
const migrationsDir = join28(process.cwd(), base, "src", "migrations");
|
|
11223
11351
|
const glob = new Glob("Migration*.ts");
|
|
11224
11352
|
for await (const file of glob.scan(migrationsDir)) {
|
|
11225
11353
|
if (file === "migrations.ts")
|
|
@@ -11227,18 +11355,18 @@ class MakeResourceBookCommand {
|
|
|
11227
11355
|
const name = file.replace(/\.ts$/, "");
|
|
11228
11356
|
const version = name.replace("Migration", "");
|
|
11229
11357
|
const content = BookMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
11230
|
-
await Bun.write(
|
|
11358
|
+
await Bun.write(join28(migrationsDir, file), content);
|
|
11231
11359
|
}
|
|
11232
|
-
const repositoryPath =
|
|
11360
|
+
const repositoryPath = join28(process.cwd(), base, "src", "repositories", "BookRepository.ts");
|
|
11233
11361
|
await Bun.write(repositoryPath, BookRepository_default);
|
|
11234
11362
|
}
|
|
11235
11363
|
}
|
|
11236
11364
|
MakeResourceBookCommand = __legacyDecorateClassTS([
|
|
11237
|
-
|
|
11365
|
+
decorator28.command()
|
|
11238
11366
|
], MakeResourceBookCommand);
|
|
11239
11367
|
// src/commands/MakeResourceCalendarEventCommand.ts
|
|
11240
|
-
import { join as
|
|
11241
|
-
import { decorator as
|
|
11368
|
+
import { join as join29 } from "path";
|
|
11369
|
+
import { decorator as decorator29 } from "@ooneex/command";
|
|
11242
11370
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
11243
11371
|
|
|
11244
11372
|
// src/templates/resources/calendar-event/CalendarEventEntity.txt
|
|
@@ -11930,9 +12058,9 @@ class MakeResourceCalendarEventCommand {
|
|
|
11930
12058
|
}
|
|
11931
12059
|
async run() {
|
|
11932
12060
|
const module = "calendar-event";
|
|
11933
|
-
const base =
|
|
12061
|
+
const base = join29("modules", module);
|
|
11934
12062
|
const makeModuleCommand = new MakeModuleCommand;
|
|
11935
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
12063
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
11936
12064
|
const makeEntityCommand = new MakeEntityCommand;
|
|
11937
12065
|
await makeEntityCommand.run({ name: "CalendarEvent", module, tableName: "calendar_events" });
|
|
11938
12066
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -11965,12 +12093,12 @@ class MakeResourceCalendarEventCommand {
|
|
|
11965
12093
|
for (const controller of controllers) {
|
|
11966
12094
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
11967
12095
|
}
|
|
11968
|
-
const controllersDir =
|
|
11969
|
-
await Bun.write(
|
|
11970
|
-
await Bun.write(
|
|
11971
|
-
await Bun.write(
|
|
11972
|
-
await Bun.write(
|
|
11973
|
-
await Bun.write(
|
|
12096
|
+
const controllersDir = join29(process.cwd(), base, "src", "controllers");
|
|
12097
|
+
await Bun.write(join29(controllersDir, "CreateCalendarEventController.ts"), CreateCalendarEventController_default);
|
|
12098
|
+
await Bun.write(join29(controllersDir, "GetCalendarEventController.ts"), GetCalendarEventController_default);
|
|
12099
|
+
await Bun.write(join29(controllersDir, "ListCalendarEventsController.ts"), ListCalendarEventsController_default);
|
|
12100
|
+
await Bun.write(join29(controllersDir, "UpdateCalendarEventController.ts"), UpdateCalendarEventController_default);
|
|
12101
|
+
await Bun.write(join29(controllersDir, "DeleteCalendarEventController.ts"), DeleteCalendarEventController_default);
|
|
11974
12102
|
const makeServiceCommand = new MakeServiceCommand;
|
|
11975
12103
|
const services = [
|
|
11976
12104
|
"CreateCalendarEvent",
|
|
@@ -11982,15 +12110,15 @@ class MakeResourceCalendarEventCommand {
|
|
|
11982
12110
|
for (const name of services) {
|
|
11983
12111
|
await makeServiceCommand.run({ name, module });
|
|
11984
12112
|
}
|
|
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 =
|
|
12113
|
+
const servicesDir = join29(process.cwd(), base, "src", "services");
|
|
12114
|
+
await Bun.write(join29(servicesDir, "CreateCalendarEventService.ts"), CreateCalendarEventService_default);
|
|
12115
|
+
await Bun.write(join29(servicesDir, "GetCalendarEventService.ts"), GetCalendarEventService_default);
|
|
12116
|
+
await Bun.write(join29(servicesDir, "ListCalendarEventsService.ts"), ListCalendarEventsService_default);
|
|
12117
|
+
await Bun.write(join29(servicesDir, "UpdateCalendarEventService.ts"), UpdateCalendarEventService_default);
|
|
12118
|
+
await Bun.write(join29(servicesDir, "DeleteCalendarEventService.ts"), DeleteCalendarEventService_default);
|
|
12119
|
+
const entityPath = join29(process.cwd(), base, "src", "entities", "CalendarEventEntity.ts");
|
|
11992
12120
|
await Bun.write(entityPath, CalendarEventEntity_default);
|
|
11993
|
-
const migrationsDir =
|
|
12121
|
+
const migrationsDir = join29(process.cwd(), base, "src", "migrations");
|
|
11994
12122
|
const glob = new Glob2("Migration*.ts");
|
|
11995
12123
|
for await (const file of glob.scan(migrationsDir)) {
|
|
11996
12124
|
if (file === "migrations.ts")
|
|
@@ -11998,18 +12126,18 @@ class MakeResourceCalendarEventCommand {
|
|
|
11998
12126
|
const name = file.replace(/\.ts$/, "");
|
|
11999
12127
|
const version = name.replace("Migration", "");
|
|
12000
12128
|
const content = CalendarEventMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
12001
|
-
await Bun.write(
|
|
12129
|
+
await Bun.write(join29(migrationsDir, file), content);
|
|
12002
12130
|
}
|
|
12003
|
-
const repositoryPath =
|
|
12131
|
+
const repositoryPath = join29(process.cwd(), base, "src", "repositories", "CalendarEventRepository.ts");
|
|
12004
12132
|
await Bun.write(repositoryPath, CalendarEventRepository_default);
|
|
12005
12133
|
}
|
|
12006
12134
|
}
|
|
12007
12135
|
MakeResourceCalendarEventCommand = __legacyDecorateClassTS([
|
|
12008
|
-
|
|
12136
|
+
decorator29.command()
|
|
12009
12137
|
], MakeResourceCalendarEventCommand);
|
|
12010
12138
|
// src/commands/MakeResourceCategoryCommand.ts
|
|
12011
|
-
import { join as
|
|
12012
|
-
import { decorator as
|
|
12139
|
+
import { join as join30 } from "path";
|
|
12140
|
+
import { decorator as decorator30 } from "@ooneex/command";
|
|
12013
12141
|
var {Glob: Glob3 } = globalThis.Bun;
|
|
12014
12142
|
|
|
12015
12143
|
// src/templates/resources/category/CategoryEntity.txt
|
|
@@ -12600,9 +12728,9 @@ class MakeResourceCategoryCommand {
|
|
|
12600
12728
|
}
|
|
12601
12729
|
async run() {
|
|
12602
12730
|
const module = "category";
|
|
12603
|
-
const base =
|
|
12731
|
+
const base = join30("modules", module);
|
|
12604
12732
|
const makeModuleCommand = new MakeModuleCommand;
|
|
12605
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
12733
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
12606
12734
|
const makeEntityCommand = new MakeEntityCommand;
|
|
12607
12735
|
await makeEntityCommand.run({ name: "Category", module, tableName: "categories" });
|
|
12608
12736
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -12635,26 +12763,26 @@ class MakeResourceCategoryCommand {
|
|
|
12635
12763
|
for (const controller of controllers) {
|
|
12636
12764
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
12637
12765
|
}
|
|
12638
|
-
const controllersDir =
|
|
12639
|
-
await Bun.write(
|
|
12640
|
-
await Bun.write(
|
|
12641
|
-
await Bun.write(
|
|
12642
|
-
await Bun.write(
|
|
12643
|
-
await Bun.write(
|
|
12766
|
+
const controllersDir = join30(process.cwd(), base, "src", "controllers");
|
|
12767
|
+
await Bun.write(join30(controllersDir, "CreateCategoryController.ts"), CreateCategoryController_default);
|
|
12768
|
+
await Bun.write(join30(controllersDir, "GetCategoryController.ts"), GetCategoryController_default);
|
|
12769
|
+
await Bun.write(join30(controllersDir, "ListCategoriesController.ts"), ListCategoriesController_default);
|
|
12770
|
+
await Bun.write(join30(controllersDir, "UpdateCategoryController.ts"), UpdateCategoryController_default);
|
|
12771
|
+
await Bun.write(join30(controllersDir, "DeleteCategoryController.ts"), DeleteCategoryController_default);
|
|
12644
12772
|
const makeServiceCommand = new MakeServiceCommand;
|
|
12645
12773
|
const services = ["CreateCategory", "GetCategory", "ListCategories", "UpdateCategory", "DeleteCategory"];
|
|
12646
12774
|
for (const name of services) {
|
|
12647
12775
|
await makeServiceCommand.run({ name, module });
|
|
12648
12776
|
}
|
|
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 =
|
|
12777
|
+
const servicesDir = join30(process.cwd(), base, "src", "services");
|
|
12778
|
+
await Bun.write(join30(servicesDir, "CreateCategoryService.ts"), CreateCategoryService_default);
|
|
12779
|
+
await Bun.write(join30(servicesDir, "GetCategoryService.ts"), GetCategoryService_default);
|
|
12780
|
+
await Bun.write(join30(servicesDir, "ListCategoriesService.ts"), ListCategoriesService_default);
|
|
12781
|
+
await Bun.write(join30(servicesDir, "UpdateCategoryService.ts"), UpdateCategoryService_default);
|
|
12782
|
+
await Bun.write(join30(servicesDir, "DeleteCategoryService.ts"), DeleteCategoryService_default);
|
|
12783
|
+
const entityPath = join30(process.cwd(), base, "src", "entities", "CategoryEntity.ts");
|
|
12656
12784
|
await Bun.write(entityPath, CategoryEntity_default);
|
|
12657
|
-
const migrationsDir =
|
|
12785
|
+
const migrationsDir = join30(process.cwd(), base, "src", "migrations");
|
|
12658
12786
|
const glob = new Glob3("Migration*.ts");
|
|
12659
12787
|
for await (const file of glob.scan(migrationsDir)) {
|
|
12660
12788
|
if (file === "migrations.ts")
|
|
@@ -12662,18 +12790,18 @@ class MakeResourceCategoryCommand {
|
|
|
12662
12790
|
const name = file.replace(/\.ts$/, "");
|
|
12663
12791
|
const version = name.replace("Migration", "");
|
|
12664
12792
|
const content = CategoryMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
12665
|
-
await Bun.write(
|
|
12793
|
+
await Bun.write(join30(migrationsDir, file), content);
|
|
12666
12794
|
}
|
|
12667
|
-
const repositoryPath =
|
|
12795
|
+
const repositoryPath = join30(process.cwd(), base, "src", "repositories", "CategoryRepository.ts");
|
|
12668
12796
|
await Bun.write(repositoryPath, CategoryRepository_default);
|
|
12669
12797
|
}
|
|
12670
12798
|
}
|
|
12671
12799
|
MakeResourceCategoryCommand = __legacyDecorateClassTS([
|
|
12672
|
-
|
|
12800
|
+
decorator30.command()
|
|
12673
12801
|
], MakeResourceCategoryCommand);
|
|
12674
12802
|
// src/commands/MakeResourceColorCommand.ts
|
|
12675
|
-
import { join as
|
|
12676
|
-
import { decorator as
|
|
12803
|
+
import { join as join32 } from "path";
|
|
12804
|
+
import { decorator as decorator32 } from "@ooneex/command";
|
|
12677
12805
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
12678
12806
|
|
|
12679
12807
|
// src/templates/resources/color/ColorEntity.txt
|
|
@@ -13111,18 +13239,27 @@ export class UpdateColorController {
|
|
|
13111
13239
|
`;
|
|
13112
13240
|
|
|
13113
13241
|
// src/templates/resources/color/seeds/ColorSeed.txt
|
|
13114
|
-
var ColorSeed_default = `import {
|
|
13242
|
+
var ColorSeed_default = `import { inject } from "@ooneex/container";
|
|
13115
13243
|
import { decorator, type ISeed, type SeedClassType } from "@ooneex/seeds";
|
|
13244
|
+
import type { LocaleType } from "@ooneex/translation";
|
|
13116
13245
|
import { ColorEntity } from "../entities/ColorEntity";
|
|
13117
13246
|
import { ColorRepository } from "../repositories/ColorRepository";
|
|
13118
|
-
import data from "./
|
|
13247
|
+
import data from "./color-seed.yml";
|
|
13248
|
+
|
|
13249
|
+
type ColorSeedDataType = {
|
|
13250
|
+
id: string;
|
|
13251
|
+
name: string;
|
|
13252
|
+
hex: string;
|
|
13253
|
+
description?: string;
|
|
13254
|
+
lang?: LocaleType;
|
|
13255
|
+
};
|
|
13119
13256
|
|
|
13120
13257
|
@decorator.seed()
|
|
13121
13258
|
export class ColorSeed implements ISeed {
|
|
13122
|
-
|
|
13123
|
-
const repository = resolve(ColorRepository);
|
|
13259
|
+
constructor(@inject(ColorRepository) private readonly repository: ColorRepository) {}
|
|
13124
13260
|
|
|
13125
|
-
|
|
13261
|
+
public async run<T>(): Promise<T> {
|
|
13262
|
+
const entities = (data as ColorSeedDataType[]).map((item) => {
|
|
13126
13263
|
const entity = new ColorEntity();
|
|
13127
13264
|
entity.id = item.id;
|
|
13128
13265
|
entity.name = item.name;
|
|
@@ -13133,8 +13270,8 @@ export class ColorSeed implements ISeed {
|
|
|
13133
13270
|
return entity;
|
|
13134
13271
|
});
|
|
13135
13272
|
|
|
13136
|
-
const result = await repository.createMany(entities);
|
|
13137
|
-
await repository.close();
|
|
13273
|
+
const result = await this.repository.createMany(entities);
|
|
13274
|
+
await this.repository.close();
|
|
13138
13275
|
|
|
13139
13276
|
return result as T;
|
|
13140
13277
|
}
|
|
@@ -13456,9 +13593,9 @@ export class UpdateColorService implements IService {
|
|
|
13456
13593
|
`;
|
|
13457
13594
|
|
|
13458
13595
|
// src/commands/MakeSeedCommand.ts
|
|
13459
|
-
import { join as
|
|
13460
|
-
import { decorator as
|
|
13461
|
-
import { TerminalLogger as
|
|
13596
|
+
import { join as join31 } from "path";
|
|
13597
|
+
import { decorator as decorator31 } from "@ooneex/command";
|
|
13598
|
+
import { TerminalLogger as TerminalLogger27 } from "@ooneex/logger";
|
|
13462
13599
|
import { seedCreate } from "@ooneex/seeds";
|
|
13463
13600
|
|
|
13464
13601
|
// src/templates/module/seed.run.txt
|
|
@@ -13497,18 +13634,18 @@ class MakeSeedCommand {
|
|
|
13497
13634
|
if (module) {
|
|
13498
13635
|
await ensureModule(module);
|
|
13499
13636
|
}
|
|
13500
|
-
const base = module ?
|
|
13637
|
+
const base = module ? join31("modules", module) : ".";
|
|
13501
13638
|
const { seedPath: filePath, dataPath } = await seedCreate({
|
|
13502
13639
|
name,
|
|
13503
|
-
seedsDir:
|
|
13504
|
-
testsDir:
|
|
13640
|
+
seedsDir: join31(base, "src", "seeds"),
|
|
13641
|
+
testsDir: join31(base, "tests", "seeds")
|
|
13505
13642
|
});
|
|
13506
|
-
const binSeedRunPath =
|
|
13643
|
+
const binSeedRunPath = join31(process.cwd(), base, "bin", "seed", "run.ts");
|
|
13507
13644
|
const binSeedRunFile = Bun.file(binSeedRunPath);
|
|
13508
13645
|
if (!await binSeedRunFile.exists()) {
|
|
13509
13646
|
await Bun.write(binSeedRunPath, seed_run_default.replace(/{{name}}/g, module ?? ""));
|
|
13510
13647
|
}
|
|
13511
|
-
const logger = new
|
|
13648
|
+
const logger = new TerminalLogger27;
|
|
13512
13649
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
13513
13650
|
showTimestamp: false,
|
|
13514
13651
|
showArrow: false,
|
|
@@ -13522,7 +13659,7 @@ class MakeSeedCommand {
|
|
|
13522
13659
|
}
|
|
13523
13660
|
}
|
|
13524
13661
|
MakeSeedCommand = __legacyDecorateClassTS([
|
|
13525
|
-
|
|
13662
|
+
decorator31.command()
|
|
13526
13663
|
], MakeSeedCommand);
|
|
13527
13664
|
|
|
13528
13665
|
// src/commands/MakeResourceColorCommand.ts
|
|
@@ -13535,9 +13672,9 @@ class MakeResourceColorCommand {
|
|
|
13535
13672
|
}
|
|
13536
13673
|
async run() {
|
|
13537
13674
|
const module = "color";
|
|
13538
|
-
const base =
|
|
13675
|
+
const base = join32("modules", module);
|
|
13539
13676
|
const makeModuleCommand = new MakeModuleCommand;
|
|
13540
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
13677
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
13541
13678
|
const makeEntityCommand = new MakeEntityCommand;
|
|
13542
13679
|
await makeEntityCommand.run({ name: "Color", module, tableName: "colors" });
|
|
13543
13680
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -13558,26 +13695,26 @@ class MakeResourceColorCommand {
|
|
|
13558
13695
|
for (const controller of controllers) {
|
|
13559
13696
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
13560
13697
|
}
|
|
13561
|
-
const controllersDir =
|
|
13562
|
-
await Bun.write(
|
|
13563
|
-
await Bun.write(
|
|
13564
|
-
await Bun.write(
|
|
13565
|
-
await Bun.write(
|
|
13566
|
-
await Bun.write(
|
|
13698
|
+
const controllersDir = join32(process.cwd(), base, "src", "controllers");
|
|
13699
|
+
await Bun.write(join32(controllersDir, "CreateColorController.ts"), CreateColorController_default);
|
|
13700
|
+
await Bun.write(join32(controllersDir, "GetColorController.ts"), GetColorController_default);
|
|
13701
|
+
await Bun.write(join32(controllersDir, "ListColorsController.ts"), ListColorsController_default);
|
|
13702
|
+
await Bun.write(join32(controllersDir, "UpdateColorController.ts"), UpdateColorController_default);
|
|
13703
|
+
await Bun.write(join32(controllersDir, "DeleteColorController.ts"), DeleteColorController_default);
|
|
13567
13704
|
const makeServiceCommand = new MakeServiceCommand;
|
|
13568
13705
|
const services = ["CreateColor", "GetColor", "ListColors", "UpdateColor", "DeleteColor"];
|
|
13569
13706
|
for (const name of services) {
|
|
13570
13707
|
await makeServiceCommand.run({ name, module });
|
|
13571
13708
|
}
|
|
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 =
|
|
13709
|
+
const servicesDir = join32(process.cwd(), base, "src", "services");
|
|
13710
|
+
await Bun.write(join32(servicesDir, "CreateColorService.ts"), CreateColorService_default);
|
|
13711
|
+
await Bun.write(join32(servicesDir, "GetColorService.ts"), GetColorService_default);
|
|
13712
|
+
await Bun.write(join32(servicesDir, "ListColorsService.ts"), ListColorsService_default);
|
|
13713
|
+
await Bun.write(join32(servicesDir, "UpdateColorService.ts"), UpdateColorService_default);
|
|
13714
|
+
await Bun.write(join32(servicesDir, "DeleteColorService.ts"), DeleteColorService_default);
|
|
13715
|
+
const entityPath = join32(process.cwd(), base, "src", "entities", "ColorEntity.ts");
|
|
13579
13716
|
await Bun.write(entityPath, ColorEntity_default);
|
|
13580
|
-
const migrationsDir =
|
|
13717
|
+
const migrationsDir = join32(process.cwd(), base, "src", "migrations");
|
|
13581
13718
|
const glob = new Glob4("Migration*.ts");
|
|
13582
13719
|
for await (const file of glob.scan(migrationsDir)) {
|
|
13583
13720
|
if (file === "migrations.ts")
|
|
@@ -13585,23 +13722,23 @@ class MakeResourceColorCommand {
|
|
|
13585
13722
|
const name = file.replace(/\.ts$/, "");
|
|
13586
13723
|
const version = name.replace("Migration", "");
|
|
13587
13724
|
const content = ColorMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
13588
|
-
await Bun.write(
|
|
13725
|
+
await Bun.write(join32(migrationsDir, file), content);
|
|
13589
13726
|
}
|
|
13590
|
-
const repositoryPath =
|
|
13727
|
+
const repositoryPath = join32(process.cwd(), base, "src", "repositories", "ColorRepository.ts");
|
|
13591
13728
|
await Bun.write(repositoryPath, ColorRepository_default);
|
|
13592
13729
|
const makeSeedCommand = new MakeSeedCommand;
|
|
13593
13730
|
await makeSeedCommand.run({ name: "Color", module });
|
|
13594
|
-
const seedsDir =
|
|
13595
|
-
await Bun.write(
|
|
13596
|
-
await Bun.write(
|
|
13731
|
+
const seedsDir = join32(process.cwd(), base, "src", "seeds");
|
|
13732
|
+
await Bun.write(join32(seedsDir, "ColorSeed.ts"), ColorSeed_default);
|
|
13733
|
+
await Bun.write(join32(seedsDir, "color-seed.yml"), color_seed_default);
|
|
13597
13734
|
}
|
|
13598
13735
|
}
|
|
13599
13736
|
MakeResourceColorCommand = __legacyDecorateClassTS([
|
|
13600
|
-
|
|
13737
|
+
decorator32.command()
|
|
13601
13738
|
], MakeResourceColorCommand);
|
|
13602
13739
|
// src/commands/MakeResourceDiscountCommand.ts
|
|
13603
|
-
import { join as
|
|
13604
|
-
import { decorator as
|
|
13740
|
+
import { join as join33 } from "path";
|
|
13741
|
+
import { decorator as decorator33 } from "@ooneex/command";
|
|
13605
13742
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
13606
13743
|
|
|
13607
13744
|
// src/templates/resources/discount/controllers/CreateDiscountController.txt
|
|
@@ -14244,9 +14381,9 @@ class MakeResourceDiscountCommand {
|
|
|
14244
14381
|
}
|
|
14245
14382
|
async run() {
|
|
14246
14383
|
const module = "discount";
|
|
14247
|
-
const base =
|
|
14384
|
+
const base = join33("modules", module);
|
|
14248
14385
|
const makeModuleCommand = new MakeModuleCommand;
|
|
14249
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
14386
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
14250
14387
|
const makeEntityCommand = new MakeEntityCommand;
|
|
14251
14388
|
await makeEntityCommand.run({ name: "Discount", module, tableName: "discounts" });
|
|
14252
14389
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -14279,26 +14416,26 @@ class MakeResourceDiscountCommand {
|
|
|
14279
14416
|
for (const controller of controllers) {
|
|
14280
14417
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
14281
14418
|
}
|
|
14282
|
-
const controllersDir =
|
|
14283
|
-
await Bun.write(
|
|
14284
|
-
await Bun.write(
|
|
14285
|
-
await Bun.write(
|
|
14286
|
-
await Bun.write(
|
|
14287
|
-
await Bun.write(
|
|
14419
|
+
const controllersDir = join33(process.cwd(), base, "src", "controllers");
|
|
14420
|
+
await Bun.write(join33(controllersDir, "CreateDiscountController.ts"), CreateDiscountController_default);
|
|
14421
|
+
await Bun.write(join33(controllersDir, "GetDiscountController.ts"), GetDiscountController_default);
|
|
14422
|
+
await Bun.write(join33(controllersDir, "ListDiscountsController.ts"), ListDiscountsController_default);
|
|
14423
|
+
await Bun.write(join33(controllersDir, "UpdateDiscountController.ts"), UpdateDiscountController_default);
|
|
14424
|
+
await Bun.write(join33(controllersDir, "DeleteDiscountController.ts"), DeleteDiscountController_default);
|
|
14288
14425
|
const makeServiceCommand = new MakeServiceCommand;
|
|
14289
14426
|
const services = ["CreateDiscount", "GetDiscount", "ListDiscounts", "UpdateDiscount", "DeleteDiscount"];
|
|
14290
14427
|
for (const name of services) {
|
|
14291
14428
|
await makeServiceCommand.run({ name, module });
|
|
14292
14429
|
}
|
|
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 =
|
|
14430
|
+
const servicesDir = join33(process.cwd(), base, "src", "services");
|
|
14431
|
+
await Bun.write(join33(servicesDir, "CreateDiscountService.ts"), CreateDiscountService_default);
|
|
14432
|
+
await Bun.write(join33(servicesDir, "GetDiscountService.ts"), GetDiscountService_default);
|
|
14433
|
+
await Bun.write(join33(servicesDir, "ListDiscountsService.ts"), ListDiscountsService_default);
|
|
14434
|
+
await Bun.write(join33(servicesDir, "UpdateDiscountService.ts"), UpdateDiscountService_default);
|
|
14435
|
+
await Bun.write(join33(servicesDir, "DeleteDiscountService.ts"), DeleteDiscountService_default);
|
|
14436
|
+
const entityPath = join33(process.cwd(), base, "src", "entities", "DiscountEntity.ts");
|
|
14300
14437
|
await Bun.write(entityPath, DiscountEntity_default);
|
|
14301
|
-
const migrationsDir =
|
|
14438
|
+
const migrationsDir = join33(process.cwd(), base, "src", "migrations");
|
|
14302
14439
|
const glob = new Glob5("Migration*.ts");
|
|
14303
14440
|
for await (const file of glob.scan(migrationsDir)) {
|
|
14304
14441
|
if (file === "migrations.ts")
|
|
@@ -14306,18 +14443,18 @@ class MakeResourceDiscountCommand {
|
|
|
14306
14443
|
const name = file.replace(/\.ts$/, "");
|
|
14307
14444
|
const version = name.replace("Migration", "");
|
|
14308
14445
|
const content = DiscountMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
14309
|
-
await Bun.write(
|
|
14446
|
+
await Bun.write(join33(migrationsDir, file), content);
|
|
14310
14447
|
}
|
|
14311
|
-
const repositoryPath =
|
|
14448
|
+
const repositoryPath = join33(process.cwd(), base, "src", "repositories", "DiscountRepository.ts");
|
|
14312
14449
|
await Bun.write(repositoryPath, DiscountRepository_default);
|
|
14313
14450
|
}
|
|
14314
14451
|
}
|
|
14315
14452
|
MakeResourceDiscountCommand = __legacyDecorateClassTS([
|
|
14316
|
-
|
|
14453
|
+
decorator33.command()
|
|
14317
14454
|
], MakeResourceDiscountCommand);
|
|
14318
14455
|
// src/commands/MakeResourceFolderCommand.ts
|
|
14319
|
-
import { join as
|
|
14320
|
-
import { decorator as
|
|
14456
|
+
import { join as join34 } from "path";
|
|
14457
|
+
import { decorator as decorator34 } from "@ooneex/command";
|
|
14321
14458
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
14322
14459
|
|
|
14323
14460
|
// src/templates/resources/folder/controllers/CreateFolderController.txt
|
|
@@ -14944,9 +15081,9 @@ class MakeResourceFolderCommand {
|
|
|
14944
15081
|
}
|
|
14945
15082
|
async run() {
|
|
14946
15083
|
const module = "folder";
|
|
14947
|
-
const base =
|
|
15084
|
+
const base = join34("modules", module);
|
|
14948
15085
|
const makeModuleCommand = new MakeModuleCommand;
|
|
14949
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
15086
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
14950
15087
|
const makeEntityCommand = new MakeEntityCommand;
|
|
14951
15088
|
await makeEntityCommand.run({ name: "Folder", module, tableName: "folders" });
|
|
14952
15089
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -14979,26 +15116,26 @@ class MakeResourceFolderCommand {
|
|
|
14979
15116
|
for (const controller of controllers) {
|
|
14980
15117
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
14981
15118
|
}
|
|
14982
|
-
const controllersDir =
|
|
14983
|
-
await Bun.write(
|
|
14984
|
-
await Bun.write(
|
|
14985
|
-
await Bun.write(
|
|
14986
|
-
await Bun.write(
|
|
14987
|
-
await Bun.write(
|
|
15119
|
+
const controllersDir = join34(process.cwd(), base, "src", "controllers");
|
|
15120
|
+
await Bun.write(join34(controllersDir, "CreateFolderController.ts"), CreateFolderController_default);
|
|
15121
|
+
await Bun.write(join34(controllersDir, "GetFolderController.ts"), GetFolderController_default);
|
|
15122
|
+
await Bun.write(join34(controllersDir, "ListFoldersController.ts"), ListFoldersController_default);
|
|
15123
|
+
await Bun.write(join34(controllersDir, "UpdateFolderController.ts"), UpdateFolderController_default);
|
|
15124
|
+
await Bun.write(join34(controllersDir, "DeleteFolderController.ts"), DeleteFolderController_default);
|
|
14988
15125
|
const makeServiceCommand = new MakeServiceCommand;
|
|
14989
15126
|
const services = ["CreateFolder", "GetFolder", "ListFolders", "UpdateFolder", "DeleteFolder"];
|
|
14990
15127
|
for (const name of services) {
|
|
14991
15128
|
await makeServiceCommand.run({ name, module });
|
|
14992
15129
|
}
|
|
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 =
|
|
15130
|
+
const servicesDir = join34(process.cwd(), base, "src", "services");
|
|
15131
|
+
await Bun.write(join34(servicesDir, "CreateFolderService.ts"), CreateFolderService_default);
|
|
15132
|
+
await Bun.write(join34(servicesDir, "GetFolderService.ts"), GetFolderService_default);
|
|
15133
|
+
await Bun.write(join34(servicesDir, "ListFoldersService.ts"), ListFoldersService_default);
|
|
15134
|
+
await Bun.write(join34(servicesDir, "UpdateFolderService.ts"), UpdateFolderService_default);
|
|
15135
|
+
await Bun.write(join34(servicesDir, "DeleteFolderService.ts"), DeleteFolderService_default);
|
|
15136
|
+
const entityPath = join34(process.cwd(), base, "src", "entities", "FolderEntity.ts");
|
|
15000
15137
|
await Bun.write(entityPath, FolderEntity_default);
|
|
15001
|
-
const migrationsDir =
|
|
15138
|
+
const migrationsDir = join34(process.cwd(), base, "src", "migrations");
|
|
15002
15139
|
const glob = new Glob6("Migration*.ts");
|
|
15003
15140
|
for await (const file of glob.scan(migrationsDir)) {
|
|
15004
15141
|
if (file === "migrations.ts")
|
|
@@ -15006,18 +15143,18 @@ class MakeResourceFolderCommand {
|
|
|
15006
15143
|
const name = file.replace(/\.ts$/, "");
|
|
15007
15144
|
const version = name.replace("Migration", "");
|
|
15008
15145
|
const content = FolderMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
15009
|
-
await Bun.write(
|
|
15146
|
+
await Bun.write(join34(migrationsDir, file), content);
|
|
15010
15147
|
}
|
|
15011
|
-
const repositoryPath =
|
|
15148
|
+
const repositoryPath = join34(process.cwd(), base, "src", "repositories", "FolderRepository.ts");
|
|
15012
15149
|
await Bun.write(repositoryPath, FolderRepository_default);
|
|
15013
15150
|
}
|
|
15014
15151
|
}
|
|
15015
15152
|
MakeResourceFolderCommand = __legacyDecorateClassTS([
|
|
15016
|
-
|
|
15153
|
+
decorator34.command()
|
|
15017
15154
|
], MakeResourceFolderCommand);
|
|
15018
15155
|
// src/commands/MakeResourceImageCommand.ts
|
|
15019
|
-
import { join as
|
|
15020
|
-
import { decorator as
|
|
15156
|
+
import { join as join35 } from "path";
|
|
15157
|
+
import { decorator as decorator35 } from "@ooneex/command";
|
|
15021
15158
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
15022
15159
|
|
|
15023
15160
|
// src/templates/resources/image/controllers/CreateImageController.txt
|
|
@@ -15683,9 +15820,9 @@ class MakeResourceImageCommand {
|
|
|
15683
15820
|
}
|
|
15684
15821
|
async run() {
|
|
15685
15822
|
const module = "image";
|
|
15686
|
-
const base =
|
|
15823
|
+
const base = join35("modules", module);
|
|
15687
15824
|
const makeModuleCommand = new MakeModuleCommand;
|
|
15688
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
15825
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
15689
15826
|
const makeEntityCommand = new MakeEntityCommand;
|
|
15690
15827
|
await makeEntityCommand.run({ name: "Image", module, tableName: "images" });
|
|
15691
15828
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -15718,26 +15855,26 @@ class MakeResourceImageCommand {
|
|
|
15718
15855
|
for (const controller of controllers) {
|
|
15719
15856
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
15720
15857
|
}
|
|
15721
|
-
const controllersDir =
|
|
15722
|
-
await Bun.write(
|
|
15723
|
-
await Bun.write(
|
|
15724
|
-
await Bun.write(
|
|
15725
|
-
await Bun.write(
|
|
15726
|
-
await Bun.write(
|
|
15858
|
+
const controllersDir = join35(process.cwd(), base, "src", "controllers");
|
|
15859
|
+
await Bun.write(join35(controllersDir, "CreateImageController.ts"), CreateImageController_default);
|
|
15860
|
+
await Bun.write(join35(controllersDir, "GetImageController.ts"), GetImageController_default);
|
|
15861
|
+
await Bun.write(join35(controllersDir, "ListImagesController.ts"), ListImagesController_default);
|
|
15862
|
+
await Bun.write(join35(controllersDir, "UpdateImageController.ts"), UpdateImageController_default);
|
|
15863
|
+
await Bun.write(join35(controllersDir, "DeleteImageController.ts"), DeleteImageController_default);
|
|
15727
15864
|
const makeServiceCommand = new MakeServiceCommand;
|
|
15728
15865
|
const services = ["CreateImage", "GetImage", "ListImages", "UpdateImage", "DeleteImage"];
|
|
15729
15866
|
for (const name of services) {
|
|
15730
15867
|
await makeServiceCommand.run({ name, module });
|
|
15731
15868
|
}
|
|
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 =
|
|
15869
|
+
const servicesDir = join35(process.cwd(), base, "src", "services");
|
|
15870
|
+
await Bun.write(join35(servicesDir, "CreateImageService.ts"), CreateImageService_default);
|
|
15871
|
+
await Bun.write(join35(servicesDir, "GetImageService.ts"), GetImageService_default);
|
|
15872
|
+
await Bun.write(join35(servicesDir, "ListImagesService.ts"), ListImagesService_default);
|
|
15873
|
+
await Bun.write(join35(servicesDir, "UpdateImageService.ts"), UpdateImageService_default);
|
|
15874
|
+
await Bun.write(join35(servicesDir, "DeleteImageService.ts"), DeleteImageService_default);
|
|
15875
|
+
const entityPath = join35(process.cwd(), base, "src", "entities", "ImageEntity.ts");
|
|
15739
15876
|
await Bun.write(entityPath, ImageEntity_default);
|
|
15740
|
-
const migrationsDir =
|
|
15877
|
+
const migrationsDir = join35(process.cwd(), base, "src", "migrations");
|
|
15741
15878
|
const glob = new Glob7("Migration*.ts");
|
|
15742
15879
|
for await (const file of glob.scan(migrationsDir)) {
|
|
15743
15880
|
if (file === "migrations.ts")
|
|
@@ -15745,18 +15882,18 @@ class MakeResourceImageCommand {
|
|
|
15745
15882
|
const name = file.replace(/\.ts$/, "");
|
|
15746
15883
|
const version = name.replace("Migration", "");
|
|
15747
15884
|
const content = ImageMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
15748
|
-
await Bun.write(
|
|
15885
|
+
await Bun.write(join35(migrationsDir, file), content);
|
|
15749
15886
|
}
|
|
15750
|
-
const repositoryPath =
|
|
15887
|
+
const repositoryPath = join35(process.cwd(), base, "src", "repositories", "ImageRepository.ts");
|
|
15751
15888
|
await Bun.write(repositoryPath, ImageRepository_default);
|
|
15752
15889
|
}
|
|
15753
15890
|
}
|
|
15754
15891
|
MakeResourceImageCommand = __legacyDecorateClassTS([
|
|
15755
|
-
|
|
15892
|
+
decorator35.command()
|
|
15756
15893
|
], MakeResourceImageCommand);
|
|
15757
15894
|
// src/commands/MakeResourceNoteCommand.ts
|
|
15758
|
-
import { join as
|
|
15759
|
-
import { decorator as
|
|
15895
|
+
import { join as join36 } from "path";
|
|
15896
|
+
import { decorator as decorator36 } from "@ooneex/command";
|
|
15760
15897
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15761
15898
|
|
|
15762
15899
|
// src/templates/resources/note/controllers/CreateNoteController.txt
|
|
@@ -16461,9 +16598,9 @@ class MakeResourceNoteCommand {
|
|
|
16461
16598
|
}
|
|
16462
16599
|
async run() {
|
|
16463
16600
|
const module = "note";
|
|
16464
|
-
const base =
|
|
16601
|
+
const base = join36("modules", module);
|
|
16465
16602
|
const makeModuleCommand = new MakeModuleCommand;
|
|
16466
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
16603
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
16467
16604
|
const makeEntityCommand = new MakeEntityCommand;
|
|
16468
16605
|
await makeEntityCommand.run({ name: "Note", module, tableName: "notes" });
|
|
16469
16606
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -16496,26 +16633,26 @@ class MakeResourceNoteCommand {
|
|
|
16496
16633
|
for (const controller of controllers) {
|
|
16497
16634
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
16498
16635
|
}
|
|
16499
|
-
const controllersDir =
|
|
16500
|
-
await Bun.write(
|
|
16501
|
-
await Bun.write(
|
|
16502
|
-
await Bun.write(
|
|
16503
|
-
await Bun.write(
|
|
16504
|
-
await Bun.write(
|
|
16636
|
+
const controllersDir = join36(process.cwd(), base, "src", "controllers");
|
|
16637
|
+
await Bun.write(join36(controllersDir, "CreateNoteController.ts"), CreateNoteController_default);
|
|
16638
|
+
await Bun.write(join36(controllersDir, "GetNoteController.ts"), GetNoteController_default);
|
|
16639
|
+
await Bun.write(join36(controllersDir, "ListNotesController.ts"), ListNotesController_default);
|
|
16640
|
+
await Bun.write(join36(controllersDir, "UpdateNoteController.ts"), UpdateNoteController_default);
|
|
16641
|
+
await Bun.write(join36(controllersDir, "DeleteNoteController.ts"), DeleteNoteController_default);
|
|
16505
16642
|
const makeServiceCommand = new MakeServiceCommand;
|
|
16506
16643
|
const services = ["CreateNote", "GetNote", "ListNotes", "UpdateNote", "DeleteNote"];
|
|
16507
16644
|
for (const name of services) {
|
|
16508
16645
|
await makeServiceCommand.run({ name, module });
|
|
16509
16646
|
}
|
|
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 =
|
|
16647
|
+
const servicesDir = join36(process.cwd(), base, "src", "services");
|
|
16648
|
+
await Bun.write(join36(servicesDir, "CreateNoteService.ts"), CreateNoteService_default);
|
|
16649
|
+
await Bun.write(join36(servicesDir, "GetNoteService.ts"), GetNoteService_default);
|
|
16650
|
+
await Bun.write(join36(servicesDir, "ListNotesService.ts"), ListNotesService_default);
|
|
16651
|
+
await Bun.write(join36(servicesDir, "UpdateNoteService.ts"), UpdateNoteService_default);
|
|
16652
|
+
await Bun.write(join36(servicesDir, "DeleteNoteService.ts"), DeleteNoteService_default);
|
|
16653
|
+
const entityPath = join36(process.cwd(), base, "src", "entities", "NoteEntity.ts");
|
|
16517
16654
|
await Bun.write(entityPath, NoteEntity_default);
|
|
16518
|
-
const migrationsDir =
|
|
16655
|
+
const migrationsDir = join36(process.cwd(), base, "src", "migrations");
|
|
16519
16656
|
const glob = new Glob8("Migration*.ts");
|
|
16520
16657
|
for await (const file of glob.scan(migrationsDir)) {
|
|
16521
16658
|
if (file === "migrations.ts")
|
|
@@ -16523,18 +16660,18 @@ class MakeResourceNoteCommand {
|
|
|
16523
16660
|
const name = file.replace(/\.ts$/, "");
|
|
16524
16661
|
const version = name.replace("Migration", "");
|
|
16525
16662
|
const content = NoteMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
16526
|
-
await Bun.write(
|
|
16663
|
+
await Bun.write(join36(migrationsDir, file), content);
|
|
16527
16664
|
}
|
|
16528
|
-
const repositoryPath =
|
|
16665
|
+
const repositoryPath = join36(process.cwd(), base, "src", "repositories", "NoteRepository.ts");
|
|
16529
16666
|
await Bun.write(repositoryPath, NoteRepository_default);
|
|
16530
16667
|
}
|
|
16531
16668
|
}
|
|
16532
16669
|
MakeResourceNoteCommand = __legacyDecorateClassTS([
|
|
16533
|
-
|
|
16670
|
+
decorator36.command()
|
|
16534
16671
|
], MakeResourceNoteCommand);
|
|
16535
16672
|
// src/commands/MakeResourceStatusCommand.ts
|
|
16536
|
-
import { join as
|
|
16537
|
-
import { decorator as
|
|
16673
|
+
import { join as join37 } from "path";
|
|
16674
|
+
import { decorator as decorator37 } from "@ooneex/command";
|
|
16538
16675
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
16539
16676
|
|
|
16540
16677
|
// src/templates/resources/status/controllers/CreateStatusController.txt
|
|
@@ -16968,18 +17105,27 @@ export class StatusRepository {
|
|
|
16968
17105
|
`;
|
|
16969
17106
|
|
|
16970
17107
|
// src/templates/resources/status/seeds/StatusSeed.txt
|
|
16971
|
-
var StatusSeed_default = `import {
|
|
17108
|
+
var StatusSeed_default = `import { inject } from "@ooneex/container";
|
|
16972
17109
|
import { decorator, type ISeed, type SeedClassType } from "@ooneex/seeds";
|
|
17110
|
+
import type { LocaleType } from "@ooneex/translation";
|
|
16973
17111
|
import { StatusEntity } from "../entities/StatusEntity";
|
|
16974
17112
|
import { StatusRepository } from "../repositories/StatusRepository";
|
|
16975
|
-
import data from "./
|
|
17113
|
+
import data from "./status-seed.yml";
|
|
17114
|
+
|
|
17115
|
+
type StatusSeedDataType = {
|
|
17116
|
+
id: string;
|
|
17117
|
+
name: string;
|
|
17118
|
+
color?: string;
|
|
17119
|
+
description?: string;
|
|
17120
|
+
lang?: LocaleType;
|
|
17121
|
+
};
|
|
16976
17122
|
|
|
16977
17123
|
@decorator.seed()
|
|
16978
17124
|
export class StatusSeed implements ISeed {
|
|
16979
|
-
|
|
16980
|
-
const repository = resolve(StatusRepository);
|
|
17125
|
+
constructor(@inject(StatusRepository) private readonly repository: StatusRepository) {}
|
|
16981
17126
|
|
|
16982
|
-
|
|
17127
|
+
public async run<T>(): Promise<T> {
|
|
17128
|
+
const entities = (data as StatusSeedDataType[]).map((item) => {
|
|
16983
17129
|
const entity = new StatusEntity();
|
|
16984
17130
|
entity.id = item.id;
|
|
16985
17131
|
entity.name = item.name;
|
|
@@ -16990,8 +17136,8 @@ export class StatusSeed implements ISeed {
|
|
|
16990
17136
|
return entity;
|
|
16991
17137
|
});
|
|
16992
17138
|
|
|
16993
|
-
const result = await repository.createMany(entities);
|
|
16994
|
-
await repository.close();
|
|
17139
|
+
const result = await this.repository.createMany(entities);
|
|
17140
|
+
await this.repository.close();
|
|
16995
17141
|
|
|
16996
17142
|
return result as T;
|
|
16997
17143
|
}
|
|
@@ -17386,9 +17532,9 @@ class MakeResourceStatusCommand {
|
|
|
17386
17532
|
}
|
|
17387
17533
|
async run() {
|
|
17388
17534
|
const module = "status";
|
|
17389
|
-
const base =
|
|
17535
|
+
const base = join37("modules", module);
|
|
17390
17536
|
const makeModuleCommand = new MakeModuleCommand;
|
|
17391
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
17537
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
17392
17538
|
const makeEntityCommand = new MakeEntityCommand;
|
|
17393
17539
|
await makeEntityCommand.run({ name: "Status", module, tableName: "statuses" });
|
|
17394
17540
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -17421,26 +17567,26 @@ class MakeResourceStatusCommand {
|
|
|
17421
17567
|
for (const controller of controllers) {
|
|
17422
17568
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
17423
17569
|
}
|
|
17424
|
-
const controllersDir =
|
|
17425
|
-
await Bun.write(
|
|
17426
|
-
await Bun.write(
|
|
17427
|
-
await Bun.write(
|
|
17428
|
-
await Bun.write(
|
|
17429
|
-
await Bun.write(
|
|
17570
|
+
const controllersDir = join37(process.cwd(), base, "src", "controllers");
|
|
17571
|
+
await Bun.write(join37(controllersDir, "CreateStatusController.ts"), CreateStatusController_default);
|
|
17572
|
+
await Bun.write(join37(controllersDir, "GetStatusController.ts"), GetStatusController_default);
|
|
17573
|
+
await Bun.write(join37(controllersDir, "ListStatusesController.ts"), ListStatusesController_default);
|
|
17574
|
+
await Bun.write(join37(controllersDir, "UpdateStatusController.ts"), UpdateStatusController_default);
|
|
17575
|
+
await Bun.write(join37(controllersDir, "DeleteStatusController.ts"), DeleteStatusController_default);
|
|
17430
17576
|
const makeServiceCommand = new MakeServiceCommand;
|
|
17431
17577
|
const services = ["CreateStatus", "GetStatus", "ListStatuses", "UpdateStatus", "DeleteStatus"];
|
|
17432
17578
|
for (const name of services) {
|
|
17433
17579
|
await makeServiceCommand.run({ name, module });
|
|
17434
17580
|
}
|
|
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 =
|
|
17581
|
+
const servicesDir = join37(process.cwd(), base, "src", "services");
|
|
17582
|
+
await Bun.write(join37(servicesDir, "CreateStatusService.ts"), CreateStatusService_default);
|
|
17583
|
+
await Bun.write(join37(servicesDir, "GetStatusService.ts"), GetStatusService_default);
|
|
17584
|
+
await Bun.write(join37(servicesDir, "ListStatusesService.ts"), ListStatusesService_default);
|
|
17585
|
+
await Bun.write(join37(servicesDir, "UpdateStatusService.ts"), UpdateStatusService_default);
|
|
17586
|
+
await Bun.write(join37(servicesDir, "DeleteStatusService.ts"), DeleteStatusService_default);
|
|
17587
|
+
const entityPath = join37(process.cwd(), base, "src", "entities", "StatusEntity.ts");
|
|
17442
17588
|
await Bun.write(entityPath, StatusEntity_default);
|
|
17443
|
-
const migrationsDir =
|
|
17589
|
+
const migrationsDir = join37(process.cwd(), base, "src", "migrations");
|
|
17444
17590
|
const glob = new Glob9("Migration*.ts");
|
|
17445
17591
|
for await (const file of glob.scan(migrationsDir)) {
|
|
17446
17592
|
if (file === "migrations.ts")
|
|
@@ -17448,23 +17594,23 @@ class MakeResourceStatusCommand {
|
|
|
17448
17594
|
const name = file.replace(/\.ts$/, "");
|
|
17449
17595
|
const version = name.replace("Migration", "");
|
|
17450
17596
|
const content = StatusMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
17451
|
-
await Bun.write(
|
|
17597
|
+
await Bun.write(join37(migrationsDir, file), content);
|
|
17452
17598
|
}
|
|
17453
|
-
const repositoryPath =
|
|
17599
|
+
const repositoryPath = join37(process.cwd(), base, "src", "repositories", "StatusRepository.ts");
|
|
17454
17600
|
await Bun.write(repositoryPath, StatusRepository_default);
|
|
17455
17601
|
const makeSeedCommand = new MakeSeedCommand;
|
|
17456
17602
|
await makeSeedCommand.run({ name: "Status", module });
|
|
17457
|
-
const seedsDir =
|
|
17458
|
-
await Bun.write(
|
|
17459
|
-
await Bun.write(
|
|
17603
|
+
const seedsDir = join37(process.cwd(), base, "src", "seeds");
|
|
17604
|
+
await Bun.write(join37(seedsDir, "StatusSeed.ts"), StatusSeed_default);
|
|
17605
|
+
await Bun.write(join37(seedsDir, "status-seed.yml"), status_seed_default);
|
|
17460
17606
|
}
|
|
17461
17607
|
}
|
|
17462
17608
|
MakeResourceStatusCommand = __legacyDecorateClassTS([
|
|
17463
|
-
|
|
17609
|
+
decorator37.command()
|
|
17464
17610
|
], MakeResourceStatusCommand);
|
|
17465
17611
|
// src/commands/MakeResourceTagCommand.ts
|
|
17466
|
-
import { join as
|
|
17467
|
-
import { decorator as
|
|
17612
|
+
import { join as join38 } from "path";
|
|
17613
|
+
import { decorator as decorator38 } from "@ooneex/command";
|
|
17468
17614
|
var {Glob: Glob10 } = globalThis.Bun;
|
|
17469
17615
|
|
|
17470
17616
|
// src/templates/resources/tag/controllers/CreateTagController.txt
|
|
@@ -18055,9 +18201,9 @@ class MakeResourceTagCommand {
|
|
|
18055
18201
|
}
|
|
18056
18202
|
async run() {
|
|
18057
18203
|
const module = "tag";
|
|
18058
|
-
const base =
|
|
18204
|
+
const base = join38("modules", module);
|
|
18059
18205
|
const makeModuleCommand = new MakeModuleCommand;
|
|
18060
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
18206
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
18061
18207
|
const makeEntityCommand = new MakeEntityCommand;
|
|
18062
18208
|
await makeEntityCommand.run({ name: "Tag", module, tableName: "tags" });
|
|
18063
18209
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -18090,26 +18236,26 @@ class MakeResourceTagCommand {
|
|
|
18090
18236
|
for (const controller of controllers) {
|
|
18091
18237
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
18092
18238
|
}
|
|
18093
|
-
const controllersDir =
|
|
18094
|
-
await Bun.write(
|
|
18095
|
-
await Bun.write(
|
|
18096
|
-
await Bun.write(
|
|
18097
|
-
await Bun.write(
|
|
18098
|
-
await Bun.write(
|
|
18239
|
+
const controllersDir = join38(process.cwd(), base, "src", "controllers");
|
|
18240
|
+
await Bun.write(join38(controllersDir, "CreateTagController.ts"), CreateTagController_default);
|
|
18241
|
+
await Bun.write(join38(controllersDir, "GetTagController.ts"), GetTagController_default);
|
|
18242
|
+
await Bun.write(join38(controllersDir, "ListTagsController.ts"), ListTagsController_default);
|
|
18243
|
+
await Bun.write(join38(controllersDir, "UpdateTagController.ts"), UpdateTagController_default);
|
|
18244
|
+
await Bun.write(join38(controllersDir, "DeleteTagController.ts"), DeleteTagController_default);
|
|
18099
18245
|
const makeServiceCommand = new MakeServiceCommand;
|
|
18100
18246
|
const services = ["CreateTag", "GetTag", "ListTags", "UpdateTag", "DeleteTag"];
|
|
18101
18247
|
for (const name of services) {
|
|
18102
18248
|
await makeServiceCommand.run({ name, module });
|
|
18103
18249
|
}
|
|
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 =
|
|
18250
|
+
const servicesDir = join38(process.cwd(), base, "src", "services");
|
|
18251
|
+
await Bun.write(join38(servicesDir, "CreateTagService.ts"), CreateTagService_default);
|
|
18252
|
+
await Bun.write(join38(servicesDir, "GetTagService.ts"), GetTagService_default);
|
|
18253
|
+
await Bun.write(join38(servicesDir, "ListTagsService.ts"), ListTagsService_default);
|
|
18254
|
+
await Bun.write(join38(servicesDir, "UpdateTagService.ts"), UpdateTagService_default);
|
|
18255
|
+
await Bun.write(join38(servicesDir, "DeleteTagService.ts"), DeleteTagService_default);
|
|
18256
|
+
const entityPath = join38(process.cwd(), base, "src", "entities", "TagEntity.ts");
|
|
18111
18257
|
await Bun.write(entityPath, TagEntity_default);
|
|
18112
|
-
const migrationsDir =
|
|
18258
|
+
const migrationsDir = join38(process.cwd(), base, "src", "migrations");
|
|
18113
18259
|
const glob = new Glob10("Migration*.ts");
|
|
18114
18260
|
for await (const file of glob.scan(migrationsDir)) {
|
|
18115
18261
|
if (file === "migrations.ts")
|
|
@@ -18117,18 +18263,18 @@ class MakeResourceTagCommand {
|
|
|
18117
18263
|
const name = file.replace(/\.ts$/, "");
|
|
18118
18264
|
const version = name.replace("Migration", "");
|
|
18119
18265
|
const content = TagMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
18120
|
-
await Bun.write(
|
|
18266
|
+
await Bun.write(join38(migrationsDir, file), content);
|
|
18121
18267
|
}
|
|
18122
|
-
const repositoryPath =
|
|
18268
|
+
const repositoryPath = join38(process.cwd(), base, "src", "repositories", "TagRepository.ts");
|
|
18123
18269
|
await Bun.write(repositoryPath, TagRepository_default);
|
|
18124
18270
|
}
|
|
18125
18271
|
}
|
|
18126
18272
|
MakeResourceTagCommand = __legacyDecorateClassTS([
|
|
18127
|
-
|
|
18273
|
+
decorator38.command()
|
|
18128
18274
|
], MakeResourceTagCommand);
|
|
18129
18275
|
// src/commands/MakeResourceTaskCommand.ts
|
|
18130
|
-
import { join as
|
|
18131
|
-
import { decorator as
|
|
18276
|
+
import { join as join39 } from "path";
|
|
18277
|
+
import { decorator as decorator39 } from "@ooneex/command";
|
|
18132
18278
|
var {Glob: Glob11 } = globalThis.Bun;
|
|
18133
18279
|
|
|
18134
18280
|
// src/templates/resources/task/controllers/CreateTaskController.txt
|
|
@@ -18801,9 +18947,9 @@ class MakeResourceTaskCommand {
|
|
|
18801
18947
|
}
|
|
18802
18948
|
async run() {
|
|
18803
18949
|
const module = "task";
|
|
18804
|
-
const base =
|
|
18950
|
+
const base = join39("modules", module);
|
|
18805
18951
|
const makeModuleCommand = new MakeModuleCommand;
|
|
18806
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
18952
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
18807
18953
|
const makeEntityCommand = new MakeEntityCommand;
|
|
18808
18954
|
await makeEntityCommand.run({ name: "Task", module, tableName: "tasks" });
|
|
18809
18955
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -18836,26 +18982,26 @@ class MakeResourceTaskCommand {
|
|
|
18836
18982
|
for (const controller of controllers) {
|
|
18837
18983
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
18838
18984
|
}
|
|
18839
|
-
const controllersDir =
|
|
18840
|
-
await Bun.write(
|
|
18841
|
-
await Bun.write(
|
|
18842
|
-
await Bun.write(
|
|
18843
|
-
await Bun.write(
|
|
18844
|
-
await Bun.write(
|
|
18985
|
+
const controllersDir = join39(process.cwd(), base, "src", "controllers");
|
|
18986
|
+
await Bun.write(join39(controllersDir, "CreateTaskController.ts"), CreateTaskController_default);
|
|
18987
|
+
await Bun.write(join39(controllersDir, "GetTaskController.ts"), GetTaskController_default);
|
|
18988
|
+
await Bun.write(join39(controllersDir, "ListTasksController.ts"), ListTasksController_default);
|
|
18989
|
+
await Bun.write(join39(controllersDir, "UpdateTaskController.ts"), UpdateTaskController_default);
|
|
18990
|
+
await Bun.write(join39(controllersDir, "DeleteTaskController.ts"), DeleteTaskController_default);
|
|
18845
18991
|
const makeServiceCommand = new MakeServiceCommand;
|
|
18846
18992
|
const services = ["CreateTask", "GetTask", "ListTasks", "UpdateTask", "DeleteTask"];
|
|
18847
18993
|
for (const name of services) {
|
|
18848
18994
|
await makeServiceCommand.run({ name, module });
|
|
18849
18995
|
}
|
|
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 =
|
|
18996
|
+
const servicesDir = join39(process.cwd(), base, "src", "services");
|
|
18997
|
+
await Bun.write(join39(servicesDir, "CreateTaskService.ts"), CreateTaskService_default);
|
|
18998
|
+
await Bun.write(join39(servicesDir, "GetTaskService.ts"), GetTaskService_default);
|
|
18999
|
+
await Bun.write(join39(servicesDir, "ListTasksService.ts"), ListTasksService_default);
|
|
19000
|
+
await Bun.write(join39(servicesDir, "UpdateTaskService.ts"), UpdateTaskService_default);
|
|
19001
|
+
await Bun.write(join39(servicesDir, "DeleteTaskService.ts"), DeleteTaskService_default);
|
|
19002
|
+
const entityPath = join39(process.cwd(), base, "src", "entities", "TaskEntity.ts");
|
|
18857
19003
|
await Bun.write(entityPath, TaskEntity_default);
|
|
18858
|
-
const migrationsDir =
|
|
19004
|
+
const migrationsDir = join39(process.cwd(), base, "src", "migrations");
|
|
18859
19005
|
const glob = new Glob11("Migration*.ts");
|
|
18860
19006
|
for await (const file of glob.scan(migrationsDir)) {
|
|
18861
19007
|
if (file === "migrations.ts")
|
|
@@ -18863,18 +19009,18 @@ class MakeResourceTaskCommand {
|
|
|
18863
19009
|
const name = file.replace(/\.ts$/, "");
|
|
18864
19010
|
const version = name.replace("Migration", "");
|
|
18865
19011
|
const content = TaskMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
18866
|
-
await Bun.write(
|
|
19012
|
+
await Bun.write(join39(migrationsDir, file), content);
|
|
18867
19013
|
}
|
|
18868
|
-
const repositoryPath =
|
|
19014
|
+
const repositoryPath = join39(process.cwd(), base, "src", "repositories", "TaskRepository.ts");
|
|
18869
19015
|
await Bun.write(repositoryPath, TaskRepository_default);
|
|
18870
19016
|
}
|
|
18871
19017
|
}
|
|
18872
19018
|
MakeResourceTaskCommand = __legacyDecorateClassTS([
|
|
18873
|
-
|
|
19019
|
+
decorator39.command()
|
|
18874
19020
|
], MakeResourceTaskCommand);
|
|
18875
19021
|
// src/commands/MakeResourceTopicCommand.ts
|
|
18876
|
-
import { join as
|
|
18877
|
-
import { decorator as
|
|
19022
|
+
import { join as join40 } from "path";
|
|
19023
|
+
import { decorator as decorator40 } from "@ooneex/command";
|
|
18878
19024
|
var {Glob: Glob12 } = globalThis.Bun;
|
|
18879
19025
|
|
|
18880
19026
|
// src/templates/resources/topic/controllers/CreateTopicController.txt
|
|
@@ -19465,9 +19611,9 @@ class MakeResourceTopicCommand {
|
|
|
19465
19611
|
}
|
|
19466
19612
|
async run() {
|
|
19467
19613
|
const module = "topic";
|
|
19468
|
-
const base =
|
|
19614
|
+
const base = join40("modules", module);
|
|
19469
19615
|
const makeModuleCommand = new MakeModuleCommand;
|
|
19470
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
19616
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
19471
19617
|
const makeEntityCommand = new MakeEntityCommand;
|
|
19472
19618
|
await makeEntityCommand.run({ name: "Topic", module, tableName: "topics" });
|
|
19473
19619
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -19500,26 +19646,26 @@ class MakeResourceTopicCommand {
|
|
|
19500
19646
|
for (const controller of controllers) {
|
|
19501
19647
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
19502
19648
|
}
|
|
19503
|
-
const controllersDir =
|
|
19504
|
-
await Bun.write(
|
|
19505
|
-
await Bun.write(
|
|
19506
|
-
await Bun.write(
|
|
19507
|
-
await Bun.write(
|
|
19508
|
-
await Bun.write(
|
|
19649
|
+
const controllersDir = join40(process.cwd(), base, "src", "controllers");
|
|
19650
|
+
await Bun.write(join40(controllersDir, "CreateTopicController.ts"), CreateTopicController_default);
|
|
19651
|
+
await Bun.write(join40(controllersDir, "GetTopicController.ts"), GetTopicController_default);
|
|
19652
|
+
await Bun.write(join40(controllersDir, "ListTopicsController.ts"), ListTopicsController_default);
|
|
19653
|
+
await Bun.write(join40(controllersDir, "UpdateTopicController.ts"), UpdateTopicController_default);
|
|
19654
|
+
await Bun.write(join40(controllersDir, "DeleteTopicController.ts"), DeleteTopicController_default);
|
|
19509
19655
|
const makeServiceCommand = new MakeServiceCommand;
|
|
19510
19656
|
const services = ["CreateTopic", "GetTopic", "ListTopics", "UpdateTopic", "DeleteTopic"];
|
|
19511
19657
|
for (const name of services) {
|
|
19512
19658
|
await makeServiceCommand.run({ name, module });
|
|
19513
19659
|
}
|
|
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 =
|
|
19660
|
+
const servicesDir = join40(process.cwd(), base, "src", "services");
|
|
19661
|
+
await Bun.write(join40(servicesDir, "CreateTopicService.ts"), CreateTopicService_default);
|
|
19662
|
+
await Bun.write(join40(servicesDir, "GetTopicService.ts"), GetTopicService_default);
|
|
19663
|
+
await Bun.write(join40(servicesDir, "ListTopicsService.ts"), ListTopicsService_default);
|
|
19664
|
+
await Bun.write(join40(servicesDir, "UpdateTopicService.ts"), UpdateTopicService_default);
|
|
19665
|
+
await Bun.write(join40(servicesDir, "DeleteTopicService.ts"), DeleteTopicService_default);
|
|
19666
|
+
const entityPath = join40(process.cwd(), base, "src", "entities", "TopicEntity.ts");
|
|
19521
19667
|
await Bun.write(entityPath, TopicEntity_default);
|
|
19522
|
-
const migrationsDir =
|
|
19668
|
+
const migrationsDir = join40(process.cwd(), base, "src", "migrations");
|
|
19523
19669
|
const glob = new Glob12("Migration*.ts");
|
|
19524
19670
|
for await (const file of glob.scan(migrationsDir)) {
|
|
19525
19671
|
if (file === "migrations.ts")
|
|
@@ -19527,18 +19673,18 @@ class MakeResourceTopicCommand {
|
|
|
19527
19673
|
const name = file.replace(/\.ts$/, "");
|
|
19528
19674
|
const version = name.replace("Migration", "");
|
|
19529
19675
|
const content = TopicMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
19530
|
-
await Bun.write(
|
|
19676
|
+
await Bun.write(join40(migrationsDir, file), content);
|
|
19531
19677
|
}
|
|
19532
|
-
const repositoryPath =
|
|
19678
|
+
const repositoryPath = join40(process.cwd(), base, "src", "repositories", "TopicRepository.ts");
|
|
19533
19679
|
await Bun.write(repositoryPath, TopicRepository_default);
|
|
19534
19680
|
}
|
|
19535
19681
|
}
|
|
19536
19682
|
MakeResourceTopicCommand = __legacyDecorateClassTS([
|
|
19537
|
-
|
|
19683
|
+
decorator40.command()
|
|
19538
19684
|
], MakeResourceTopicCommand);
|
|
19539
19685
|
// src/commands/MakeResourceUserCommand.ts
|
|
19540
|
-
import { join as
|
|
19541
|
-
import { decorator as
|
|
19686
|
+
import { join as join41 } from "path";
|
|
19687
|
+
import { decorator as decorator41 } from "@ooneex/command";
|
|
19542
19688
|
var {Glob: Glob13 } = globalThis.Bun;
|
|
19543
19689
|
|
|
19544
19690
|
// src/templates/resources/user/controllers/BanUserController.txt
|
|
@@ -20359,9 +20505,9 @@ class MakeResourceUserCommand {
|
|
|
20359
20505
|
}
|
|
20360
20506
|
async run() {
|
|
20361
20507
|
const module = "user";
|
|
20362
|
-
const base =
|
|
20508
|
+
const base = join41("modules", module);
|
|
20363
20509
|
const makeModuleCommand = new MakeModuleCommand;
|
|
20364
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
20510
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
20365
20511
|
const makeEntityCommand = new MakeEntityCommand;
|
|
20366
20512
|
await makeEntityCommand.run({ name: "User", module, tableName: "users" });
|
|
20367
20513
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -20410,14 +20556,14 @@ class MakeResourceUserCommand {
|
|
|
20410
20556
|
for (const controller of controllers) {
|
|
20411
20557
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
20412
20558
|
}
|
|
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(
|
|
20559
|
+
const controllersDir = join41(process.cwd(), base, "src", "controllers");
|
|
20560
|
+
await Bun.write(join41(controllersDir, "BanUserController.ts"), BanUserController_default);
|
|
20561
|
+
await Bun.write(join41(controllersDir, "LockUserController.ts"), LockUserController_default);
|
|
20562
|
+
await Bun.write(join41(controllersDir, "SignOutController.ts"), SignOutController_default);
|
|
20563
|
+
await Bun.write(join41(controllersDir, "UpdateUserProfileController.ts"), UpdateUserProfileController_default);
|
|
20564
|
+
await Bun.write(join41(controllersDir, "UpdateUserProfileImageController.ts"), UpdateUserProfileImageController_default);
|
|
20565
|
+
await Bun.write(join41(controllersDir, "DeleteUserProfileImageController.ts"), DeleteUserProfileImageController_default);
|
|
20566
|
+
await Bun.write(join41(controllersDir, "UpdateUserRolesController.ts"), UpdateUserRolesController_default);
|
|
20421
20567
|
const makeServiceCommand = new MakeServiceCommand;
|
|
20422
20568
|
const services = [
|
|
20423
20569
|
"BanUser",
|
|
@@ -20431,17 +20577,17 @@ class MakeResourceUserCommand {
|
|
|
20431
20577
|
for (const name of services) {
|
|
20432
20578
|
await makeServiceCommand.run({ name, module });
|
|
20433
20579
|
}
|
|
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 =
|
|
20580
|
+
const servicesDir = join41(process.cwd(), base, "src", "services");
|
|
20581
|
+
await Bun.write(join41(servicesDir, "BanUserService.ts"), BanUserService_default);
|
|
20582
|
+
await Bun.write(join41(servicesDir, "LockUserService.ts"), LockUserService_default);
|
|
20583
|
+
await Bun.write(join41(servicesDir, "SignOutService.ts"), SignOutService_default);
|
|
20584
|
+
await Bun.write(join41(servicesDir, "UpdateUserProfileService.ts"), UpdateUserProfileService_default);
|
|
20585
|
+
await Bun.write(join41(servicesDir, "UpdateUserProfileImageService.ts"), UpdateUserProfileImageService_default);
|
|
20586
|
+
await Bun.write(join41(servicesDir, "DeleteUserProfileImageService.ts"), DeleteUserProfileImageService_default);
|
|
20587
|
+
await Bun.write(join41(servicesDir, "UpdateUserRolesService.ts"), UpdateUserRolesService_default);
|
|
20588
|
+
const entityPath = join41(process.cwd(), base, "src", "entities", "UserEntity.ts");
|
|
20443
20589
|
await Bun.write(entityPath, UserEntity_default);
|
|
20444
|
-
const migrationsDir =
|
|
20590
|
+
const migrationsDir = join41(process.cwd(), base, "src", "migrations");
|
|
20445
20591
|
const glob = new Glob13("Migration*.ts");
|
|
20446
20592
|
for await (const file of glob.scan(migrationsDir)) {
|
|
20447
20593
|
if (file === "migrations.ts")
|
|
@@ -20449,18 +20595,18 @@ class MakeResourceUserCommand {
|
|
|
20449
20595
|
const name = file.replace(/\.ts$/, "");
|
|
20450
20596
|
const version = name.replace("Migration", "");
|
|
20451
20597
|
const content = UserMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
20452
|
-
await Bun.write(
|
|
20598
|
+
await Bun.write(join41(migrationsDir, file), content);
|
|
20453
20599
|
}
|
|
20454
|
-
const repositoryPath =
|
|
20600
|
+
const repositoryPath = join41(process.cwd(), base, "src", "repositories", "UserRepository.ts");
|
|
20455
20601
|
await Bun.write(repositoryPath, UserRepository_default);
|
|
20456
20602
|
}
|
|
20457
20603
|
}
|
|
20458
20604
|
MakeResourceUserCommand = __legacyDecorateClassTS([
|
|
20459
|
-
|
|
20605
|
+
decorator41.command()
|
|
20460
20606
|
], MakeResourceUserCommand);
|
|
20461
20607
|
// src/commands/MakeResourceVideoCommand.ts
|
|
20462
|
-
import { join as
|
|
20463
|
-
import { decorator as
|
|
20608
|
+
import { join as join42 } from "path";
|
|
20609
|
+
import { decorator as decorator42 } from "@ooneex/command";
|
|
20464
20610
|
var {Glob: Glob14 } = globalThis.Bun;
|
|
20465
20611
|
|
|
20466
20612
|
// src/templates/resources/video/controllers/CreateVideoController.txt
|
|
@@ -21139,9 +21285,9 @@ class MakeResourceVideoCommand {
|
|
|
21139
21285
|
}
|
|
21140
21286
|
async run() {
|
|
21141
21287
|
const module = "video";
|
|
21142
|
-
const base =
|
|
21288
|
+
const base = join42("modules", module);
|
|
21143
21289
|
const makeModuleCommand = new MakeModuleCommand;
|
|
21144
|
-
await makeModuleCommand.run({ name: module, silent: true
|
|
21290
|
+
await makeModuleCommand.run({ name: module, silent: true });
|
|
21145
21291
|
const makeEntityCommand = new MakeEntityCommand;
|
|
21146
21292
|
await makeEntityCommand.run({ name: "Video", module, tableName: "videos" });
|
|
21147
21293
|
const makeMigrationCommand = new MakeMigrationCommand;
|
|
@@ -21174,26 +21320,26 @@ class MakeResourceVideoCommand {
|
|
|
21174
21320
|
for (const controller of controllers) {
|
|
21175
21321
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
21176
21322
|
}
|
|
21177
|
-
const controllersDir =
|
|
21178
|
-
await Bun.write(
|
|
21179
|
-
await Bun.write(
|
|
21180
|
-
await Bun.write(
|
|
21181
|
-
await Bun.write(
|
|
21182
|
-
await Bun.write(
|
|
21323
|
+
const controllersDir = join42(process.cwd(), base, "src", "controllers");
|
|
21324
|
+
await Bun.write(join42(controllersDir, "CreateVideoController.ts"), CreateVideoController_default);
|
|
21325
|
+
await Bun.write(join42(controllersDir, "GetVideoController.ts"), GetVideoController_default);
|
|
21326
|
+
await Bun.write(join42(controllersDir, "ListVideosController.ts"), ListVideosController_default);
|
|
21327
|
+
await Bun.write(join42(controllersDir, "UpdateVideoController.ts"), UpdateVideoController_default);
|
|
21328
|
+
await Bun.write(join42(controllersDir, "DeleteVideoController.ts"), DeleteVideoController_default);
|
|
21183
21329
|
const makeServiceCommand = new MakeServiceCommand;
|
|
21184
21330
|
const services = ["CreateVideo", "GetVideo", "ListVideos", "UpdateVideo", "DeleteVideo"];
|
|
21185
21331
|
for (const name of services) {
|
|
21186
21332
|
await makeServiceCommand.run({ name, module });
|
|
21187
21333
|
}
|
|
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 =
|
|
21334
|
+
const servicesDir = join42(process.cwd(), base, "src", "services");
|
|
21335
|
+
await Bun.write(join42(servicesDir, "CreateVideoService.ts"), CreateVideoService_default);
|
|
21336
|
+
await Bun.write(join42(servicesDir, "GetVideoService.ts"), GetVideoService_default);
|
|
21337
|
+
await Bun.write(join42(servicesDir, "ListVideosService.ts"), ListVideosService_default);
|
|
21338
|
+
await Bun.write(join42(servicesDir, "UpdateVideoService.ts"), UpdateVideoService_default);
|
|
21339
|
+
await Bun.write(join42(servicesDir, "DeleteVideoService.ts"), DeleteVideoService_default);
|
|
21340
|
+
const entityPath = join42(process.cwd(), base, "src", "entities", "VideoEntity.ts");
|
|
21195
21341
|
await Bun.write(entityPath, VideoEntity_default);
|
|
21196
|
-
const migrationsDir =
|
|
21342
|
+
const migrationsDir = join42(process.cwd(), base, "src", "migrations");
|
|
21197
21343
|
const glob = new Glob14("Migration*.ts");
|
|
21198
21344
|
for await (const file of glob.scan(migrationsDir)) {
|
|
21199
21345
|
if (file === "migrations.ts")
|
|
@@ -21201,24 +21347,24 @@ class MakeResourceVideoCommand {
|
|
|
21201
21347
|
const name = file.replace(/\.ts$/, "");
|
|
21202
21348
|
const version = name.replace("Migration", "");
|
|
21203
21349
|
const content = VideoMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
21204
|
-
await Bun.write(
|
|
21350
|
+
await Bun.write(join42(migrationsDir, file), content);
|
|
21205
21351
|
}
|
|
21206
|
-
const repositoryPath =
|
|
21352
|
+
const repositoryPath = join42(process.cwd(), base, "src", "repositories", "VideoRepository.ts");
|
|
21207
21353
|
await Bun.write(repositoryPath, VideoRepository_default);
|
|
21208
21354
|
}
|
|
21209
21355
|
}
|
|
21210
21356
|
MakeResourceVideoCommand = __legacyDecorateClassTS([
|
|
21211
|
-
|
|
21357
|
+
decorator42.command()
|
|
21212
21358
|
], MakeResourceVideoCommand);
|
|
21213
21359
|
// src/commands/MakeStorageCommand.ts
|
|
21214
|
-
import { join as
|
|
21215
|
-
import { decorator as
|
|
21216
|
-
import { TerminalLogger as
|
|
21360
|
+
import { join as join43 } from "path";
|
|
21361
|
+
import { decorator as decorator43 } from "@ooneex/command";
|
|
21362
|
+
import { TerminalLogger as TerminalLogger28 } from "@ooneex/logger";
|
|
21217
21363
|
import { toPascalCase as toPascalCase16, toSnakeCase as toSnakeCase3 } from "@ooneex/utils";
|
|
21218
21364
|
|
|
21219
21365
|
// src/templates/storage.test.txt
|
|
21220
21366
|
var storage_test_default = `import { describe, expect, test } from "bun:test";
|
|
21221
|
-
import { {{NAME}}StorageAdapter } from "
|
|
21367
|
+
import { {{NAME}}StorageAdapter } from "@module/{{MODULE}}/storage/{{NAME}}StorageAdapter";
|
|
21222
21368
|
|
|
21223
21369
|
describe("{{NAME}}StorageAdapter", () => {
|
|
21224
21370
|
test("should have class name ending with 'StorageAdapter'", () => {
|
|
@@ -21313,28 +21459,28 @@ class MakeStorageCommand {
|
|
|
21313
21459
|
if (module) {
|
|
21314
21460
|
await ensureModule(module);
|
|
21315
21461
|
}
|
|
21316
|
-
const base = module ?
|
|
21317
|
-
const storageLocalDir =
|
|
21318
|
-
const storageDir =
|
|
21319
|
-
const filePath =
|
|
21462
|
+
const base = module ? join43("modules", module) : ".";
|
|
21463
|
+
const storageLocalDir = join43(base, "src", "storage");
|
|
21464
|
+
const storageDir = join43(process.cwd(), storageLocalDir);
|
|
21465
|
+
const filePath = join43(storageDir, `${name}Storage.ts`);
|
|
21320
21466
|
await Bun.write(filePath, content);
|
|
21321
|
-
const testContent = storage_test_default.replace(/{{NAME}}/g, name);
|
|
21322
|
-
const testsLocalDir =
|
|
21323
|
-
const testsDir =
|
|
21324
|
-
const testFilePath =
|
|
21467
|
+
const testContent = storage_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
21468
|
+
const testsLocalDir = join43(base, "tests", "storage");
|
|
21469
|
+
const testsDir = join43(process.cwd(), testsLocalDir);
|
|
21470
|
+
const testFilePath = join43(testsDir, `${name}Storage.spec.ts`);
|
|
21325
21471
|
await Bun.write(testFilePath, testContent);
|
|
21326
|
-
const logger = new
|
|
21327
|
-
logger.success(`${
|
|
21472
|
+
const logger = new TerminalLogger28;
|
|
21473
|
+
logger.success(`${join43(storageLocalDir, name)}Storage.ts created successfully`, undefined, {
|
|
21328
21474
|
showTimestamp: false,
|
|
21329
21475
|
showArrow: false,
|
|
21330
21476
|
useSymbol: true
|
|
21331
21477
|
});
|
|
21332
|
-
logger.success(`${
|
|
21478
|
+
logger.success(`${join43(testsLocalDir, name)}Storage.spec.ts created successfully`, undefined, {
|
|
21333
21479
|
showTimestamp: false,
|
|
21334
21480
|
showArrow: false,
|
|
21335
21481
|
useSymbol: true
|
|
21336
21482
|
});
|
|
21337
|
-
const packageJsonPath =
|
|
21483
|
+
const packageJsonPath = join43(process.cwd(), "package.json");
|
|
21338
21484
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
21339
21485
|
const deps = packageJson.dependencies ?? {};
|
|
21340
21486
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -21349,17 +21495,17 @@ class MakeStorageCommand {
|
|
|
21349
21495
|
}
|
|
21350
21496
|
}
|
|
21351
21497
|
MakeStorageCommand = __legacyDecorateClassTS([
|
|
21352
|
-
|
|
21498
|
+
decorator43.command()
|
|
21353
21499
|
], MakeStorageCommand);
|
|
21354
21500
|
// src/commands/MakeVectorDatabaseCommand.ts
|
|
21355
|
-
import { join as
|
|
21356
|
-
import { decorator as
|
|
21357
|
-
import { TerminalLogger as
|
|
21501
|
+
import { join as join44 } from "path";
|
|
21502
|
+
import { decorator as decorator44 } from "@ooneex/command";
|
|
21503
|
+
import { TerminalLogger as TerminalLogger29 } from "@ooneex/logger";
|
|
21358
21504
|
import { toPascalCase as toPascalCase17 } from "@ooneex/utils";
|
|
21359
21505
|
|
|
21360
21506
|
// src/templates/vector-database.test.txt
|
|
21361
21507
|
var vector_database_test_default = `import { describe, expect, test } from "bun:test";
|
|
21362
|
-
import { {{NAME}}VectorDatabase } from "
|
|
21508
|
+
import { {{NAME}}VectorDatabase } from "@module/{{MODULE}}/databases/{{NAME}}VectorDatabase";
|
|
21363
21509
|
|
|
21364
21510
|
describe("{{NAME}}VectorDatabase", () => {
|
|
21365
21511
|
test("should have class name ending with 'VectorDatabase'", () => {
|
|
@@ -21428,28 +21574,28 @@ class MakeVectorDatabaseCommand {
|
|
|
21428
21574
|
if (module) {
|
|
21429
21575
|
await ensureModule(module);
|
|
21430
21576
|
}
|
|
21431
|
-
const base = module ?
|
|
21432
|
-
const vectorDatabaseLocalDir =
|
|
21433
|
-
const vectorDatabaseDir =
|
|
21434
|
-
const filePath =
|
|
21577
|
+
const base = module ? join44("modules", module) : ".";
|
|
21578
|
+
const vectorDatabaseLocalDir = join44(base, "src", "databases");
|
|
21579
|
+
const vectorDatabaseDir = join44(process.cwd(), vectorDatabaseLocalDir);
|
|
21580
|
+
const filePath = join44(vectorDatabaseDir, `${name}VectorDatabase.ts`);
|
|
21435
21581
|
await Bun.write(filePath, content);
|
|
21436
|
-
const testContent = vector_database_test_default.replace(/{{NAME}}/g, name);
|
|
21437
|
-
const testsLocalDir =
|
|
21438
|
-
const testsDir =
|
|
21439
|
-
const testFilePath =
|
|
21582
|
+
const testContent = vector_database_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
21583
|
+
const testsLocalDir = join44(base, "tests", "databases");
|
|
21584
|
+
const testsDir = join44(process.cwd(), testsLocalDir);
|
|
21585
|
+
const testFilePath = join44(testsDir, `${name}VectorDatabase.spec.ts`);
|
|
21440
21586
|
await Bun.write(testFilePath, testContent);
|
|
21441
|
-
const logger = new
|
|
21442
|
-
logger.success(`${
|
|
21587
|
+
const logger = new TerminalLogger29;
|
|
21588
|
+
logger.success(`${join44(vectorDatabaseLocalDir, name)}VectorDatabase.ts created successfully`, undefined, {
|
|
21443
21589
|
showTimestamp: false,
|
|
21444
21590
|
showArrow: false,
|
|
21445
21591
|
useSymbol: true
|
|
21446
21592
|
});
|
|
21447
|
-
logger.success(`${
|
|
21593
|
+
logger.success(`${join44(testsLocalDir, name)}VectorDatabase.spec.ts created successfully`, undefined, {
|
|
21448
21594
|
showTimestamp: false,
|
|
21449
21595
|
showArrow: false,
|
|
21450
21596
|
useSymbol: true
|
|
21451
21597
|
});
|
|
21452
|
-
const packageJsonPath =
|
|
21598
|
+
const packageJsonPath = join44(process.cwd(), "package.json");
|
|
21453
21599
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
21454
21600
|
const deps = packageJson.dependencies ?? {};
|
|
21455
21601
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -21464,13 +21610,13 @@ class MakeVectorDatabaseCommand {
|
|
|
21464
21610
|
}
|
|
21465
21611
|
}
|
|
21466
21612
|
MakeVectorDatabaseCommand = __legacyDecorateClassTS([
|
|
21467
|
-
|
|
21613
|
+
decorator44.command()
|
|
21468
21614
|
], MakeVectorDatabaseCommand);
|
|
21469
21615
|
// src/commands/MigrationUpCommand.ts
|
|
21470
|
-
import { existsSync } from "fs";
|
|
21471
|
-
import { join as
|
|
21472
|
-
import { decorator as
|
|
21473
|
-
import { TerminalLogger as
|
|
21616
|
+
import { existsSync as existsSync2 } from "fs";
|
|
21617
|
+
import { join as join45 } from "path";
|
|
21618
|
+
import { decorator as decorator45 } from "@ooneex/command";
|
|
21619
|
+
import { TerminalLogger as TerminalLogger30 } from "@ooneex/logger";
|
|
21474
21620
|
class MigrationUpCommand {
|
|
21475
21621
|
getName() {
|
|
21476
21622
|
return "migration:up";
|
|
@@ -21478,10 +21624,10 @@ class MigrationUpCommand {
|
|
|
21478
21624
|
getDescription() {
|
|
21479
21625
|
return "Run migrations for all modules";
|
|
21480
21626
|
}
|
|
21481
|
-
async run() {
|
|
21482
|
-
const logger = new
|
|
21483
|
-
const modulesDir =
|
|
21484
|
-
if (!
|
|
21627
|
+
async run(options) {
|
|
21628
|
+
const logger = new TerminalLogger30;
|
|
21629
|
+
const modulesDir = join45(process.cwd(), "modules");
|
|
21630
|
+
if (!existsSync2(modulesDir)) {
|
|
21485
21631
|
logger.warn("No modules with migrations found", undefined, {
|
|
21486
21632
|
showTimestamp: false,
|
|
21487
21633
|
showArrow: false,
|
|
@@ -21493,10 +21639,10 @@ class MigrationUpCommand {
|
|
|
21493
21639
|
const modules = [];
|
|
21494
21640
|
for await (const match of glob.scan({ cwd: modulesDir, onlyFiles: true })) {
|
|
21495
21641
|
const entry = match.replace("/package.json", "");
|
|
21496
|
-
const moduleDir =
|
|
21497
|
-
const migrationUpFile = Bun.file(
|
|
21642
|
+
const moduleDir = join45(modulesDir, entry);
|
|
21643
|
+
const migrationUpFile = Bun.file(join45(moduleDir, "bin", "migration", "up.ts"));
|
|
21498
21644
|
if (await migrationUpFile.exists()) {
|
|
21499
|
-
const packageJson = await Bun.file(
|
|
21645
|
+
const packageJson = await Bun.file(join45(modulesDir, match)).json();
|
|
21500
21646
|
modules.push({ name: packageJson.name ?? entry, dir: moduleDir });
|
|
21501
21647
|
}
|
|
21502
21648
|
}
|
|
@@ -21509,13 +21655,17 @@ class MigrationUpCommand {
|
|
|
21509
21655
|
return;
|
|
21510
21656
|
}
|
|
21511
21657
|
for (const { name, dir } of modules) {
|
|
21512
|
-
const migrationUpPath =
|
|
21658
|
+
const migrationUpPath = join45(dir, "bin", "migration", "up.ts");
|
|
21513
21659
|
logger.info(`Running migrations for ${name}...`, undefined, {
|
|
21514
21660
|
showTimestamp: false,
|
|
21515
21661
|
showArrow: false,
|
|
21516
21662
|
useSymbol: false
|
|
21517
21663
|
});
|
|
21518
|
-
const
|
|
21664
|
+
const args = ["bun", "run", migrationUpPath];
|
|
21665
|
+
if (options.drop) {
|
|
21666
|
+
args.push("--drop");
|
|
21667
|
+
}
|
|
21668
|
+
const proc = Bun.spawn(args, {
|
|
21519
21669
|
cwd: dir,
|
|
21520
21670
|
stdout: "inherit",
|
|
21521
21671
|
stderr: "inherit"
|
|
@@ -21538,13 +21688,140 @@ class MigrationUpCommand {
|
|
|
21538
21688
|
}
|
|
21539
21689
|
}
|
|
21540
21690
|
MigrationUpCommand = __legacyDecorateClassTS([
|
|
21541
|
-
|
|
21691
|
+
decorator45.command()
|
|
21542
21692
|
], MigrationUpCommand);
|
|
21693
|
+
// src/commands/RemoveModuleCommand.ts
|
|
21694
|
+
import { rmdir } from "fs/promises";
|
|
21695
|
+
import { join as join46 } from "path";
|
|
21696
|
+
import { decorator as decorator46 } from "@ooneex/command";
|
|
21697
|
+
import { TerminalLogger as TerminalLogger31 } from "@ooneex/logger";
|
|
21698
|
+
import { toKebabCase as toKebabCase5, toPascalCase as toPascalCase18 } from "@ooneex/utils";
|
|
21699
|
+
class RemoveModuleCommand {
|
|
21700
|
+
getName() {
|
|
21701
|
+
return "remove:module";
|
|
21702
|
+
}
|
|
21703
|
+
getDescription() {
|
|
21704
|
+
return "Remove an existing module";
|
|
21705
|
+
}
|
|
21706
|
+
async removeFromAppModule(appModulePath, pascalName, kebabName) {
|
|
21707
|
+
if (!await Bun.file(appModulePath).exists())
|
|
21708
|
+
return;
|
|
21709
|
+
let content = await Bun.file(appModulePath).text();
|
|
21710
|
+
const moduleName = `${pascalName}Module`;
|
|
21711
|
+
const importPath = `@module/${kebabName}/${moduleName}`;
|
|
21712
|
+
const importRegex = new RegExp(`import\\s*\\{\\s*${moduleName}\\s*\\}\\s*from\\s*"${importPath.replace(/\//g, "\\/")}";\\s*\\n`, "g");
|
|
21713
|
+
content = content.replace(importRegex, "");
|
|
21714
|
+
const fields = ["controllers", "middlewares", "cronJobs", "events"];
|
|
21715
|
+
for (const field of fields) {
|
|
21716
|
+
const spread = `...${moduleName}.${field}`;
|
|
21717
|
+
content = content.replace(new RegExp(`,\\s*${spread.replace(/\./g, "\\.")}`, "g"), "");
|
|
21718
|
+
content = content.replace(new RegExp(`${spread.replace(/\./g, "\\.")}\\s*,\\s*`, "g"), "");
|
|
21719
|
+
content = content.replace(new RegExp(`${spread.replace(/\./g, "\\.")}`, "g"), "");
|
|
21720
|
+
}
|
|
21721
|
+
await Bun.write(appModulePath, content);
|
|
21722
|
+
}
|
|
21723
|
+
async removeFromSharedModule(sharedModulePath, pascalName, kebabName) {
|
|
21724
|
+
if (!await Bun.file(sharedModulePath).exists())
|
|
21725
|
+
return;
|
|
21726
|
+
let content = await Bun.file(sharedModulePath).text();
|
|
21727
|
+
const moduleName = `${pascalName}Module`;
|
|
21728
|
+
const importPath = `@module/${kebabName}/${moduleName}`;
|
|
21729
|
+
const importRegex = new RegExp(`import\\s*\\{\\s*${moduleName}\\s*\\}\\s*from\\s*"${importPath.replace(/\//g, "\\/")}";\\s*\\n`, "g");
|
|
21730
|
+
content = content.replace(importRegex, "");
|
|
21731
|
+
const spread = `...${moduleName}.entities`;
|
|
21732
|
+
content = content.replace(new RegExp(`,\\s*${spread.replace(/\./g, "\\.")}`, "g"), "");
|
|
21733
|
+
content = content.replace(new RegExp(`${spread.replace(/\./g, "\\.")}\\s*,\\s*`, "g"), "");
|
|
21734
|
+
content = content.replace(new RegExp(`${spread.replace(/\./g, "\\.")}`, "g"), "");
|
|
21735
|
+
await Bun.write(sharedModulePath, content);
|
|
21736
|
+
}
|
|
21737
|
+
async removeModuleScope(commitlintPath, kebabName) {
|
|
21738
|
+
if (!await Bun.file(commitlintPath).exists())
|
|
21739
|
+
return;
|
|
21740
|
+
let content = await Bun.file(commitlintPath).text();
|
|
21741
|
+
const scope = `"${kebabName}"`;
|
|
21742
|
+
content = content.replace(new RegExp(`\\s*${scope.replace(/"/g, "\\\"")}\\s*,?`, "g"), "");
|
|
21743
|
+
content = content.replace(/,\s*,/g, ",");
|
|
21744
|
+
content = content.replace(/,(\s*\])/g, "$1");
|
|
21745
|
+
await Bun.write(commitlintPath, content);
|
|
21746
|
+
}
|
|
21747
|
+
async removePathAlias(tsconfigPath, kebabName) {
|
|
21748
|
+
if (!await Bun.file(tsconfigPath).exists())
|
|
21749
|
+
return;
|
|
21750
|
+
const content = await Bun.file(tsconfigPath).text();
|
|
21751
|
+
const tsconfig = JSON.parse(content);
|
|
21752
|
+
if (tsconfig.compilerOptions?.paths) {
|
|
21753
|
+
delete tsconfig.compilerOptions.paths[`@module/${kebabName}/*`];
|
|
21754
|
+
}
|
|
21755
|
+
await Bun.write(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}
|
|
21756
|
+
`);
|
|
21757
|
+
}
|
|
21758
|
+
async run(options) {
|
|
21759
|
+
const { cwd = process.cwd(), silent = false } = options;
|
|
21760
|
+
let { name } = options;
|
|
21761
|
+
if (!name) {
|
|
21762
|
+
name = await askName({ message: "Enter module name to remove" });
|
|
21763
|
+
}
|
|
21764
|
+
const pascalName = toPascalCase18(name).replace(/Module$/, "");
|
|
21765
|
+
const kebabName = toKebabCase5(pascalName);
|
|
21766
|
+
if (kebabName === "app" || kebabName === "shared") {
|
|
21767
|
+
if (!silent) {
|
|
21768
|
+
const logger = new TerminalLogger31;
|
|
21769
|
+
logger.error(`Cannot remove the "${kebabName}" module`, undefined, {
|
|
21770
|
+
showTimestamp: false,
|
|
21771
|
+
showArrow: false,
|
|
21772
|
+
useSymbol: true
|
|
21773
|
+
});
|
|
21774
|
+
}
|
|
21775
|
+
return;
|
|
21776
|
+
}
|
|
21777
|
+
const moduleDir = join46(cwd, "modules", kebabName);
|
|
21778
|
+
const moduleDirExists = await Bun.file(join46(moduleDir, "package.json")).exists();
|
|
21779
|
+
if (!moduleDirExists) {
|
|
21780
|
+
if (!silent) {
|
|
21781
|
+
const logger = new TerminalLogger31;
|
|
21782
|
+
logger.error(`Module "${kebabName}" does not exist`, undefined, {
|
|
21783
|
+
showTimestamp: false,
|
|
21784
|
+
showArrow: false,
|
|
21785
|
+
useSymbol: true
|
|
21786
|
+
});
|
|
21787
|
+
}
|
|
21788
|
+
return;
|
|
21789
|
+
}
|
|
21790
|
+
if (!silent) {
|
|
21791
|
+
const confirmed = await askConfirm({
|
|
21792
|
+
message: `Are you sure you want to remove the "${kebabName}" module?`,
|
|
21793
|
+
initial: false
|
|
21794
|
+
});
|
|
21795
|
+
if (!confirmed)
|
|
21796
|
+
return;
|
|
21797
|
+
}
|
|
21798
|
+
const appModulePath = join46(cwd, "modules", "app", "src", "AppModule.ts");
|
|
21799
|
+
await this.removeFromAppModule(appModulePath, pascalName, kebabName);
|
|
21800
|
+
const sharedModulePath = join46(cwd, "modules", "shared", "src", "SharedModule.ts");
|
|
21801
|
+
await this.removeFromSharedModule(sharedModulePath, pascalName, kebabName);
|
|
21802
|
+
const appTsconfigPath = join46(cwd, "tsconfig.json");
|
|
21803
|
+
await this.removePathAlias(appTsconfigPath, kebabName);
|
|
21804
|
+
const commitlintPath = join46(cwd, ".commitlintrc.ts");
|
|
21805
|
+
await this.removeModuleScope(commitlintPath, kebabName);
|
|
21806
|
+
await rmdir(moduleDir, { recursive: true });
|
|
21807
|
+
if (!silent) {
|
|
21808
|
+
const logger = new TerminalLogger31;
|
|
21809
|
+
logger.success(`modules/${kebabName} removed successfully`, undefined, {
|
|
21810
|
+
showTimestamp: false,
|
|
21811
|
+
showArrow: false,
|
|
21812
|
+
useSymbol: true
|
|
21813
|
+
});
|
|
21814
|
+
}
|
|
21815
|
+
}
|
|
21816
|
+
}
|
|
21817
|
+
RemoveModuleCommand = __legacyDecorateClassTS([
|
|
21818
|
+
decorator46.command()
|
|
21819
|
+
], RemoveModuleCommand);
|
|
21543
21820
|
// src/commands/SeedRunCommand.ts
|
|
21544
|
-
import { existsSync as
|
|
21545
|
-
import { join as
|
|
21546
|
-
import { decorator as
|
|
21547
|
-
import { TerminalLogger as
|
|
21821
|
+
import { existsSync as existsSync3 } from "fs";
|
|
21822
|
+
import { join as join47 } from "path";
|
|
21823
|
+
import { decorator as decorator47 } from "@ooneex/command";
|
|
21824
|
+
import { TerminalLogger as TerminalLogger32 } from "@ooneex/logger";
|
|
21548
21825
|
class SeedRunCommand {
|
|
21549
21826
|
getName() {
|
|
21550
21827
|
return "seed:run";
|
|
@@ -21552,10 +21829,10 @@ class SeedRunCommand {
|
|
|
21552
21829
|
getDescription() {
|
|
21553
21830
|
return "Run seeds for all modules";
|
|
21554
21831
|
}
|
|
21555
|
-
async run() {
|
|
21556
|
-
const logger = new
|
|
21557
|
-
const modulesDir =
|
|
21558
|
-
if (!
|
|
21832
|
+
async run(options) {
|
|
21833
|
+
const logger = new TerminalLogger32;
|
|
21834
|
+
const modulesDir = join47(process.cwd(), "modules");
|
|
21835
|
+
if (!existsSync3(modulesDir)) {
|
|
21559
21836
|
logger.warn("No modules with seeds found", undefined, {
|
|
21560
21837
|
showTimestamp: false,
|
|
21561
21838
|
showArrow: false,
|
|
@@ -21567,10 +21844,10 @@ class SeedRunCommand {
|
|
|
21567
21844
|
const modules = [];
|
|
21568
21845
|
for await (const match of glob.scan({ cwd: modulesDir, onlyFiles: true })) {
|
|
21569
21846
|
const entry = match.replace("/package.json", "");
|
|
21570
|
-
const moduleDir =
|
|
21571
|
-
const seedRunFile = Bun.file(
|
|
21847
|
+
const moduleDir = join47(modulesDir, entry);
|
|
21848
|
+
const seedRunFile = Bun.file(join47(moduleDir, "bin", "seed", "run.ts"));
|
|
21572
21849
|
if (await seedRunFile.exists()) {
|
|
21573
|
-
const packageJson = await Bun.file(
|
|
21850
|
+
const packageJson = await Bun.file(join47(modulesDir, match)).json();
|
|
21574
21851
|
modules.push({ name: packageJson.name ?? entry, dir: moduleDir });
|
|
21575
21852
|
}
|
|
21576
21853
|
}
|
|
@@ -21583,13 +21860,17 @@ class SeedRunCommand {
|
|
|
21583
21860
|
return;
|
|
21584
21861
|
}
|
|
21585
21862
|
for (const { name, dir } of modules) {
|
|
21586
|
-
const seedRunPath =
|
|
21863
|
+
const seedRunPath = join47(dir, "bin", "seed", "run.ts");
|
|
21587
21864
|
logger.info(`Running seeds for ${name}...`, undefined, {
|
|
21588
21865
|
showTimestamp: false,
|
|
21589
21866
|
showArrow: false,
|
|
21590
21867
|
useSymbol: false
|
|
21591
21868
|
});
|
|
21592
|
-
const
|
|
21869
|
+
const args = ["bun", "run", seedRunPath];
|
|
21870
|
+
if (options.drop) {
|
|
21871
|
+
args.push("--drop");
|
|
21872
|
+
}
|
|
21873
|
+
const proc = Bun.spawn(args, {
|
|
21593
21874
|
cwd: dir,
|
|
21594
21875
|
stdout: "inherit",
|
|
21595
21876
|
stderr: "inherit"
|
|
@@ -21612,9 +21893,9 @@ class SeedRunCommand {
|
|
|
21612
21893
|
}
|
|
21613
21894
|
}
|
|
21614
21895
|
SeedRunCommand = __legacyDecorateClassTS([
|
|
21615
|
-
|
|
21896
|
+
decorator47.command()
|
|
21616
21897
|
], SeedRunCommand);
|
|
21617
21898
|
// src/index.ts
|
|
21618
21899
|
await run();
|
|
21619
21900
|
|
|
21620
|
-
//# debugId=
|
|
21901
|
+
//# debugId=1350E81FA9AB75E064756E2164756E21
|