@ooneex/cli 1.21.0 → 1.23.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 +1036 -676
- package/dist/index.js.map +23 -21
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -5175,10 +5175,26 @@ _oo_modules() {
|
|
|
5175
5175
|
fi
|
|
5176
5176
|
}
|
|
5177
5177
|
|
|
5178
|
+
_oo_route_names() {
|
|
5179
|
+
local -a names
|
|
5180
|
+
if [[ -d modules ]]; then
|
|
5181
|
+
names=(\${(@f)"$(command grep -rh 'name:' modules/*/src/controllers/*Controller.ts 2>/dev/null | sed -n 's/.*name: "\\([^"]*\\)".*/\\1/p' | sort -u)"})
|
|
5182
|
+
compadd -a names
|
|
5183
|
+
fi
|
|
5184
|
+
}
|
|
5185
|
+
|
|
5186
|
+
_oo_controllers() {
|
|
5187
|
+
local -a controllers
|
|
5188
|
+
if [[ -d modules ]]; then
|
|
5189
|
+
controllers=(\${(@f)"$(command grep -rh 'export class' modules/*/src/controllers/*Controller.ts 2>/dev/null | sed -n 's/.*export class \\([^ ]*Controller\\).*/\\1/p' | sort -u)"})
|
|
5190
|
+
compadd -a controllers
|
|
5191
|
+
fi
|
|
5192
|
+
}
|
|
5193
|
+
|
|
5178
5194
|
_oo_custom_commands() {
|
|
5179
5195
|
local -a cmds
|
|
5180
5196
|
if [[ -d modules ]]; then
|
|
5181
|
-
cmds=(\${(@f)"$(command grep -rh
|
|
5197
|
+
cmds=(\${(@f)"$(command grep -rh -A1 'getName' modules/*/src/commands/*Command.ts 2>/dev/null | sed -n 's/.*return "\\(.*\\)".*/\\1/p' | sort -u)"})
|
|
5182
5198
|
compadd -a cmds
|
|
5183
5199
|
fi
|
|
5184
5200
|
}
|
|
@@ -5194,6 +5210,7 @@ _oo() {
|
|
|
5194
5210
|
'help:Show available commands'
|
|
5195
5211
|
'make\\:ai:Generate a new AI class'
|
|
5196
5212
|
'make\\:analytics:Generate a new analytics class'
|
|
5213
|
+
'make\\:benchmark:Generate a new benchmark file'
|
|
5197
5214
|
'make\\:app:Generate a new application'
|
|
5198
5215
|
'make\\:cache:Generate a new cache class'
|
|
5199
5216
|
'make\\:claude\\:skill:Generate Claude skills from templates'
|
|
@@ -5209,6 +5226,7 @@ _oo() {
|
|
|
5209
5226
|
'make\\:migration:Generate a new migration file'
|
|
5210
5227
|
'migration\\:up:Run migrations for all modules'
|
|
5211
5228
|
'make\\:module:Generate a new module'
|
|
5229
|
+
'remove\\:module:Remove an existing module'
|
|
5212
5230
|
'make\\:permission:Generate a new permission class'
|
|
5213
5231
|
'make\\:pubsub:Generate a new PubSub event class'
|
|
5214
5232
|
'make\\:release:Release packages with version bump, changelog, and git tag'
|
|
@@ -5249,6 +5267,12 @@ _oo() {
|
|
|
5249
5267
|
_arguments -s \\
|
|
5250
5268
|
'1:command name:_oo_custom_commands'
|
|
5251
5269
|
;;
|
|
5270
|
+
make:benchmark)
|
|
5271
|
+
_arguments -s \\
|
|
5272
|
+
'--name=[Benchmark name]:name:_oo_route_names' \\
|
|
5273
|
+
'--module=[Module name]:module:_oo_modules' \\
|
|
5274
|
+
'--target=[Target controller name]:target:_oo_controllers'
|
|
5275
|
+
;;
|
|
5252
5276
|
make:controller)
|
|
5253
5277
|
_arguments -s \\
|
|
5254
5278
|
'--name=[Name of the resource]:name' \\
|
|
@@ -5289,6 +5313,10 @@ _oo() {
|
|
|
5289
5313
|
_arguments -s \\
|
|
5290
5314
|
'--name=[Name of the resource]:name'
|
|
5291
5315
|
;;
|
|
5316
|
+
remove:module)
|
|
5317
|
+
_arguments -s \\
|
|
5318
|
+
'--name=[Module name]:name:_oo_modules'
|
|
5319
|
+
;;
|
|
5292
5320
|
make:docker)
|
|
5293
5321
|
_arguments -s \\
|
|
5294
5322
|
'--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)' \\
|
|
@@ -5329,10 +5357,26 @@ _ooneex_modules() {
|
|
|
5329
5357
|
fi
|
|
5330
5358
|
}
|
|
5331
5359
|
|
|
5360
|
+
_ooneex_route_names() {
|
|
5361
|
+
local -a names
|
|
5362
|
+
if [[ -d modules ]]; then
|
|
5363
|
+
names=(\${(@f)"$(command grep -rh 'name:' modules/*/src/controllers/*Controller.ts 2>/dev/null | sed -n 's/.*name: "\\([^"]*\\)".*/\\1/p' | sort -u)"})
|
|
5364
|
+
compadd -a names
|
|
5365
|
+
fi
|
|
5366
|
+
}
|
|
5367
|
+
|
|
5368
|
+
_ooneex_controllers() {
|
|
5369
|
+
local -a controllers
|
|
5370
|
+
if [[ -d modules ]]; then
|
|
5371
|
+
controllers=(\${(@f)"$(command grep -rh 'export class' modules/*/src/controllers/*Controller.ts 2>/dev/null | sed -n 's/.*export class \\([^ ]*Controller\\).*/\\1/p' | sort -u)"})
|
|
5372
|
+
compadd -a controllers
|
|
5373
|
+
fi
|
|
5374
|
+
}
|
|
5375
|
+
|
|
5332
5376
|
_ooneex_custom_commands() {
|
|
5333
5377
|
local -a cmds
|
|
5334
5378
|
if [[ -d modules ]]; then
|
|
5335
|
-
cmds=(\${(@f)"$(command grep -rh
|
|
5379
|
+
cmds=(\${(@f)"$(command grep -rh -A1 'getName' modules/*/src/commands/*Command.ts 2>/dev/null | sed -n 's/.*return "\\(.*\\)".*/\\1/p' | sort -u)"})
|
|
5336
5380
|
compadd -a cmds
|
|
5337
5381
|
fi
|
|
5338
5382
|
}
|
|
@@ -5348,6 +5392,7 @@ _ooneex() {
|
|
|
5348
5392
|
'help:Show available commands'
|
|
5349
5393
|
'make\\:ai:Generate a new AI class'
|
|
5350
5394
|
'make\\:analytics:Generate a new analytics class'
|
|
5395
|
+
'make\\:benchmark:Generate a new benchmark file'
|
|
5351
5396
|
'make\\:app:Generate a new application'
|
|
5352
5397
|
'make\\:cache:Generate a new cache class'
|
|
5353
5398
|
'make\\:claude\\:skill:Generate Claude skills from templates'
|
|
@@ -5363,6 +5408,7 @@ _ooneex() {
|
|
|
5363
5408
|
'make\\:migration:Generate a new migration file'
|
|
5364
5409
|
'migration\\:up:Run migrations for all modules'
|
|
5365
5410
|
'make\\:module:Generate a new module'
|
|
5411
|
+
'remove\\:module:Remove an existing module'
|
|
5366
5412
|
'make\\:permission:Generate a new permission class'
|
|
5367
5413
|
'make\\:pubsub:Generate a new PubSub event class'
|
|
5368
5414
|
'make\\:release:Release packages with version bump, changelog, and git tag'
|
|
@@ -5403,6 +5449,12 @@ _ooneex() {
|
|
|
5403
5449
|
_arguments -s \\
|
|
5404
5450
|
'1:command name:_ooneex_custom_commands'
|
|
5405
5451
|
;;
|
|
5452
|
+
make:benchmark)
|
|
5453
|
+
_arguments -s \\
|
|
5454
|
+
'--name=[Benchmark name]:name:_ooneex_route_names' \\
|
|
5455
|
+
'--module=[Module name]:module:_ooneex_modules' \\
|
|
5456
|
+
'--target=[Target controller name]:target:_ooneex_controllers'
|
|
5457
|
+
;;
|
|
5406
5458
|
make:controller)
|
|
5407
5459
|
_arguments -s \\
|
|
5408
5460
|
'--name=[Name of the resource]:name' \\
|
|
@@ -5443,6 +5495,10 @@ _ooneex() {
|
|
|
5443
5495
|
_arguments -s \\
|
|
5444
5496
|
'--name=[Name of the resource]:name'
|
|
5445
5497
|
;;
|
|
5498
|
+
remove:module)
|
|
5499
|
+
_arguments -s \\
|
|
5500
|
+
'--name=[Module name]:name:_ooneex_modules'
|
|
5501
|
+
;;
|
|
5446
5502
|
make:docker)
|
|
5447
5503
|
_arguments -s \\
|
|
5448
5504
|
'--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)' \\
|
|
@@ -5598,7 +5654,7 @@ var askName = async (config) => {
|
|
|
5598
5654
|
|
|
5599
5655
|
// src/templates/ai.test.txt
|
|
5600
5656
|
var ai_test_default = `import { describe, expect, test } from "bun:test";
|
|
5601
|
-
import { {{NAME}}Ai } from "
|
|
5657
|
+
import { {{NAME}}Ai } from "@module/{{MODULE}}/ai/{{NAME}}Ai";
|
|
5602
5658
|
|
|
5603
5659
|
describe("{{NAME}}Ai", () => {
|
|
5604
5660
|
test("should have class name ending with 'Ai'", () => {
|
|
@@ -5867,7 +5923,7 @@ class MakeAiCommand {
|
|
|
5867
5923
|
const aiDir = join8(process.cwd(), aiLocalDir);
|
|
5868
5924
|
const filePath = join8(aiDir, `${name}Ai.ts`);
|
|
5869
5925
|
await Bun.write(filePath, content);
|
|
5870
|
-
const testContent = ai_test_default.replace(/{{NAME}}/g, name);
|
|
5926
|
+
const testContent = ai_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
5871
5927
|
const testsLocalDir = join8(base, "tests", "ai");
|
|
5872
5928
|
const testsDir = join8(process.cwd(), testsLocalDir);
|
|
5873
5929
|
const testFilePath = join8(testsDir, `${name}Ai.spec.ts`);
|
|
@@ -5900,15 +5956,129 @@ class MakeAiCommand {
|
|
|
5900
5956
|
MakeAiCommand = __legacyDecorateClassTS([
|
|
5901
5957
|
decorator8.command()
|
|
5902
5958
|
], MakeAiCommand);
|
|
5903
|
-
// src/commands/
|
|
5959
|
+
// src/commands/MakeBenchmarkCommand.ts
|
|
5904
5960
|
import { join as join9 } from "path";
|
|
5905
5961
|
import { decorator as decorator9 } from "@ooneex/command";
|
|
5906
5962
|
import { TerminalLogger as TerminalLogger8 } from "@ooneex/logger";
|
|
5963
|
+
class MakeBenchmarkCommand {
|
|
5964
|
+
getName() {
|
|
5965
|
+
return "make:benchmark";
|
|
5966
|
+
}
|
|
5967
|
+
getDescription() {
|
|
5968
|
+
return "Generate a new benchmark file";
|
|
5969
|
+
}
|
|
5970
|
+
parseController(content) {
|
|
5971
|
+
const methodMatch = content.match(/@Route\.(get|post|patch|put|delete|options|head)\(/);
|
|
5972
|
+
const method = methodMatch?.[1]?.toUpperCase() ?? "GET";
|
|
5973
|
+
const pathMatch = content.match(/@Route\.\w+\("([^"]+)"/);
|
|
5974
|
+
const path = pathMatch?.[1] ?? "/";
|
|
5975
|
+
const nameMatch = content.match(/name:\s*"([^"]+)"/);
|
|
5976
|
+
const name = nameMatch?.[1] ?? "";
|
|
5977
|
+
const descriptionMatch = content.match(/description:\s*"([^"]+)"/);
|
|
5978
|
+
const description = descriptionMatch?.[1] ?? "";
|
|
5979
|
+
const params = this.parseParams(content);
|
|
5980
|
+
const queries = this.parseAssertBlock(content, "queries");
|
|
5981
|
+
const payload = this.parseAssertBlock(content, "payload");
|
|
5982
|
+
return { name, path, method, description, params, queries, payload };
|
|
5983
|
+
}
|
|
5984
|
+
parseParams(content) {
|
|
5985
|
+
const params = {};
|
|
5986
|
+
const paramsMatch = content.match(/params:\s*\{([^}]*Assert[^}]+)\}/);
|
|
5987
|
+
if (paramsMatch?.[1]) {
|
|
5988
|
+
const keys = paramsMatch[1].matchAll(/(\w+):\s*Assert\(/g);
|
|
5989
|
+
for (const match of keys) {
|
|
5990
|
+
if (match[1]) {
|
|
5991
|
+
params[match[1]] = "";
|
|
5992
|
+
}
|
|
5993
|
+
}
|
|
5994
|
+
}
|
|
5995
|
+
return params;
|
|
5996
|
+
}
|
|
5997
|
+
parseAssertBlock(content, block) {
|
|
5998
|
+
const result = {};
|
|
5999
|
+
const regex = new RegExp(`${block}:\\s*Assert\\(\\{([^}]+)\\}\\)`);
|
|
6000
|
+
const match = content.match(regex);
|
|
6001
|
+
if (match?.[1]) {
|
|
6002
|
+
const fields = match[1].matchAll(/(\w+):\s*"(\w+\??(?:\[\])?)"/g);
|
|
6003
|
+
for (const field of fields) {
|
|
6004
|
+
if (field[1] && field[2]) {
|
|
6005
|
+
const type = field[2].replace("?", "").replace("[]", "");
|
|
6006
|
+
result[field[1]] = type === "number" ? 0 : "";
|
|
6007
|
+
}
|
|
6008
|
+
}
|
|
6009
|
+
}
|
|
6010
|
+
return result;
|
|
6011
|
+
}
|
|
6012
|
+
async run(options) {
|
|
6013
|
+
let { name, module, target } = options;
|
|
6014
|
+
if (!name) {
|
|
6015
|
+
name = await askName({ message: "Enter benchmark name" });
|
|
6016
|
+
}
|
|
6017
|
+
if (!target) {
|
|
6018
|
+
target = await askName({ message: "Enter target controller name (e.g., UpdateStatusController)" });
|
|
6019
|
+
}
|
|
6020
|
+
const targetName = target.replace(/Controller$/, "");
|
|
6021
|
+
if (module) {
|
|
6022
|
+
await ensureModule(module);
|
|
6023
|
+
}
|
|
6024
|
+
const base = module ? join9("modules", module) : ".";
|
|
6025
|
+
const controllersLocalDir = join9(base, "src", "controllers");
|
|
6026
|
+
const controllersDir = join9(process.cwd(), controllersLocalDir);
|
|
6027
|
+
const controllerFilePath = join9(controllersDir, `${targetName}Controller.ts`);
|
|
6028
|
+
const controllerFile = Bun.file(controllerFilePath);
|
|
6029
|
+
if (!await controllerFile.exists()) {
|
|
6030
|
+
const logger2 = new TerminalLogger8;
|
|
6031
|
+
logger2.error(`Controller not found: ${controllerFilePath}`, undefined, {
|
|
6032
|
+
showTimestamp: false,
|
|
6033
|
+
showArrow: false,
|
|
6034
|
+
useSymbol: true
|
|
6035
|
+
});
|
|
6036
|
+
return;
|
|
6037
|
+
}
|
|
6038
|
+
const controllerContent = await controllerFile.text();
|
|
6039
|
+
const routeInfo = this.parseController(controllerContent);
|
|
6040
|
+
const benchmark = {
|
|
6041
|
+
name: routeInfo.name,
|
|
6042
|
+
path: routeInfo.path,
|
|
6043
|
+
method: routeInfo.method,
|
|
6044
|
+
description: routeInfo.description
|
|
6045
|
+
};
|
|
6046
|
+
if (Object.keys(routeInfo.params).length > 0) {
|
|
6047
|
+
benchmark.params = routeInfo.params;
|
|
6048
|
+
}
|
|
6049
|
+
if (Object.keys(routeInfo.queries).length > 0) {
|
|
6050
|
+
benchmark.queries = routeInfo.queries;
|
|
6051
|
+
}
|
|
6052
|
+
if (Object.keys(routeInfo.payload).length > 0) {
|
|
6053
|
+
benchmark.payload = routeInfo.payload;
|
|
6054
|
+
}
|
|
6055
|
+
benchmark.connections = 10;
|
|
6056
|
+
benchmark.duration = 10;
|
|
6057
|
+
const jsonContent = JSON.stringify(benchmark, null, 2);
|
|
6058
|
+
const benchmarkFileName = `${routeInfo.name}.${name}.bench.json`;
|
|
6059
|
+
const filePath = join9(controllersDir, benchmarkFileName);
|
|
6060
|
+
await Bun.write(filePath, `${jsonContent}
|
|
6061
|
+
`);
|
|
6062
|
+
const logger = new TerminalLogger8;
|
|
6063
|
+
logger.success(`${join9(controllersLocalDir, benchmarkFileName)} created successfully`, undefined, {
|
|
6064
|
+
showTimestamp: false,
|
|
6065
|
+
showArrow: false,
|
|
6066
|
+
useSymbol: true
|
|
6067
|
+
});
|
|
6068
|
+
}
|
|
6069
|
+
}
|
|
6070
|
+
MakeBenchmarkCommand = __legacyDecorateClassTS([
|
|
6071
|
+
decorator9.command()
|
|
6072
|
+
], MakeBenchmarkCommand);
|
|
6073
|
+
// src/commands/MakeAnalyticsCommand.ts
|
|
6074
|
+
import { join as join10 } from "path";
|
|
6075
|
+
import { decorator as decorator10 } from "@ooneex/command";
|
|
6076
|
+
import { TerminalLogger as TerminalLogger9 } from "@ooneex/logger";
|
|
5907
6077
|
import { toPascalCase as toPascalCase3 } from "@ooneex/utils";
|
|
5908
6078
|
|
|
5909
6079
|
// src/templates/analytics.test.txt
|
|
5910
6080
|
var analytics_test_default = `import { describe, expect, test } from "bun:test";
|
|
5911
|
-
import { {{NAME}}Analytics } from "
|
|
6081
|
+
import { {{NAME}}Analytics } from "@module/{{MODULE}}/analytics/{{NAME}}Analytics";
|
|
5912
6082
|
|
|
5913
6083
|
describe("{{NAME}}Analytics", () => {
|
|
5914
6084
|
test("should have class name ending with 'Analytics'", () => {
|
|
@@ -5954,28 +6124,28 @@ class MakeAnalyticsCommand {
|
|
|
5954
6124
|
if (module) {
|
|
5955
6125
|
await ensureModule(module);
|
|
5956
6126
|
}
|
|
5957
|
-
const base = module ?
|
|
5958
|
-
const analyticsLocalDir =
|
|
5959
|
-
const analyticsDir =
|
|
5960
|
-
const filePath =
|
|
6127
|
+
const base = module ? join10("modules", module) : ".";
|
|
6128
|
+
const analyticsLocalDir = join10(base, "src", "analytics");
|
|
6129
|
+
const analyticsDir = join10(process.cwd(), analyticsLocalDir);
|
|
6130
|
+
const filePath = join10(analyticsDir, `${name}Analytics.ts`);
|
|
5961
6131
|
await Bun.write(filePath, content);
|
|
5962
|
-
const testContent = analytics_test_default.replace(/{{NAME}}/g, name);
|
|
5963
|
-
const testsLocalDir =
|
|
5964
|
-
const testsDir =
|
|
5965
|
-
const testFilePath =
|
|
6132
|
+
const testContent = analytics_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
6133
|
+
const testsLocalDir = join10(base, "tests", "analytics");
|
|
6134
|
+
const testsDir = join10(process.cwd(), testsLocalDir);
|
|
6135
|
+
const testFilePath = join10(testsDir, `${name}Analytics.spec.ts`);
|
|
5966
6136
|
await Bun.write(testFilePath, testContent);
|
|
5967
|
-
const logger = new
|
|
5968
|
-
logger.success(`${
|
|
6137
|
+
const logger = new TerminalLogger9;
|
|
6138
|
+
logger.success(`${join10(analyticsLocalDir, name)}Analytics.ts created successfully`, undefined, {
|
|
5969
6139
|
showTimestamp: false,
|
|
5970
6140
|
showArrow: false,
|
|
5971
6141
|
useSymbol: true
|
|
5972
6142
|
});
|
|
5973
|
-
logger.success(`${
|
|
6143
|
+
logger.success(`${join10(testsLocalDir, name)}Analytics.spec.ts created successfully`, undefined, {
|
|
5974
6144
|
showTimestamp: false,
|
|
5975
6145
|
showArrow: false,
|
|
5976
6146
|
useSymbol: true
|
|
5977
6147
|
});
|
|
5978
|
-
const packageJsonPath =
|
|
6148
|
+
const packageJsonPath = join10(process.cwd(), "package.json");
|
|
5979
6149
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
5980
6150
|
const deps = packageJson.dependencies ?? {};
|
|
5981
6151
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -5990,12 +6160,12 @@ class MakeAnalyticsCommand {
|
|
|
5990
6160
|
}
|
|
5991
6161
|
}
|
|
5992
6162
|
MakeAnalyticsCommand = __legacyDecorateClassTS([
|
|
5993
|
-
|
|
6163
|
+
decorator10.command()
|
|
5994
6164
|
], MakeAnalyticsCommand);
|
|
5995
6165
|
// src/commands/MakeAppCommand.ts
|
|
5996
|
-
import { join as
|
|
5997
|
-
import { decorator as
|
|
5998
|
-
import { TerminalLogger as
|
|
6166
|
+
import { join as join11 } from "path";
|
|
6167
|
+
import { decorator as decorator11 } from "@ooneex/command";
|
|
6168
|
+
import { TerminalLogger as TerminalLogger10 } from "@ooneex/logger";
|
|
5999
6169
|
import { toKebabCase as toKebabCase2, toSnakeCase } from "@ooneex/utils";
|
|
6000
6170
|
|
|
6001
6171
|
// src/prompts/askDestination.ts
|
|
@@ -6316,11 +6486,11 @@ var/
|
|
|
6316
6486
|
`;
|
|
6317
6487
|
|
|
6318
6488
|
// src/templates/app/app-database.txt
|
|
6319
|
-
var app_database_default = `import {
|
|
6489
|
+
var app_database_default = `import { SharedModule } from "@module/shared/SharedModule";
|
|
6320
6490
|
import { AppEnv } from "@ooneex/app-env";
|
|
6491
|
+
import { inject } from "@ooneex/container";
|
|
6492
|
+
import { DatabaseException, decorator, TypeormDatabase } from "@ooneex/database";
|
|
6321
6493
|
import { DataSource } from "typeorm";
|
|
6322
|
-
import { TypeormDatabase, DatabaseException, decorator } from "@ooneex/database";
|
|
6323
|
-
import { SharedModule } from "@module/shared/SharedModule";
|
|
6324
6494
|
|
|
6325
6495
|
@decorator.database()
|
|
6326
6496
|
export class SharedDatabase extends TypeormDatabase {
|
|
@@ -6329,6 +6499,10 @@ export class SharedDatabase extends TypeormDatabase {
|
|
|
6329
6499
|
}
|
|
6330
6500
|
|
|
6331
6501
|
public getSource(): DataSource {
|
|
6502
|
+
if (this.source) {
|
|
6503
|
+
return this.source;
|
|
6504
|
+
}
|
|
6505
|
+
|
|
6332
6506
|
const url = this.env.DATABASE_URL;
|
|
6333
6507
|
|
|
6334
6508
|
if (!url) {
|
|
@@ -6339,13 +6513,21 @@ export class SharedDatabase extends TypeormDatabase {
|
|
|
6339
6513
|
}
|
|
6340
6514
|
|
|
6341
6515
|
this.source = new DataSource({
|
|
6516
|
+
type: "postgres",
|
|
6517
|
+
url,
|
|
6342
6518
|
synchronize: false,
|
|
6343
6519
|
entities: SharedModule.entities,
|
|
6520
|
+
poolSize: 10,
|
|
6344
6521
|
extra: {
|
|
6345
6522
|
max: 10,
|
|
6523
|
+
min: 2,
|
|
6524
|
+
idleTimeoutMillis: 30_000,
|
|
6525
|
+
connectionTimeoutMillis: 5_000,
|
|
6526
|
+
allowExitOnIdle: false,
|
|
6527
|
+
maxLifetimeSeconds: 1_800,
|
|
6346
6528
|
},
|
|
6347
|
-
|
|
6348
|
-
|
|
6529
|
+
logging: ["error", "warn", "migration"],
|
|
6530
|
+
maxQueryExecutionTime: 1_000,
|
|
6349
6531
|
});
|
|
6350
6532
|
|
|
6351
6533
|
return this.source;
|
|
@@ -6702,6 +6884,8 @@ POLAR_ENVIRONMENT=
|
|
|
6702
6884
|
# Authentication
|
|
6703
6885
|
# =============================================================================
|
|
6704
6886
|
|
|
6887
|
+
# Authentication token for API access
|
|
6888
|
+
AUTH_TOKEN=
|
|
6705
6889
|
# Clerk authentication secret key
|
|
6706
6890
|
CLERK_SECRET_KEY=
|
|
6707
6891
|
|
|
@@ -7134,40 +7318,40 @@ class MakeAppCommand {
|
|
|
7134
7318
|
destination = await askDestination({ message: "Enter destination path", initial: kebabName });
|
|
7135
7319
|
}
|
|
7136
7320
|
const packageContent = package_json_default.replace(/{{NAME}}/g, kebabName);
|
|
7137
|
-
await Bun.write(
|
|
7138
|
-
await Bun.write(
|
|
7139
|
-
await Bun.write(
|
|
7140
|
-
await Bun.write(
|
|
7141
|
-
await Bun.write(
|
|
7142
|
-
await Bun.write(
|
|
7143
|
-
await Bun.write(
|
|
7144
|
-
await Bun.write(
|
|
7145
|
-
await Bun.write(
|
|
7321
|
+
await Bun.write(join11(destination, ".commitlintrc.ts"), _commitlintrc_ts_default);
|
|
7322
|
+
await Bun.write(join11(destination, ".gitignore"), _gitignore_default);
|
|
7323
|
+
await Bun.write(join11(destination, "biome.jsonc"), biome_jsonc_default);
|
|
7324
|
+
await Bun.write(join11(destination, "bunfig.toml"), bunfig_toml_default);
|
|
7325
|
+
await Bun.write(join11(destination, "nx.json"), nx_json_default);
|
|
7326
|
+
await Bun.write(join11(destination, "package.json"), packageContent);
|
|
7327
|
+
await Bun.write(join11(destination, "README.md"), README_md_default.replace(/{{NAME}}/g, kebabName));
|
|
7328
|
+
await Bun.write(join11(destination, "tsconfig.json"), tsconfig_json_default);
|
|
7329
|
+
await Bun.write(join11(destination, ".zed", "settings.json"), zed_settings_json_default);
|
|
7146
7330
|
const makeModuleCommand = new MakeModuleCommand;
|
|
7147
7331
|
await makeModuleCommand.run({
|
|
7148
7332
|
name: "app",
|
|
7149
7333
|
cwd: destination,
|
|
7150
7334
|
silent: true
|
|
7151
7335
|
});
|
|
7152
|
-
const appModulePackagePath =
|
|
7336
|
+
const appModulePackagePath = join11(destination, "modules", "app", "package.json");
|
|
7153
7337
|
const appModulePackageJson = await Bun.file(appModulePackagePath).json();
|
|
7154
7338
|
await Bun.write(appModulePackagePath, JSON.stringify(appModulePackageJson, null, 2));
|
|
7155
7339
|
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"');
|
|
7156
|
-
await Bun.write(
|
|
7157
|
-
await Bun.write(
|
|
7158
|
-
await Bun.write(
|
|
7340
|
+
await Bun.write(join11(destination, "modules", "app", ".env"), envContent);
|
|
7341
|
+
await Bun.write(join11(destination, "modules", "app", ".env.example"), env_default);
|
|
7342
|
+
await Bun.write(join11(destination, "modules", "app", "src", "index.ts"), index_ts_default);
|
|
7159
7343
|
await makeModuleCommand.run({
|
|
7160
7344
|
name: "shared",
|
|
7161
7345
|
cwd: destination,
|
|
7162
7346
|
silent: true
|
|
7163
7347
|
});
|
|
7164
|
-
await Bun.write(
|
|
7348
|
+
await Bun.write(join11(destination, "modules", "shared", "src", "databases", "SharedDatabase.ts"), app_database_default);
|
|
7165
7349
|
const snakeName = toSnakeCase(name);
|
|
7166
7350
|
const dockerComposeContent = docker_compose_yml_default.replace(/{{NAME}}/g, snakeName);
|
|
7167
|
-
await Bun.write(
|
|
7351
|
+
await Bun.write(join11(destination, "modules", "app", "docker-compose.yml"), dockerComposeContent);
|
|
7168
7352
|
const dockerfileContent = Dockerfile_default.replace(/{{NAME}}/g, snakeName);
|
|
7169
|
-
await Bun.write(
|
|
7170
|
-
await Bun.write(
|
|
7353
|
+
await Bun.write(join11(destination, "modules", "app", "Dockerfile"), dockerfileContent);
|
|
7354
|
+
await Bun.write(join11(destination, "modules", "app", "var", ".gitkeep"), "");
|
|
7171
7355
|
const gitInit = Bun.spawn(["git", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
7172
7356
|
await gitInit.exited;
|
|
7173
7357
|
const addDeps = Bun.spawn([
|
|
@@ -7229,9 +7413,9 @@ class MakeAppCommand {
|
|
|
7229
7413
|
await addDevDeps.exited;
|
|
7230
7414
|
const huskyInit = Bun.spawn(["bunx", "husky", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
7231
7415
|
await huskyInit.exited;
|
|
7232
|
-
await Bun.write(
|
|
7233
|
-
await Bun.write(
|
|
7234
|
-
const logger = new
|
|
7416
|
+
await Bun.write(join11(destination, ".husky", "pre-commit"), "lint-staged");
|
|
7417
|
+
await Bun.write(join11(destination, ".husky", "commit-msg"), `bunx commitlint --edit "$1"`);
|
|
7418
|
+
const logger = new TerminalLogger10;
|
|
7235
7419
|
logger.success(`${kebabName} created successfully at ${destination}`, undefined, {
|
|
7236
7420
|
showTimestamp: false,
|
|
7237
7421
|
showArrow: false,
|
|
@@ -7240,17 +7424,17 @@ class MakeAppCommand {
|
|
|
7240
7424
|
}
|
|
7241
7425
|
}
|
|
7242
7426
|
MakeAppCommand = __legacyDecorateClassTS([
|
|
7243
|
-
|
|
7427
|
+
decorator11.command()
|
|
7244
7428
|
], MakeAppCommand);
|
|
7245
7429
|
// src/commands/MakeCacheCommand.ts
|
|
7246
|
-
import { join as
|
|
7247
|
-
import { decorator as
|
|
7248
|
-
import { TerminalLogger as
|
|
7430
|
+
import { join as join12 } from "path";
|
|
7431
|
+
import { decorator as decorator12 } from "@ooneex/command";
|
|
7432
|
+
import { TerminalLogger as TerminalLogger11 } from "@ooneex/logger";
|
|
7249
7433
|
import { toPascalCase as toPascalCase4 } from "@ooneex/utils";
|
|
7250
7434
|
|
|
7251
7435
|
// src/templates/cache.test.txt
|
|
7252
7436
|
var cache_test_default = `import { describe, expect, test } from "bun:test";
|
|
7253
|
-
import { {{NAME}}Cache } from "
|
|
7437
|
+
import { {{NAME}}Cache } from "@module/{{MODULE}}/cache/{{NAME}}Cache";
|
|
7254
7438
|
|
|
7255
7439
|
describe("{{NAME}}Cache", () => {
|
|
7256
7440
|
test("should have class name ending with 'Cache'", () => {
|
|
@@ -7321,28 +7505,28 @@ class MakeCacheCommand {
|
|
|
7321
7505
|
if (module) {
|
|
7322
7506
|
await ensureModule(module);
|
|
7323
7507
|
}
|
|
7324
|
-
const base = module ?
|
|
7325
|
-
const cacheLocalDir =
|
|
7326
|
-
const cacheDir =
|
|
7327
|
-
const filePath =
|
|
7508
|
+
const base = module ? join12("modules", module) : ".";
|
|
7509
|
+
const cacheLocalDir = join12(base, "src", "cache");
|
|
7510
|
+
const cacheDir = join12(process.cwd(), cacheLocalDir);
|
|
7511
|
+
const filePath = join12(cacheDir, `${name}Cache.ts`);
|
|
7328
7512
|
await Bun.write(filePath, content);
|
|
7329
|
-
const testContent = cache_test_default.replace(/{{NAME}}/g, name);
|
|
7330
|
-
const testsLocalDir =
|
|
7331
|
-
const testsDir =
|
|
7332
|
-
const testFilePath =
|
|
7513
|
+
const testContent = cache_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
7514
|
+
const testsLocalDir = join12(base, "tests", "cache");
|
|
7515
|
+
const testsDir = join12(process.cwd(), testsLocalDir);
|
|
7516
|
+
const testFilePath = join12(testsDir, `${name}Cache.spec.ts`);
|
|
7333
7517
|
await Bun.write(testFilePath, testContent);
|
|
7334
|
-
const logger = new
|
|
7335
|
-
logger.success(`${
|
|
7518
|
+
const logger = new TerminalLogger11;
|
|
7519
|
+
logger.success(`${join12(cacheLocalDir, name)}Cache.ts created successfully`, undefined, {
|
|
7336
7520
|
showTimestamp: false,
|
|
7337
7521
|
showArrow: false,
|
|
7338
7522
|
useSymbol: true
|
|
7339
7523
|
});
|
|
7340
|
-
logger.success(`${
|
|
7524
|
+
logger.success(`${join12(testsLocalDir, name)}Cache.spec.ts created successfully`, undefined, {
|
|
7341
7525
|
showTimestamp: false,
|
|
7342
7526
|
showArrow: false,
|
|
7343
7527
|
useSymbol: true
|
|
7344
7528
|
});
|
|
7345
|
-
const packageJsonPath =
|
|
7529
|
+
const packageJsonPath = join12(process.cwd(), "package.json");
|
|
7346
7530
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
7347
7531
|
const deps = packageJson.dependencies ?? {};
|
|
7348
7532
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -7357,12 +7541,12 @@ class MakeCacheCommand {
|
|
|
7357
7541
|
}
|
|
7358
7542
|
}
|
|
7359
7543
|
MakeCacheCommand = __legacyDecorateClassTS([
|
|
7360
|
-
|
|
7544
|
+
decorator12.command()
|
|
7361
7545
|
], MakeCacheCommand);
|
|
7362
7546
|
// src/commands/MakeClaudeSkillCommand.ts
|
|
7363
|
-
import { join as
|
|
7364
|
-
import { decorator as
|
|
7365
|
-
import { TerminalLogger as
|
|
7547
|
+
import { join as join13 } from "path";
|
|
7548
|
+
import { decorator as decorator13 } from "@ooneex/command";
|
|
7549
|
+
import { TerminalLogger as TerminalLogger12 } from "@ooneex/logger";
|
|
7366
7550
|
|
|
7367
7551
|
// src/templates/claude/skills/commit.md.txt
|
|
7368
7552
|
var commit_md_default = `---
|
|
@@ -7598,7 +7782,7 @@ var make_middleware_md_default = '---\nname: make:middleware\ndescription: Gener
|
|
|
7598
7782
|
var make_migration_md_default = '---\nname: make:migration\ndescription: Generate a new database migration file with its test file, then complete the generated code. Use when creating a new database migration for schema changes using @ooneex/migrations.\n---\n\n# Make Migration\n\nGenerate a new migration file and its test file using the `make:migration` CLI command, then complete the generated code with proper implementation.\n\n## Coding Conventions\n\n- Always explicitly show visibility on class methods and properties (`private`, `public`, `protected`)\n- Always use arrow functions when possible, but NOT for class methods (class methods use regular method syntax)\n- End type names with the `Type` suffix (e.g., `ExceptionStackFrameType`, `ServiceDataType`)\n- Start interface names with the `I` prefix (e.g., `IException`, `IService`, `IAiChat`)\n- For Entity class, if property is optional, add `null` to its type.\n- For dependencies, use `inject` from `@ooneex/container`. For example:\n\n```typescript\nimport { inject } from "@ooneex/container";\nimport { decorator, type ISeed } from "@ooneex/seeds";\n\n@decorator.seed()\nexport class BookSeed implements ISeed {\n constructor(\n @inject(BookRepository)\n private readonly repository: BookRepository,\n ) {}\n}\n```\n\n## Important\n\nAll commands must be run from the root of the project (not from within a package or module directory).\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the migration file and test files:\n\n```bash\nbunx @ooneex/cli@latest make:migration --module=<module>\n```\n\nThe `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/migrations/Migration<version>.ts` - The migration class file (or `modules/<module>/src/migrations/Migration<version>.ts` with `--module`)\n- `tests/migrations/Migration<version>.spec.ts` - The test file (or `modules/<module>/tests/migrations/Migration<version>.spec.ts` with `--module`)\n\nIt will also:\n- Generate a `migrations.ts` root export file in the migrations directory\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the migration\n\nEdit `src/migrations/Migration<version>.ts` to implement:\n\n- The `up` method with the schema changes (create tables, add columns, create indexes, etc.)\n- The `down` method with the reverse operations to undo the migration\n\n### 4. Complete the test file\n\nEdit `tests/migrations/Migration<version>.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, up, down, getVersion, getDependencies methods)\n- Add tests relevant to the specific migration behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from "bun:test";\nimport { Migration<version> } from "@/migrations/Migration<version>";\n\ndescribe("Migration<version>", () => {\n test("should have class name starting with \'Migration\'", () => {\n expect(Migration<version>.name.startsWith("Migration")).toBe(true);\n });\n\n test("should have \'up\' method", () => {\n expect(Migration<version>.prototype.up).toBeDefined();\n expect(typeof Migration<version>.prototype.up).toBe("function");\n });\n\n test("should have \'down\' method", () => {\n expect(Migration<version>.prototype.down).toBeDefined();\n expect(typeof Migration<version>.prototype.down).toBe("function");\n });\n\n test("should have \'getVersion\' method", () => {\n expect(Migration<version>.prototype.getVersion).toBeDefined();\n expect(typeof Migration<version>.prototype.getVersion).toBe("function");\n });\n\n test("should have \'getDependencies\' method", () => {\n expect(Migration<version>.prototype.getDependencies).toBeDefined();\n expect(typeof Migration<version>.prototype.getDependencies).toBe("function");\n });\n});\n```\n\n### 5. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/migrations/Migration<version>.ts tests/migrations/Migration<version>.spec.ts\n```\n';
|
|
7599
7783
|
|
|
7600
7784
|
// src/templates/claude/skills/make.permission.md.txt
|
|
7601
|
-
var make_permission_md_default = '---\nname: make:permission\ndescription: Generate a new permission class with its test file, then complete the generated code. Use when creating a new permission that extends Permission from @ooneex/permission.\n---\n\n# Make Permission Class\n\nGenerate a new permission class and its test file using the `make:permission` CLI command, then complete the generated code with proper implementation.\n\n## Coding Conventions\n\n- Always explicitly show visibility on class methods and properties (`private`, `public`, `protected`)\n- Always use arrow functions when possible, but NOT for class methods (class methods use regular method syntax)\n- End type names with the `Type` suffix (e.g., `ExceptionStackFrameType`, `ServiceDataType`)\n- Start interface names with the `I` prefix (e.g., `IException`, `IService`, `IAiChat`)\n- For Entity class, if property is optional, add `null` to its type.\n- For dependencies, use `inject` from `@ooneex/container`. For example:\n\n```typescript\nimport { inject } from "@ooneex/container";\nimport { decorator, type ISeed } from "@ooneex/seeds";\n\n@decorator.seed()\nexport class BookSeed implements ISeed {\n constructor(\n @inject(BookRepository)\n private readonly repository: BookRepository,\n ) {}\n}\n```\n\n## Important\n\nAll commands must be run from the root of the project (not from within a package or module directory).\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the permission class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:permission --name=<name> --module=<module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/permissions/<Name>Permission.ts` - The permission class file (or `modules/<module>/src/permissions/<Name>Permission.ts` with `--module`)\n- `tests/permissions/<Name>Permission.spec.ts` - The test file (or `modules/<module>/tests/permissions/<Name>Permission.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the permission class\n\nEdit `src/permissions/<Name>Permission.ts` to complete the implementation:\n\n- Implement the `allow()` method with permission rules using `this.ability.can()`\n- Implement the `setUserPermissions()` method with role-based permission logic\n- Define which actions (read, create, update, delete, manage) are allowed on which entities\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport {
|
|
7785
|
+
var make_permission_md_default = '---\nname: make:permission\ndescription: Generate a new permission class with its test file, then complete the generated code. Use when creating a new permission that extends Permission from @ooneex/permission.\n---\n\n# Make Permission Class\n\nGenerate a new permission class and its test file using the `make:permission` CLI command, then complete the generated code with proper implementation.\n\n## Coding Conventions\n\n- Always explicitly show visibility on class methods and properties (`private`, `public`, `protected`)\n- Always use arrow functions when possible, but NOT for class methods (class methods use regular method syntax)\n- End type names with the `Type` suffix (e.g., `ExceptionStackFrameType`, `ServiceDataType`)\n- Start interface names with the `I` prefix (e.g., `IException`, `IService`, `IAiChat`)\n- For Entity class, if property is optional, add `null` to its type.\n- For dependencies, use `inject` from `@ooneex/container`. For example:\n\n```typescript\nimport { inject } from "@ooneex/container";\nimport { decorator, type ISeed } from "@ooneex/seeds";\n\n@decorator.seed()\nexport class BookSeed implements ISeed {\n constructor(\n @inject(BookRepository)\n private readonly repository: BookRepository,\n ) {}\n}\n```\n\n## Important\n\nAll commands must be run from the root of the project (not from within a package or module directory).\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the permission class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:permission --name=<name> --module=<module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/permissions/<Name>Permission.ts` - The permission class file (or `modules/<module>/src/permissions/<Name>Permission.ts` with `--module`)\n- `tests/permissions/<Name>Permission.spec.ts` - The test file (or `modules/<module>/tests/permissions/<Name>Permission.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the permission class\n\nEdit `src/permissions/<Name>Permission.ts` to complete the implementation:\n\n- Implement the `allow()` method with permission rules using `this.ability.can()`\n- Implement the `setUserPermissions()` method with role-based permission logic\n- Define which actions (read, create, update, delete, manage) are allowed on which entities\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport type { ContextType } from "@ooneex/controller";\nimport { decorator, Permission } from "@ooneex/permission";\n\n@decorator.permission()\nexport class <Name>Permission extends Permission {\n public allow(): this {\n // Example: Add permissions using this.ability.can()\n // this.ability.can("read", "YourEntity");\n // this.ability.can(["read", "update"], "YourEntity", { userId: user.id });\n\n return this;\n }\n\n public setUserPermissions(context: ContextType): this {\n // Example: Grant full access to admins\n // const { user } = context;\n //\n // if (!user) {\n // return this;\n // }\n //\n // const { roles } = user;\n // if (roles.includes(ERole.ADMIN)) {\n // this.ability.can("manage", "all");\n // return this;\n // }\n\n // Example: Grant specific permissions based on roles\n // const { user } = context;\n //\n // if (user) {\n // for (const role of user.roles) {\n // if (role === ERole.USER) {\n // this.ability.can(["read", "update"], "YourEntity", { userId: user.id });\n // }\n //\n // if (role === ERole.GUEST) {\n // this.ability.can("read", "YourEntity", { public: true });\n // }\n // }\n // }\n\n return this;\n }\n\n public check(context: ContextType): boolean {\n return true;\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/permissions/<Name>Permission.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, extends Permission, allow, setUserPermissions methods)\n- Add tests relevant to the specific permission rules\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from "bun:test";\nimport { Permission } from "@ooneex/permission";\nimport { <Name>Permission } from "@/permissions/<Name>Permission";\n\ndescribe("<Name>Permission", () => {\n test("should have class name ending with \'Permission\'", () => {\n expect(<Name>Permission.name.endsWith("Permission")).toBe(true);\n });\n\n test("should extend Permission", () => {\n const permission = new <Name>Permission();\n expect(permission).toBeInstanceOf(Permission);\n });\n\n test("should have \'allow\' method", () => {\n expect(<Name>Permission.prototype.allow).toBeDefined();\n expect(typeof <Name>Permission.prototype.allow).toBe("function");\n });\n\n test("should have \'setUserPermissions\' method", () => {\n expect(<Name>Permission.prototype.setUserPermissions).toBeDefined();\n expect(typeof <Name>Permission.prototype.setUserPermissions).toBe("function");\n });\n});\n```\n\n### 5. Register the permission in the module\n\nThe permission class is standalone and does not need to be registered in a module.\n\n### 6. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/permissions/<Name>Permission.ts tests/permissions/<Name>Permission.spec.ts\n```\n';
|
|
7602
7786
|
|
|
7603
7787
|
// src/templates/claude/skills/make.pubsub.md.txt
|
|
7604
7788
|
var make_pubsub_md_default = '---\nname: make:pubsub\ndescription: Generate a new PubSub event class with its test file, then complete the generated code. Use when creating a new publish/subscribe event that extends PubSub from @ooneex/pub-sub.\n---\n\n# Make PubSub Event Class\n\nGenerate a new PubSub event class and its test file using the `make:pubsub` CLI command, then complete the generated code with proper implementation.\n\n## Coding Conventions\n\n- Always explicitly show visibility on class methods and properties (`private`, `public`, `protected`)\n- Always use arrow functions when possible, but NOT for class methods (class methods use regular method syntax)\n- End type names with the `Type` suffix (e.g., `ExceptionStackFrameType`, `ServiceDataType`)\n- Start interface names with the `I` prefix (e.g., `IException`, `IService`, `IAiChat`)\n- For Entity class, if property is optional, add `null` to its type.\n- For dependencies, use `inject` from `@ooneex/container`. For example:\n\n```typescript\nimport { inject } from "@ooneex/container";\nimport { decorator, type ISeed } from "@ooneex/seeds";\n\n@decorator.seed()\nexport class BookSeed implements ISeed {\n constructor(\n @inject(BookRepository)\n private readonly repository: BookRepository,\n ) {}\n}\n```\n\n## Important\n\nAll commands must be run from the root of the project (not from within a package or module directory).\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the PubSub event class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:pubsub --name=<name> --module=<module> --channel=<channel>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The `--channel` option is optional \u2014 if omitted, it defaults to the kebab-case form of the name (e.g., `UserCreated` becomes `user-created`). The command will generate:\n- `src/events/<Name>Event.ts` - The event class file (or `modules/<module>/src/events/<Name>Event.ts` with `--module`)\n- `tests/events/<Name>Event.spec.ts` - The test file (or `modules/<module>/tests/events/<Name>Event.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the PubSub event class\n\nEdit `src/events/<Name>Event.ts` to complete the implementation:\n\n- Define a proper data type instead of `Record<string, ScalarType>` for the event payload\n- Implement the `handler()` method with actual event handling logic\n- Set the appropriate channel name in `getChannel()`\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { inject } from "@ooneex/container";\nimport type { ScalarType } from "@ooneex/types";\nimport { decorator, PubSub, RedisPubSub } from "@ooneex/pub-sub";\n\n@decorator.pubSub()\nexport class <Name>Event<Data extends Record<string, ScalarType> = Record<string, ScalarType>> extends PubSub<Data> {\n constructor(\n @inject(RedisPubSub)\n client: RedisPubSub<Data>,\n ) {\n super(client);\n }\n\n public getChannel(): string {\n return "<channel>";\n }\n\n public async handler(context: { data: Data; channel: string }): Promise<void> {\n console.log(context);\n // TODO: Implement handler logic here\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/events/<Name>Event.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, getChannel, handler, publish, subscribe, unsubscribe, unsubscribeAll methods)\n- Add tests relevant to the specific event behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from "bun:test";\nimport { <Name>PubSub } from "@/pubsub/<Name>PubSub";\n\ndescribe("<Name>PubSub", () => {\n test("should have class name ending with \'PubSub\'", () => {\n expect(<Name>PubSub.name.endsWith("PubSub")).toBe(true);\n });\n\n test("should have \'getChannel\' method", () => {\n expect(<Name>PubSub.prototype.getChannel).toBeDefined();\n expect(typeof <Name>PubSub.prototype.getChannel).toBe("function");\n });\n\n test("should have \'handler\' method", () => {\n expect(<Name>PubSub.prototype.handler).toBeDefined();\n expect(typeof <Name>PubSub.prototype.handler).toBe("function");\n });\n\n test("should have \'publish\' method", () => {\n expect(<Name>PubSub.prototype.publish).toBeDefined();\n expect(typeof <Name>PubSub.prototype.publish).toBe("function");\n });\n\n test("should have \'subscribe\' method", () => {\n expect(<Name>PubSub.prototype.subscribe).toBeDefined();\n expect(typeof <Name>PubSub.prototype.subscribe).toBe("function");\n });\n\n test("should have \'unsubscribe\' method", () => {\n expect(<Name>PubSub.prototype.unsubscribe).toBeDefined();\n expect(typeof <Name>PubSub.prototype.unsubscribe).toBe("function");\n });\n\n test("should have \'unsubscribeAll\' method", () => {\n expect(<Name>PubSub.prototype.unsubscribeAll).toBeDefined();\n expect(typeof <Name>PubSub.prototype.unsubscribeAll).toBe("function");\n });\n});\n```\n\n### 5. Register the event in the module\n\nAdd the new event to the module\'s `events` array in `src/<PascalModuleName>Module.ts` (e.g., `src/BookModule.ts` for the `book` module):\n\n```typescript\nimport type { ModuleType } from "@ooneex/module";\nimport { <Name>Event } from "./events/<Name>Event";\n\nexport const <PascalModuleName>Module: ModuleType = {\n controllers: [],\n entities: [],\n middlewares: [],\n cronJobs: [],\n events: [<Name>Event],\n};\n```\n\nThe module file uses PascalCase naming: `<PascalModuleName>Module.ts` with export `<PascalModuleName>Module`.\n\nIf the module already has other events registered, append the new event to the existing `events` array and add the import alongside existing imports.\n\n### 6. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/events/<Name>Event.ts tests/events/<Name>Event.spec.ts\n```\n';
|
|
@@ -7653,14 +7837,14 @@ class MakeClaudeSkillCommand {
|
|
|
7653
7837
|
return "Generate Claude skills from templates";
|
|
7654
7838
|
}
|
|
7655
7839
|
async run() {
|
|
7656
|
-
const skillsLocalDir =
|
|
7657
|
-
const skillsDir =
|
|
7658
|
-
const logger = new
|
|
7840
|
+
const skillsLocalDir = join13(".claude", "skills");
|
|
7841
|
+
const skillsDir = join13(process.cwd(), skillsLocalDir);
|
|
7842
|
+
const logger = new TerminalLogger12;
|
|
7659
7843
|
for (const [skillName, content] of Object.entries(skills)) {
|
|
7660
7844
|
const dirName = skillName.replace(/\./g, "-");
|
|
7661
|
-
const filePath =
|
|
7845
|
+
const filePath = join13(skillsDir, dirName, "SKILL.md");
|
|
7662
7846
|
await Bun.write(filePath, content);
|
|
7663
|
-
logger.success(`${
|
|
7847
|
+
logger.success(`${join13(skillsLocalDir, dirName, "SKILL.md")} created successfully`, undefined, {
|
|
7664
7848
|
showTimestamp: false,
|
|
7665
7849
|
showArrow: false,
|
|
7666
7850
|
useSymbol: true
|
|
@@ -7669,12 +7853,12 @@ class MakeClaudeSkillCommand {
|
|
|
7669
7853
|
}
|
|
7670
7854
|
}
|
|
7671
7855
|
MakeClaudeSkillCommand = __legacyDecorateClassTS([
|
|
7672
|
-
|
|
7856
|
+
decorator13.command()
|
|
7673
7857
|
], MakeClaudeSkillCommand);
|
|
7674
7858
|
// src/commands/MakeCommandCommand.ts
|
|
7675
|
-
import { join as
|
|
7676
|
-
import { commandCreate, decorator as
|
|
7677
|
-
import { TerminalLogger as
|
|
7859
|
+
import { join as join14 } from "path";
|
|
7860
|
+
import { commandCreate, decorator as decorator14 } from "@ooneex/command";
|
|
7861
|
+
import { TerminalLogger as TerminalLogger13 } from "@ooneex/logger";
|
|
7678
7862
|
|
|
7679
7863
|
// src/templates/module/command.run.txt
|
|
7680
7864
|
var command_run_default = `#!/usr/bin/env bun
|
|
@@ -7701,18 +7885,18 @@ class MakeCommandCommand {
|
|
|
7701
7885
|
if (module) {
|
|
7702
7886
|
await ensureModule(module);
|
|
7703
7887
|
}
|
|
7704
|
-
const base = module ?
|
|
7888
|
+
const base = module ? join14("modules", module) : ".";
|
|
7705
7889
|
const { commandPath: filePath, testPath } = await commandCreate({
|
|
7706
7890
|
name,
|
|
7707
|
-
commandDir:
|
|
7708
|
-
testsDir:
|
|
7891
|
+
commandDir: join14(base, "src", "commands"),
|
|
7892
|
+
testsDir: join14(base, "tests", "commands")
|
|
7709
7893
|
});
|
|
7710
|
-
const binCommandRunPath =
|
|
7894
|
+
const binCommandRunPath = join14(process.cwd(), base, "bin", "command", "run.ts");
|
|
7711
7895
|
const binCommandRunFile = Bun.file(binCommandRunPath);
|
|
7712
7896
|
if (!await binCommandRunFile.exists()) {
|
|
7713
7897
|
await Bun.write(binCommandRunPath, command_run_default.replace(/{{name}}/g, module ?? ""));
|
|
7714
7898
|
}
|
|
7715
|
-
const logger = new
|
|
7899
|
+
const logger = new TerminalLogger13;
|
|
7716
7900
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
7717
7901
|
showTimestamp: false,
|
|
7718
7902
|
showArrow: false,
|
|
@@ -7726,12 +7910,12 @@ class MakeCommandCommand {
|
|
|
7726
7910
|
}
|
|
7727
7911
|
}
|
|
7728
7912
|
MakeCommandCommand = __legacyDecorateClassTS([
|
|
7729
|
-
|
|
7913
|
+
decorator14.command()
|
|
7730
7914
|
], MakeCommandCommand);
|
|
7731
7915
|
// src/commands/MakeControllerCommand.ts
|
|
7732
|
-
import { basename, join as
|
|
7733
|
-
import { decorator as
|
|
7734
|
-
import { TerminalLogger as
|
|
7916
|
+
import { basename, join as join15 } from "path";
|
|
7917
|
+
import { decorator as decorator15 } from "@ooneex/command";
|
|
7918
|
+
import { TerminalLogger as TerminalLogger14 } from "@ooneex/logger";
|
|
7735
7919
|
import { toKebabCase as toKebabCase3, toPascalCase as toPascalCase5, trim } from "@ooneex/utils";
|
|
7736
7920
|
|
|
7737
7921
|
// src/prompts/askConfirm.ts
|
|
@@ -8030,7 +8214,7 @@ export class {{NAME}}Controller {
|
|
|
8030
8214
|
|
|
8031
8215
|
// src/templates/controller.test.txt
|
|
8032
8216
|
var controller_test_default = `import { describe, expect, test } from "bun:test";
|
|
8033
|
-
import { {{NAME}}Controller } from "
|
|
8217
|
+
import { {{NAME}}Controller } from "@module/{{MODULE}}/controllers/{{NAME}}Controller";
|
|
8034
8218
|
|
|
8035
8219
|
describe("{{NAME}}Controller", () => {
|
|
8036
8220
|
test("should have class name ending with 'Controller'", () => {
|
|
@@ -8151,33 +8335,33 @@ class MakeControllerCommand {
|
|
|
8151
8335
|
if (module) {
|
|
8152
8336
|
await ensureModule(module);
|
|
8153
8337
|
}
|
|
8154
|
-
const base = module ?
|
|
8155
|
-
const controllersLocalDir =
|
|
8156
|
-
const controllersDir =
|
|
8157
|
-
const filePath =
|
|
8338
|
+
const base = module ? join15("modules", module) : ".";
|
|
8339
|
+
const controllersLocalDir = join15(base, "src", "controllers");
|
|
8340
|
+
const controllersDir = join15(process.cwd(), controllersLocalDir);
|
|
8341
|
+
const filePath = join15(controllersDir, `${name}Controller.ts`);
|
|
8158
8342
|
await Bun.write(filePath, content);
|
|
8159
|
-
const testContent = controller_test_default.replace(/{{NAME}}/g, name);
|
|
8160
|
-
const testsLocalDir =
|
|
8161
|
-
const testsDir =
|
|
8162
|
-
const testFilePath =
|
|
8343
|
+
const testContent = controller_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
8344
|
+
const testsLocalDir = join15(base, "tests", "controllers");
|
|
8345
|
+
const testsDir = join15(process.cwd(), testsLocalDir);
|
|
8346
|
+
const testFilePath = join15(testsDir, `${name}Controller.spec.ts`);
|
|
8163
8347
|
await Bun.write(testFilePath, testContent);
|
|
8164
8348
|
const modulePascalName = module ? toPascalCase5(module) : toPascalCase5(basename(process.cwd()));
|
|
8165
|
-
const modulePath =
|
|
8349
|
+
const modulePath = join15(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
8166
8350
|
if (await Bun.file(modulePath).exists()) {
|
|
8167
8351
|
await this.addToModule(modulePath, name);
|
|
8168
8352
|
}
|
|
8169
|
-
const logger = new
|
|
8170
|
-
logger.success(`${
|
|
8353
|
+
const logger = new TerminalLogger14;
|
|
8354
|
+
logger.success(`${join15(controllersLocalDir, name)}Controller.ts created successfully`, undefined, {
|
|
8171
8355
|
showTimestamp: false,
|
|
8172
8356
|
showArrow: false,
|
|
8173
8357
|
useSymbol: true
|
|
8174
8358
|
});
|
|
8175
|
-
logger.success(`${
|
|
8359
|
+
logger.success(`${join15(testsLocalDir, name)}Controller.spec.ts created successfully`, undefined, {
|
|
8176
8360
|
showTimestamp: false,
|
|
8177
8361
|
showArrow: false,
|
|
8178
8362
|
useSymbol: true
|
|
8179
8363
|
});
|
|
8180
|
-
const packageJsonPath =
|
|
8364
|
+
const packageJsonPath = join15(process.cwd(), "package.json");
|
|
8181
8365
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8182
8366
|
const deps = packageJson.dependencies ?? {};
|
|
8183
8367
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8192,17 +8376,17 @@ class MakeControllerCommand {
|
|
|
8192
8376
|
}
|
|
8193
8377
|
}
|
|
8194
8378
|
MakeControllerCommand = __legacyDecorateClassTS([
|
|
8195
|
-
|
|
8379
|
+
decorator15.command()
|
|
8196
8380
|
], MakeControllerCommand);
|
|
8197
8381
|
// src/commands/MakeCronCommand.ts
|
|
8198
|
-
import { basename as basename2, join as
|
|
8199
|
-
import { decorator as
|
|
8200
|
-
import { TerminalLogger as
|
|
8382
|
+
import { basename as basename2, join as join16 } from "path";
|
|
8383
|
+
import { decorator as decorator16 } from "@ooneex/command";
|
|
8384
|
+
import { TerminalLogger as TerminalLogger15 } from "@ooneex/logger";
|
|
8201
8385
|
import { toPascalCase as toPascalCase6 } from "@ooneex/utils";
|
|
8202
8386
|
|
|
8203
8387
|
// src/templates/cron.test.txt
|
|
8204
8388
|
var cron_test_default = `import { describe, expect, test } from "bun:test";
|
|
8205
|
-
import { {{NAME}}Cron } from "
|
|
8389
|
+
import { {{NAME}}Cron } from "@module/{{MODULE}}/cron/{{NAME}}Cron";
|
|
8206
8390
|
|
|
8207
8391
|
describe("{{NAME}}Cron", () => {
|
|
8208
8392
|
test("should have class name ending with 'Cron'", () => {
|
|
@@ -8286,33 +8470,33 @@ class MakeCronCommand {
|
|
|
8286
8470
|
if (module) {
|
|
8287
8471
|
await ensureModule(module);
|
|
8288
8472
|
}
|
|
8289
|
-
const base = module ?
|
|
8290
|
-
const cronLocalDir =
|
|
8291
|
-
const cronDir =
|
|
8292
|
-
const filePath =
|
|
8473
|
+
const base = module ? join16("modules", module) : ".";
|
|
8474
|
+
const cronLocalDir = join16(base, "src", "crons");
|
|
8475
|
+
const cronDir = join16(process.cwd(), cronLocalDir);
|
|
8476
|
+
const filePath = join16(cronDir, `${name}Cron.ts`);
|
|
8293
8477
|
await Bun.write(filePath, content);
|
|
8294
|
-
const testContent = cron_test_default.replace(/{{NAME}}/g, name);
|
|
8295
|
-
const testsLocalDir =
|
|
8296
|
-
const testsDir =
|
|
8297
|
-
const testFilePath =
|
|
8478
|
+
const testContent = cron_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
8479
|
+
const testsLocalDir = join16(base, "tests", "crons");
|
|
8480
|
+
const testsDir = join16(process.cwd(), testsLocalDir);
|
|
8481
|
+
const testFilePath = join16(testsDir, `${name}Cron.spec.ts`);
|
|
8298
8482
|
await Bun.write(testFilePath, testContent);
|
|
8299
8483
|
const modulePascalName = module ? toPascalCase6(module) : toPascalCase6(basename2(process.cwd()));
|
|
8300
|
-
const modulePath =
|
|
8484
|
+
const modulePath = join16(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
8301
8485
|
if (await Bun.file(modulePath).exists()) {
|
|
8302
8486
|
await this.addToModule(modulePath, name);
|
|
8303
8487
|
}
|
|
8304
|
-
const logger = new
|
|
8305
|
-
logger.success(`${
|
|
8488
|
+
const logger = new TerminalLogger15;
|
|
8489
|
+
logger.success(`${join16(cronLocalDir, name)}Cron.ts created successfully`, undefined, {
|
|
8306
8490
|
showTimestamp: false,
|
|
8307
8491
|
showArrow: false,
|
|
8308
8492
|
useSymbol: true
|
|
8309
8493
|
});
|
|
8310
|
-
logger.success(`${
|
|
8494
|
+
logger.success(`${join16(testsLocalDir, name)}Cron.spec.ts created successfully`, undefined, {
|
|
8311
8495
|
showTimestamp: false,
|
|
8312
8496
|
showArrow: false,
|
|
8313
8497
|
useSymbol: true
|
|
8314
8498
|
});
|
|
8315
|
-
const packageJsonPath =
|
|
8499
|
+
const packageJsonPath = join16(process.cwd(), "package.json");
|
|
8316
8500
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8317
8501
|
const deps = packageJson.dependencies ?? {};
|
|
8318
8502
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8327,17 +8511,17 @@ class MakeCronCommand {
|
|
|
8327
8511
|
}
|
|
8328
8512
|
}
|
|
8329
8513
|
MakeCronCommand = __legacyDecorateClassTS([
|
|
8330
|
-
|
|
8514
|
+
decorator16.command()
|
|
8331
8515
|
], MakeCronCommand);
|
|
8332
8516
|
// src/commands/MakeDatabaseCommand.ts
|
|
8333
|
-
import { join as
|
|
8334
|
-
import { decorator as
|
|
8335
|
-
import { TerminalLogger as
|
|
8517
|
+
import { join as join17 } from "path";
|
|
8518
|
+
import { decorator as decorator17 } from "@ooneex/command";
|
|
8519
|
+
import { TerminalLogger as TerminalLogger16 } from "@ooneex/logger";
|
|
8336
8520
|
import { toPascalCase as toPascalCase7 } from "@ooneex/utils";
|
|
8337
8521
|
|
|
8338
8522
|
// src/templates/database.test.txt
|
|
8339
8523
|
var database_test_default = `import { describe, expect, test } from "bun:test";
|
|
8340
|
-
import { {{NAME}}Database } from "
|
|
8524
|
+
import { {{NAME}}Database } from "@module/{{MODULE}}/databases/{{NAME}}Database";
|
|
8341
8525
|
|
|
8342
8526
|
describe("{{NAME}}Database", () => {
|
|
8343
8527
|
test("should have class name ending with 'Database'", () => {
|
|
@@ -8395,28 +8579,28 @@ class MakeDatabaseCommand {
|
|
|
8395
8579
|
if (module) {
|
|
8396
8580
|
await ensureModule(module);
|
|
8397
8581
|
}
|
|
8398
|
-
const base = module ?
|
|
8399
|
-
const databaseLocalDir =
|
|
8400
|
-
const databaseDir =
|
|
8401
|
-
const filePath =
|
|
8582
|
+
const base = module ? join17("modules", module) : ".";
|
|
8583
|
+
const databaseLocalDir = join17(base, "src", "databases");
|
|
8584
|
+
const databaseDir = join17(process.cwd(), databaseLocalDir);
|
|
8585
|
+
const filePath = join17(databaseDir, `${name}Database.ts`);
|
|
8402
8586
|
await Bun.write(filePath, content);
|
|
8403
|
-
const testContent = database_test_default.replace(/{{NAME}}/g, name);
|
|
8404
|
-
const testsLocalDir =
|
|
8405
|
-
const testsDir =
|
|
8406
|
-
const testFilePath =
|
|
8587
|
+
const testContent = database_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
8588
|
+
const testsLocalDir = join17(base, "tests", "databases");
|
|
8589
|
+
const testsDir = join17(process.cwd(), testsLocalDir);
|
|
8590
|
+
const testFilePath = join17(testsDir, `${name}Database.spec.ts`);
|
|
8407
8591
|
await Bun.write(testFilePath, testContent);
|
|
8408
|
-
const logger = new
|
|
8409
|
-
logger.success(`${
|
|
8592
|
+
const logger = new TerminalLogger16;
|
|
8593
|
+
logger.success(`${join17(databaseLocalDir, name)}Database.ts created successfully`, undefined, {
|
|
8410
8594
|
showTimestamp: false,
|
|
8411
8595
|
showArrow: false,
|
|
8412
8596
|
useSymbol: true
|
|
8413
8597
|
});
|
|
8414
|
-
logger.success(`${
|
|
8598
|
+
logger.success(`${join17(testsLocalDir, name)}Database.spec.ts created successfully`, undefined, {
|
|
8415
8599
|
showTimestamp: false,
|
|
8416
8600
|
showArrow: false,
|
|
8417
8601
|
useSymbol: true
|
|
8418
8602
|
});
|
|
8419
|
-
const packageJsonPath =
|
|
8603
|
+
const packageJsonPath = join17(process.cwd(), "package.json");
|
|
8420
8604
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8421
8605
|
const deps = packageJson.dependencies ?? {};
|
|
8422
8606
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8431,12 +8615,12 @@ class MakeDatabaseCommand {
|
|
|
8431
8615
|
}
|
|
8432
8616
|
}
|
|
8433
8617
|
MakeDatabaseCommand = __legacyDecorateClassTS([
|
|
8434
|
-
|
|
8618
|
+
decorator17.command()
|
|
8435
8619
|
], MakeDatabaseCommand);
|
|
8436
8620
|
// src/commands/MakeDockerCommand.ts
|
|
8437
|
-
import { join as
|
|
8438
|
-
import { decorator as
|
|
8439
|
-
import { TerminalLogger as
|
|
8621
|
+
import { join as join18 } from "path";
|
|
8622
|
+
import { decorator as decorator18 } from "@ooneex/command";
|
|
8623
|
+
import { TerminalLogger as TerminalLogger17 } from "@ooneex/logger";
|
|
8440
8624
|
var {YAML } = globalThis.Bun;
|
|
8441
8625
|
|
|
8442
8626
|
// src/prompts/askDockerService.ts
|
|
@@ -8929,9 +9113,9 @@ class MakeDockerCommand {
|
|
|
8929
9113
|
name = await askDockerService({ message: "Select docker service" });
|
|
8930
9114
|
}
|
|
8931
9115
|
const templateContent = templates[name];
|
|
8932
|
-
const base =
|
|
8933
|
-
const composePath =
|
|
8934
|
-
const logger = new
|
|
9116
|
+
const base = join18("modules", "app");
|
|
9117
|
+
const composePath = join18(process.cwd(), base, "docker-compose.yml");
|
|
9118
|
+
const logger = new TerminalLogger17;
|
|
8935
9119
|
const composeFile = Bun.file(composePath);
|
|
8936
9120
|
if (await composeFile.exists()) {
|
|
8937
9121
|
const existingContent = await composeFile.text();
|
|
@@ -8990,7 +9174,7 @@ volumes:
|
|
|
8990
9174
|
} else {
|
|
8991
9175
|
await Bun.write(composePath, templateContent);
|
|
8992
9176
|
}
|
|
8993
|
-
const packageJsonPath =
|
|
9177
|
+
const packageJsonPath = join18(process.cwd(), base, "package.json");
|
|
8994
9178
|
const packageJsonFile = Bun.file(packageJsonPath);
|
|
8995
9179
|
if (await packageJsonFile.exists()) {
|
|
8996
9180
|
const packageJson = await packageJsonFile.json();
|
|
@@ -9011,18 +9195,18 @@ volumes:
|
|
|
9011
9195
|
}
|
|
9012
9196
|
}
|
|
9013
9197
|
MakeDockerCommand = __legacyDecorateClassTS([
|
|
9014
|
-
|
|
9198
|
+
decorator18.command()
|
|
9015
9199
|
], MakeDockerCommand);
|
|
9016
9200
|
// src/commands/MakeEntityCommand.ts
|
|
9017
9201
|
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
9018
|
-
import { basename as basename3, join as
|
|
9019
|
-
import { decorator as
|
|
9020
|
-
import { TerminalLogger as
|
|
9202
|
+
import { basename as basename3, join as join19 } from "path";
|
|
9203
|
+
import { decorator as decorator19 } from "@ooneex/command";
|
|
9204
|
+
import { TerminalLogger as TerminalLogger18 } from "@ooneex/logger";
|
|
9021
9205
|
import { toPascalCase as toPascalCase8, toSnakeCase as toSnakeCase2 } from "@ooneex/utils";
|
|
9022
9206
|
|
|
9023
9207
|
// src/templates/entity.test.txt
|
|
9024
9208
|
var entity_test_default = `import { describe, expect, test } from "bun:test";
|
|
9025
|
-
import { {{NAME}}Entity } from "
|
|
9209
|
+
import { {{NAME}}Entity } from "@module/{{MODULE}}/entities/{{NAME}}Entity";
|
|
9026
9210
|
|
|
9027
9211
|
describe("{{NAME}}Entity", () => {
|
|
9028
9212
|
test("should have class name ending with 'Entity'", () => {
|
|
@@ -9181,28 +9365,28 @@ class MakeEntityCommand {
|
|
|
9181
9365
|
if (module) {
|
|
9182
9366
|
await ensureModule(module);
|
|
9183
9367
|
}
|
|
9184
|
-
const base = module ?
|
|
9185
|
-
const entitiesLocalDir =
|
|
9186
|
-
const entitiesDir =
|
|
9187
|
-
const filePath =
|
|
9368
|
+
const base = module ? join19("modules", module) : ".";
|
|
9369
|
+
const entitiesLocalDir = join19(base, "src", "entities");
|
|
9370
|
+
const entitiesDir = join19(process.cwd(), entitiesLocalDir);
|
|
9371
|
+
const filePath = join19(entitiesDir, `${name}Entity.ts`);
|
|
9188
9372
|
await Bun.write(filePath, content);
|
|
9189
|
-
const testContent = entity_test_default.replace(/{{NAME}}/g, name);
|
|
9190
|
-
const testsLocalDir =
|
|
9191
|
-
const testsDir =
|
|
9192
|
-
const testFilePath =
|
|
9373
|
+
const testContent = entity_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9374
|
+
const testsLocalDir = join19(base, "tests", "entities");
|
|
9375
|
+
const testsDir = join19(process.cwd(), testsLocalDir);
|
|
9376
|
+
const testFilePath = join19(testsDir, `${name}Entity.spec.ts`);
|
|
9193
9377
|
await Bun.write(testFilePath, testContent);
|
|
9194
9378
|
const modulePascalName = module ? toPascalCase8(module) : toPascalCase8(basename3(process.cwd()));
|
|
9195
|
-
const modulePath =
|
|
9379
|
+
const modulePath = join19(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9196
9380
|
if (await Bun.file(modulePath).exists()) {
|
|
9197
9381
|
await this.addToModule(modulePath, name);
|
|
9198
9382
|
}
|
|
9199
|
-
const logger = new
|
|
9200
|
-
logger.success(`${
|
|
9383
|
+
const logger = new TerminalLogger18;
|
|
9384
|
+
logger.success(`${join19(entitiesLocalDir, name)}Entity.ts created successfully`, undefined, {
|
|
9201
9385
|
showTimestamp: false,
|
|
9202
9386
|
showArrow: false,
|
|
9203
9387
|
useSymbol: true
|
|
9204
9388
|
});
|
|
9205
|
-
logger.success(`${
|
|
9389
|
+
logger.success(`${join19(testsLocalDir, name)}Entity.spec.ts created successfully`, undefined, {
|
|
9206
9390
|
showTimestamp: false,
|
|
9207
9391
|
showArrow: false,
|
|
9208
9392
|
useSymbol: true
|
|
@@ -9210,17 +9394,17 @@ class MakeEntityCommand {
|
|
|
9210
9394
|
}
|
|
9211
9395
|
}
|
|
9212
9396
|
MakeEntityCommand = __legacyDecorateClassTS([
|
|
9213
|
-
|
|
9397
|
+
decorator19.command()
|
|
9214
9398
|
], MakeEntityCommand);
|
|
9215
9399
|
// src/commands/MakeLoggerCommand.ts
|
|
9216
|
-
import { join as
|
|
9217
|
-
import { decorator as
|
|
9218
|
-
import { TerminalLogger as
|
|
9400
|
+
import { join as join20 } from "path";
|
|
9401
|
+
import { decorator as decorator20 } from "@ooneex/command";
|
|
9402
|
+
import { TerminalLogger as TerminalLogger19 } from "@ooneex/logger";
|
|
9219
9403
|
import { toPascalCase as toPascalCase9 } from "@ooneex/utils";
|
|
9220
9404
|
|
|
9221
9405
|
// src/templates/logger.test.txt
|
|
9222
9406
|
var logger_test_default = `import { describe, expect, test } from "bun:test";
|
|
9223
|
-
import { {{NAME}}Logger } from "
|
|
9407
|
+
import { {{NAME}}Logger } from "@module/{{MODULE}}/loggers/{{NAME}}Logger";
|
|
9224
9408
|
|
|
9225
9409
|
describe("{{NAME}}Logger", () => {
|
|
9226
9410
|
test("should have class name ending with 'Logger'", () => {
|
|
@@ -9320,28 +9504,28 @@ class MakeLoggerCommand {
|
|
|
9320
9504
|
if (module) {
|
|
9321
9505
|
await ensureModule(module);
|
|
9322
9506
|
}
|
|
9323
|
-
const base = module ?
|
|
9324
|
-
const loggerLocalDir =
|
|
9325
|
-
const loggerDir =
|
|
9326
|
-
const filePath =
|
|
9507
|
+
const base = module ? join20("modules", module) : ".";
|
|
9508
|
+
const loggerLocalDir = join20(base, "src", "loggers");
|
|
9509
|
+
const loggerDir = join20(process.cwd(), loggerLocalDir);
|
|
9510
|
+
const filePath = join20(loggerDir, `${name}Logger.ts`);
|
|
9327
9511
|
await Bun.write(filePath, content);
|
|
9328
|
-
const testContent = logger_test_default.replace(/{{NAME}}/g, name);
|
|
9329
|
-
const testsLocalDir =
|
|
9330
|
-
const testsDir =
|
|
9331
|
-
const testFilePath =
|
|
9512
|
+
const testContent = logger_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9513
|
+
const testsLocalDir = join20(base, "tests", "loggers");
|
|
9514
|
+
const testsDir = join20(process.cwd(), testsLocalDir);
|
|
9515
|
+
const testFilePath = join20(testsDir, `${name}Logger.spec.ts`);
|
|
9332
9516
|
await Bun.write(testFilePath, testContent);
|
|
9333
|
-
const logger = new
|
|
9334
|
-
logger.success(`${
|
|
9517
|
+
const logger = new TerminalLogger19;
|
|
9518
|
+
logger.success(`${join20(loggerLocalDir, name)}Logger.ts created successfully`, undefined, {
|
|
9335
9519
|
showTimestamp: false,
|
|
9336
9520
|
showArrow: false,
|
|
9337
9521
|
useSymbol: true
|
|
9338
9522
|
});
|
|
9339
|
-
logger.success(`${
|
|
9523
|
+
logger.success(`${join20(testsLocalDir, name)}Logger.spec.ts created successfully`, undefined, {
|
|
9340
9524
|
showTimestamp: false,
|
|
9341
9525
|
showArrow: false,
|
|
9342
9526
|
useSymbol: true
|
|
9343
9527
|
});
|
|
9344
|
-
const packageJsonPath =
|
|
9528
|
+
const packageJsonPath = join20(process.cwd(), "package.json");
|
|
9345
9529
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9346
9530
|
const deps = packageJson.dependencies ?? {};
|
|
9347
9531
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9356,17 +9540,17 @@ class MakeLoggerCommand {
|
|
|
9356
9540
|
}
|
|
9357
9541
|
}
|
|
9358
9542
|
MakeLoggerCommand = __legacyDecorateClassTS([
|
|
9359
|
-
|
|
9543
|
+
decorator20.command()
|
|
9360
9544
|
], MakeLoggerCommand);
|
|
9361
9545
|
// src/commands/MakeMailerCommand.ts
|
|
9362
|
-
import { join as
|
|
9363
|
-
import { decorator as
|
|
9364
|
-
import { TerminalLogger as
|
|
9546
|
+
import { join as join21 } from "path";
|
|
9547
|
+
import { decorator as decorator21 } from "@ooneex/command";
|
|
9548
|
+
import { TerminalLogger as TerminalLogger20 } from "@ooneex/logger";
|
|
9365
9549
|
import { toPascalCase as toPascalCase10 } from "@ooneex/utils";
|
|
9366
9550
|
|
|
9367
9551
|
// src/templates/mailer/mailer.test.txt
|
|
9368
9552
|
var mailer_test_default = `import { describe, expect, test } from "bun:test";
|
|
9369
|
-
import { {{NAME}}Mailer } from "
|
|
9553
|
+
import { {{NAME}}Mailer } from "@module/{{MODULE}}/mailers/{{NAME}}Mailer";
|
|
9370
9554
|
|
|
9371
9555
|
describe("{{NAME}}Mailer", () => {
|
|
9372
9556
|
test("should have class name ending with 'Mailer'", () => {
|
|
@@ -9409,7 +9593,7 @@ export class {{NAME}}Mailer implements IMailer {
|
|
|
9409
9593
|
|
|
9410
9594
|
// src/templates/mailer/mailer-template.test.txt
|
|
9411
9595
|
var mailer_template_test_default = `import { describe, expect, test } from "bun:test";
|
|
9412
|
-
import { {{NAME}}MailerTemplate } from "
|
|
9596
|
+
import { {{NAME}}MailerTemplate } from "@module/{{MODULE}}/mailers/{{NAME}}MailerTemplate";
|
|
9413
9597
|
|
|
9414
9598
|
describe("{{NAME}}MailerTemplate", () => {
|
|
9415
9599
|
test("should have function name ending with 'MailerTemplate'", () => {
|
|
@@ -9459,43 +9643,43 @@ class MakeMailerCommand {
|
|
|
9459
9643
|
if (module) {
|
|
9460
9644
|
await ensureModule(module);
|
|
9461
9645
|
}
|
|
9462
|
-
const base = module ?
|
|
9463
|
-
const mailerLocalDir =
|
|
9464
|
-
const mailerDir =
|
|
9465
|
-
const mailerFilePath =
|
|
9466
|
-
const templateFilePath =
|
|
9646
|
+
const base = module ? join21("modules", module) : ".";
|
|
9647
|
+
const mailerLocalDir = join21(base, "src", "mailers");
|
|
9648
|
+
const mailerDir = join21(process.cwd(), mailerLocalDir);
|
|
9649
|
+
const mailerFilePath = join21(mailerDir, `${name}Mailer.ts`);
|
|
9650
|
+
const templateFilePath = join21(mailerDir, `${name}MailerTemplate.tsx`);
|
|
9467
9651
|
await Bun.write(mailerFilePath, mailerContent);
|
|
9468
9652
|
await Bun.write(templateFilePath, templateContent);
|
|
9469
|
-
const mailerTestContent = mailer_test_default.replace(/{{NAME}}/g, name);
|
|
9470
|
-
const templateTestContent = mailer_template_test_default.replace(/{{NAME}}/g, name);
|
|
9471
|
-
const testsLocalDir =
|
|
9472
|
-
const testsDir =
|
|
9473
|
-
const mailerTestFilePath =
|
|
9474
|
-
const templateTestFilePath =
|
|
9653
|
+
const mailerTestContent = mailer_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9654
|
+
const templateTestContent = mailer_template_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9655
|
+
const testsLocalDir = join21(base, "tests", "mailers");
|
|
9656
|
+
const testsDir = join21(process.cwd(), testsLocalDir);
|
|
9657
|
+
const mailerTestFilePath = join21(testsDir, `${name}Mailer.spec.ts`);
|
|
9658
|
+
const templateTestFilePath = join21(testsDir, `${name}MailerTemplate.spec.ts`);
|
|
9475
9659
|
await Bun.write(mailerTestFilePath, mailerTestContent);
|
|
9476
9660
|
await Bun.write(templateTestFilePath, templateTestContent);
|
|
9477
|
-
const logger = new
|
|
9478
|
-
logger.success(`${
|
|
9661
|
+
const logger = new TerminalLogger20;
|
|
9662
|
+
logger.success(`${join21(mailerLocalDir, name)}Mailer.ts created successfully`, undefined, {
|
|
9479
9663
|
showTimestamp: false,
|
|
9480
9664
|
showArrow: false,
|
|
9481
9665
|
useSymbol: true
|
|
9482
9666
|
});
|
|
9483
|
-
logger.success(`${
|
|
9667
|
+
logger.success(`${join21(mailerLocalDir, name)}MailerTemplate.tsx created successfully`, undefined, {
|
|
9484
9668
|
showTimestamp: false,
|
|
9485
9669
|
showArrow: false,
|
|
9486
9670
|
useSymbol: true
|
|
9487
9671
|
});
|
|
9488
|
-
logger.success(`${
|
|
9672
|
+
logger.success(`${join21(testsLocalDir, name)}Mailer.spec.ts created successfully`, undefined, {
|
|
9489
9673
|
showTimestamp: false,
|
|
9490
9674
|
showArrow: false,
|
|
9491
9675
|
useSymbol: true
|
|
9492
9676
|
});
|
|
9493
|
-
logger.success(`${
|
|
9677
|
+
logger.success(`${join21(testsLocalDir, name)}MailerTemplate.spec.ts created successfully`, undefined, {
|
|
9494
9678
|
showTimestamp: false,
|
|
9495
9679
|
showArrow: false,
|
|
9496
9680
|
useSymbol: true
|
|
9497
9681
|
});
|
|
9498
|
-
const packageJsonPath =
|
|
9682
|
+
const packageJsonPath = join21(process.cwd(), "package.json");
|
|
9499
9683
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9500
9684
|
const deps = packageJson.dependencies ?? {};
|
|
9501
9685
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9510,12 +9694,12 @@ class MakeMailerCommand {
|
|
|
9510
9694
|
}
|
|
9511
9695
|
}
|
|
9512
9696
|
MakeMailerCommand = __legacyDecorateClassTS([
|
|
9513
|
-
|
|
9697
|
+
decorator21.command()
|
|
9514
9698
|
], MakeMailerCommand);
|
|
9515
9699
|
// src/commands/MakeMiddlewareCommand.ts
|
|
9516
|
-
import { basename as basename4, join as
|
|
9517
|
-
import { decorator as
|
|
9518
|
-
import { TerminalLogger as
|
|
9700
|
+
import { basename as basename4, join as join22 } from "path";
|
|
9701
|
+
import { decorator as decorator22 } from "@ooneex/command";
|
|
9702
|
+
import { TerminalLogger as TerminalLogger21 } from "@ooneex/logger";
|
|
9519
9703
|
import { toPascalCase as toPascalCase11 } from "@ooneex/utils";
|
|
9520
9704
|
|
|
9521
9705
|
// src/templates/middleware.socket.txt
|
|
@@ -9535,7 +9719,7 @@ export class {{NAME}}Middleware implements IMiddleware {
|
|
|
9535
9719
|
|
|
9536
9720
|
// src/templates/middleware.test.txt
|
|
9537
9721
|
var middleware_test_default = `import { describe, expect, test } from "bun:test";
|
|
9538
|
-
import { {{NAME}}Middleware } from "
|
|
9722
|
+
import { {{NAME}}Middleware } from "@module/{{MODULE}}/middlewares/{{NAME}}Middleware";
|
|
9539
9723
|
|
|
9540
9724
|
describe("{{NAME}}Middleware", () => {
|
|
9541
9725
|
test("should have class name ending with 'Middleware'", () => {
|
|
@@ -9604,33 +9788,33 @@ class MakeMiddlewareCommand {
|
|
|
9604
9788
|
if (module) {
|
|
9605
9789
|
await ensureModule(module);
|
|
9606
9790
|
}
|
|
9607
|
-
const base = module ?
|
|
9608
|
-
const middlewareLocalDir =
|
|
9609
|
-
const middlewareDir =
|
|
9610
|
-
const filePath =
|
|
9791
|
+
const base = module ? join22("modules", module) : ".";
|
|
9792
|
+
const middlewareLocalDir = join22(base, "src", "middlewares");
|
|
9793
|
+
const middlewareDir = join22(process.cwd(), middlewareLocalDir);
|
|
9794
|
+
const filePath = join22(middlewareDir, `${name}Middleware.ts`);
|
|
9611
9795
|
await Bun.write(filePath, content);
|
|
9612
|
-
const testContent = middleware_test_default.replace(/{{NAME}}/g, name);
|
|
9613
|
-
const testsLocalDir =
|
|
9614
|
-
const testsDir =
|
|
9615
|
-
const testFilePath =
|
|
9796
|
+
const testContent = middleware_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9797
|
+
const testsLocalDir = join22(base, "tests", "middlewares");
|
|
9798
|
+
const testsDir = join22(process.cwd(), testsLocalDir);
|
|
9799
|
+
const testFilePath = join22(testsDir, `${name}Middleware.spec.ts`);
|
|
9616
9800
|
await Bun.write(testFilePath, testContent);
|
|
9617
9801
|
const modulePascalName = module ? toPascalCase11(module) : toPascalCase11(basename4(process.cwd()));
|
|
9618
|
-
const modulePath =
|
|
9802
|
+
const modulePath = join22(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9619
9803
|
if (await Bun.file(modulePath).exists()) {
|
|
9620
9804
|
await this.addToModule(modulePath, name);
|
|
9621
9805
|
}
|
|
9622
|
-
const logger = new
|
|
9623
|
-
logger.success(`${
|
|
9806
|
+
const logger = new TerminalLogger21;
|
|
9807
|
+
logger.success(`${join22(middlewareLocalDir, name)}Middleware.ts created successfully`, undefined, {
|
|
9624
9808
|
showTimestamp: false,
|
|
9625
9809
|
showArrow: false,
|
|
9626
9810
|
useSymbol: true
|
|
9627
9811
|
});
|
|
9628
|
-
logger.success(`${
|
|
9812
|
+
logger.success(`${join22(testsLocalDir, name)}Middleware.spec.ts created successfully`, undefined, {
|
|
9629
9813
|
showTimestamp: false,
|
|
9630
9814
|
showArrow: false,
|
|
9631
9815
|
useSymbol: true
|
|
9632
9816
|
});
|
|
9633
|
-
const packageJsonPath =
|
|
9817
|
+
const packageJsonPath = join22(process.cwd(), "package.json");
|
|
9634
9818
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9635
9819
|
const deps = packageJson.dependencies ?? {};
|
|
9636
9820
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9645,12 +9829,12 @@ class MakeMiddlewareCommand {
|
|
|
9645
9829
|
}
|
|
9646
9830
|
}
|
|
9647
9831
|
MakeMiddlewareCommand = __legacyDecorateClassTS([
|
|
9648
|
-
|
|
9832
|
+
decorator22.command()
|
|
9649
9833
|
], MakeMiddlewareCommand);
|
|
9650
9834
|
// src/commands/MakeMigrationCommand.ts
|
|
9651
|
-
import { join as
|
|
9652
|
-
import { decorator as
|
|
9653
|
-
import { TerminalLogger as
|
|
9835
|
+
import { join as join23 } from "path";
|
|
9836
|
+
import { decorator as decorator23 } from "@ooneex/command";
|
|
9837
|
+
import { TerminalLogger as TerminalLogger22 } from "@ooneex/logger";
|
|
9654
9838
|
import { migrationCreate } from "@ooneex/migrations";
|
|
9655
9839
|
|
|
9656
9840
|
// src/templates/module/migration.up.txt
|
|
@@ -9678,17 +9862,18 @@ class MakeMigrationCommand {
|
|
|
9678
9862
|
if (module) {
|
|
9679
9863
|
await ensureModule(module);
|
|
9680
9864
|
}
|
|
9681
|
-
const base = module ?
|
|
9865
|
+
const base = module ? join23("modules", module) : ".";
|
|
9682
9866
|
const { migrationPath: filePath } = await migrationCreate({
|
|
9683
|
-
migrationsDir:
|
|
9684
|
-
testsDir:
|
|
9867
|
+
migrationsDir: join23(base, "src", "migrations"),
|
|
9868
|
+
testsDir: join23(base, "tests", "migrations"),
|
|
9869
|
+
module: module ?? ""
|
|
9685
9870
|
});
|
|
9686
|
-
const binMigrationUpPath =
|
|
9871
|
+
const binMigrationUpPath = join23(process.cwd(), base, "bin", "migration", "up.ts");
|
|
9687
9872
|
const binMigrationUpFile = Bun.file(binMigrationUpPath);
|
|
9688
9873
|
if (!await binMigrationUpFile.exists()) {
|
|
9689
9874
|
await Bun.write(binMigrationUpPath, migration_up_default.replace(/{{name}}/g, module ?? ""));
|
|
9690
9875
|
}
|
|
9691
|
-
const logger = new
|
|
9876
|
+
const logger = new TerminalLogger22;
|
|
9692
9877
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
9693
9878
|
showTimestamp: false,
|
|
9694
9879
|
showArrow: false,
|
|
@@ -9697,18 +9882,18 @@ class MakeMigrationCommand {
|
|
|
9697
9882
|
}
|
|
9698
9883
|
}
|
|
9699
9884
|
MakeMigrationCommand = __legacyDecorateClassTS([
|
|
9700
|
-
|
|
9885
|
+
decorator23.command()
|
|
9701
9886
|
], MakeMigrationCommand);
|
|
9702
9887
|
// src/commands/MakePermissionCommand.ts
|
|
9703
|
-
import { join as
|
|
9704
|
-
import { decorator as
|
|
9705
|
-
import { TerminalLogger as
|
|
9888
|
+
import { join as join24 } from "path";
|
|
9889
|
+
import { decorator as decorator24 } from "@ooneex/command";
|
|
9890
|
+
import { TerminalLogger as TerminalLogger23 } from "@ooneex/logger";
|
|
9706
9891
|
import { toPascalCase as toPascalCase12 } from "@ooneex/utils";
|
|
9707
9892
|
|
|
9708
9893
|
// src/templates/permission.test.txt
|
|
9709
9894
|
var permission_test_default = `import { describe, expect, test } from "bun:test";
|
|
9710
9895
|
import { Permission } from "@ooneex/permission";
|
|
9711
|
-
import { {{NAME}}Permission } from "
|
|
9896
|
+
import { {{NAME}}Permission } from "@module/{{MODULE}}/permissions/{{NAME}}Permission";
|
|
9712
9897
|
|
|
9713
9898
|
describe("{{NAME}}Permission", () => {
|
|
9714
9899
|
test("should have class name ending with 'Permission'", () => {
|
|
@@ -9730,12 +9915,17 @@ describe("{{NAME}}Permission", () => {
|
|
|
9730
9915
|
expect(typeof {{NAME}}Permission.prototype.setUserPermissions).toBe("function");
|
|
9731
9916
|
});
|
|
9732
9917
|
|
|
9918
|
+
test("should have 'check' method", () => {
|
|
9919
|
+
expect({{NAME}}Permission.prototype.check).toBeDefined();
|
|
9920
|
+
expect(typeof {{NAME}}Permission.prototype.check).toBe("function");
|
|
9921
|
+
});
|
|
9922
|
+
|
|
9733
9923
|
});
|
|
9734
9924
|
`;
|
|
9735
9925
|
|
|
9736
9926
|
// src/templates/permission.txt
|
|
9737
|
-
var permission_default = `import {
|
|
9738
|
-
import
|
|
9927
|
+
var permission_default = `import type { ContextType } from "@ooneex/controller";
|
|
9928
|
+
import { decorator, Permission } from "@ooneex/permission";
|
|
9739
9929
|
|
|
9740
9930
|
@decorator.permission()
|
|
9741
9931
|
export class {{NAME}}Permission extends Permission {
|
|
@@ -9747,12 +9937,14 @@ export class {{NAME}}Permission extends Permission {
|
|
|
9747
9937
|
return this;
|
|
9748
9938
|
}
|
|
9749
9939
|
|
|
9750
|
-
public setUserPermissions(
|
|
9751
|
-
if (!user) {
|
|
9752
|
-
return this;
|
|
9753
|
-
}
|
|
9754
|
-
|
|
9940
|
+
public setUserPermissions(context: ContextType): this {
|
|
9755
9941
|
// Example: Grant full access to admins
|
|
9942
|
+
// const { user } = context;
|
|
9943
|
+
//
|
|
9944
|
+
// if (!user) {
|
|
9945
|
+
// return this;
|
|
9946
|
+
// }
|
|
9947
|
+
//
|
|
9756
9948
|
// const { roles } = user;
|
|
9757
9949
|
// if (roles.includes(ERole.ADMIN)) {
|
|
9758
9950
|
// this.ability.can("manage", "all");
|
|
@@ -9760,18 +9952,58 @@ export class {{NAME}}Permission extends Permission {
|
|
|
9760
9952
|
// }
|
|
9761
9953
|
|
|
9762
9954
|
// Example: Grant specific permissions based on roles
|
|
9763
|
-
//
|
|
9764
|
-
//
|
|
9765
|
-
//
|
|
9766
|
-
//
|
|
9955
|
+
// const { user } = context;
|
|
9956
|
+
//
|
|
9957
|
+
// if (user) {
|
|
9958
|
+
// for (const role of user.roles) {
|
|
9959
|
+
// if (role === ERole.USER) {
|
|
9960
|
+
// this.ability.can(["read", "update"], "YourEntity", { userId: user.id });
|
|
9961
|
+
// }
|
|
9767
9962
|
//
|
|
9768
|
-
//
|
|
9769
|
-
//
|
|
9963
|
+
// if (role === ERole.GUEST) {
|
|
9964
|
+
// this.ability.can("read", "YourEntity", { public: true });
|
|
9965
|
+
// }
|
|
9770
9966
|
// }
|
|
9771
9967
|
// }
|
|
9772
9968
|
|
|
9773
9969
|
return this;
|
|
9774
9970
|
}
|
|
9971
|
+
|
|
9972
|
+
public check(context: ContextType): boolean {
|
|
9973
|
+
// Example 1: Restrict access based on IP or request method
|
|
9974
|
+
// const { ip, method } = context;
|
|
9975
|
+
//
|
|
9976
|
+
// if (!ip) {
|
|
9977
|
+
// return false;
|
|
9978
|
+
// }
|
|
9979
|
+
//
|
|
9980
|
+
// if (method === "DELETE") {
|
|
9981
|
+
// return false;
|
|
9982
|
+
// }
|
|
9983
|
+
|
|
9984
|
+
// Example 2: Restrict access based on route roles
|
|
9985
|
+
// const { route } = context;
|
|
9986
|
+
//
|
|
9987
|
+
// if (route?.roles && route.roles.length > 0) {
|
|
9988
|
+
// return false;
|
|
9989
|
+
// }
|
|
9990
|
+
|
|
9991
|
+
// Example 3: Restrict access based on request header
|
|
9992
|
+
// const { header } = context;
|
|
9993
|
+
//
|
|
9994
|
+
// if (!header.get("Authorization")) {
|
|
9995
|
+
// return false;
|
|
9996
|
+
// }
|
|
9997
|
+
|
|
9998
|
+
// Example 4: Restrict access based on rate limiter
|
|
9999
|
+
// const { rateLimiter } = context;
|
|
10000
|
+
//
|
|
10001
|
+
// if (rateLimiter) {
|
|
10002
|
+
// return false;
|
|
10003
|
+
// }
|
|
10004
|
+
|
|
10005
|
+
return true;
|
|
10006
|
+
}
|
|
9775
10007
|
}
|
|
9776
10008
|
`;
|
|
9777
10009
|
|
|
@@ -9793,28 +10025,28 @@ class MakePermissionCommand {
|
|
|
9793
10025
|
if (module) {
|
|
9794
10026
|
await ensureModule(module);
|
|
9795
10027
|
}
|
|
9796
|
-
const base = module ?
|
|
9797
|
-
const permissionLocalDir =
|
|
9798
|
-
const permissionDir =
|
|
9799
|
-
const filePath =
|
|
10028
|
+
const base = module ? join24("modules", module) : ".";
|
|
10029
|
+
const permissionLocalDir = join24(base, "src", "permissions");
|
|
10030
|
+
const permissionDir = join24(process.cwd(), permissionLocalDir);
|
|
10031
|
+
const filePath = join24(permissionDir, `${name}Permission.ts`);
|
|
9800
10032
|
await Bun.write(filePath, content);
|
|
9801
|
-
const testContent = permission_test_default.replace(/{{NAME}}/g, name);
|
|
9802
|
-
const testsLocalDir =
|
|
9803
|
-
const testsDir =
|
|
9804
|
-
const testFilePath =
|
|
10033
|
+
const testContent = permission_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
10034
|
+
const testsLocalDir = join24(base, "tests", "permissions");
|
|
10035
|
+
const testsDir = join24(process.cwd(), testsLocalDir);
|
|
10036
|
+
const testFilePath = join24(testsDir, `${name}Permission.spec.ts`);
|
|
9805
10037
|
await Bun.write(testFilePath, testContent);
|
|
9806
|
-
const logger = new
|
|
9807
|
-
logger.success(`${
|
|
10038
|
+
const logger = new TerminalLogger23;
|
|
10039
|
+
logger.success(`${join24(permissionLocalDir, name)}Permission.ts created successfully`, undefined, {
|
|
9808
10040
|
showTimestamp: false,
|
|
9809
10041
|
showArrow: false,
|
|
9810
10042
|
useSymbol: true
|
|
9811
10043
|
});
|
|
9812
|
-
logger.success(`${
|
|
10044
|
+
logger.success(`${join24(testsLocalDir, name)}Permission.spec.ts created successfully`, undefined, {
|
|
9813
10045
|
showTimestamp: false,
|
|
9814
10046
|
showArrow: false,
|
|
9815
10047
|
useSymbol: true
|
|
9816
10048
|
});
|
|
9817
|
-
const packageJsonPath =
|
|
10049
|
+
const packageJsonPath = join24(process.cwd(), "package.json");
|
|
9818
10050
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9819
10051
|
const deps = packageJson.dependencies ?? {};
|
|
9820
10052
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9829,17 +10061,17 @@ class MakePermissionCommand {
|
|
|
9829
10061
|
}
|
|
9830
10062
|
}
|
|
9831
10063
|
MakePermissionCommand = __legacyDecorateClassTS([
|
|
9832
|
-
|
|
10064
|
+
decorator24.command()
|
|
9833
10065
|
], MakePermissionCommand);
|
|
9834
10066
|
// src/commands/MakePubSubCommand.ts
|
|
9835
|
-
import { basename as basename5, join as
|
|
9836
|
-
import { decorator as
|
|
9837
|
-
import { TerminalLogger as
|
|
10067
|
+
import { basename as basename5, join as join25 } from "path";
|
|
10068
|
+
import { decorator as decorator25 } from "@ooneex/command";
|
|
10069
|
+
import { TerminalLogger as TerminalLogger24 } from "@ooneex/logger";
|
|
9838
10070
|
import { toKebabCase as toKebabCase4, toPascalCase as toPascalCase13 } from "@ooneex/utils";
|
|
9839
10071
|
|
|
9840
10072
|
// src/templates/pubsub.test.txt
|
|
9841
10073
|
var pubsub_test_default = `import { describe, expect, test } from "bun:test";
|
|
9842
|
-
import { {{NAME}}PubSub } from "
|
|
10074
|
+
import { {{NAME}}PubSub } from "@module/{{MODULE}}/pubsub/{{NAME}}PubSub";
|
|
9843
10075
|
|
|
9844
10076
|
describe("{{NAME}}PubSub", () => {
|
|
9845
10077
|
test("should have class name ending with 'PubSub'", () => {
|
|
@@ -9942,33 +10174,33 @@ class MakePubSubCommand {
|
|
|
9942
10174
|
if (module) {
|
|
9943
10175
|
await ensureModule(module);
|
|
9944
10176
|
}
|
|
9945
|
-
const base = module ?
|
|
9946
|
-
const pubSubLocalDir =
|
|
9947
|
-
const pubSubDir =
|
|
9948
|
-
const filePath =
|
|
10177
|
+
const base = module ? join25("modules", module) : ".";
|
|
10178
|
+
const pubSubLocalDir = join25(base, "src", "events");
|
|
10179
|
+
const pubSubDir = join25(process.cwd(), pubSubLocalDir);
|
|
10180
|
+
const filePath = join25(pubSubDir, `${name}Event.ts`);
|
|
9949
10181
|
await Bun.write(filePath, content);
|
|
9950
|
-
const testContent = pubsub_test_default.replace(/{{NAME}}/g, name);
|
|
9951
|
-
const testsLocalDir =
|
|
9952
|
-
const testsDir =
|
|
9953
|
-
const testFilePath =
|
|
10182
|
+
const testContent = pubsub_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
10183
|
+
const testsLocalDir = join25(base, "tests", "events");
|
|
10184
|
+
const testsDir = join25(process.cwd(), testsLocalDir);
|
|
10185
|
+
const testFilePath = join25(testsDir, `${name}Event.spec.ts`);
|
|
9954
10186
|
await Bun.write(testFilePath, testContent);
|
|
9955
10187
|
const modulePascalName = module ? toPascalCase13(module) : toPascalCase13(basename5(process.cwd()));
|
|
9956
|
-
const modulePath =
|
|
10188
|
+
const modulePath = join25(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9957
10189
|
if (await Bun.file(modulePath).exists()) {
|
|
9958
10190
|
await this.addToModule(modulePath, name);
|
|
9959
10191
|
}
|
|
9960
|
-
const logger = new
|
|
9961
|
-
logger.success(`${
|
|
10192
|
+
const logger = new TerminalLogger24;
|
|
10193
|
+
logger.success(`${join25(pubSubLocalDir, name)}Event.ts created successfully`, undefined, {
|
|
9962
10194
|
showTimestamp: false,
|
|
9963
10195
|
showArrow: false,
|
|
9964
10196
|
useSymbol: true
|
|
9965
10197
|
});
|
|
9966
|
-
logger.success(`${
|
|
10198
|
+
logger.success(`${join25(testsLocalDir, name)}Event.spec.ts created successfully`, undefined, {
|
|
9967
10199
|
showTimestamp: false,
|
|
9968
10200
|
showArrow: false,
|
|
9969
10201
|
useSymbol: true
|
|
9970
10202
|
});
|
|
9971
|
-
const packageJsonPath =
|
|
10203
|
+
const packageJsonPath = join25(process.cwd(), "package.json");
|
|
9972
10204
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9973
10205
|
const deps = packageJson.dependencies ?? {};
|
|
9974
10206
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9983,13 +10215,13 @@ class MakePubSubCommand {
|
|
|
9983
10215
|
}
|
|
9984
10216
|
}
|
|
9985
10217
|
MakePubSubCommand = __legacyDecorateClassTS([
|
|
9986
|
-
|
|
10218
|
+
decorator25.command()
|
|
9987
10219
|
], MakePubSubCommand);
|
|
9988
10220
|
// src/commands/MakeReleaseCommand.ts
|
|
9989
10221
|
import { readdir } from "fs/promises";
|
|
9990
|
-
import { join as
|
|
9991
|
-
import { decorator as
|
|
9992
|
-
import { TerminalLogger as
|
|
10222
|
+
import { join as join26 } from "path";
|
|
10223
|
+
import { decorator as decorator26 } from "@ooneex/command";
|
|
10224
|
+
import { TerminalLogger as TerminalLogger25 } from "@ooneex/logger";
|
|
9993
10225
|
var {$ } = globalThis.Bun;
|
|
9994
10226
|
var COMMIT_TYPE_TO_CATEGORY = {
|
|
9995
10227
|
feat: "Added",
|
|
@@ -10012,7 +10244,7 @@ class MakeReleaseCommand {
|
|
|
10012
10244
|
return "Release packages with version bump, changelog, and git tag";
|
|
10013
10245
|
}
|
|
10014
10246
|
async run() {
|
|
10015
|
-
const logger = new
|
|
10247
|
+
const logger = new TerminalLogger25;
|
|
10016
10248
|
const cwd = process.cwd();
|
|
10017
10249
|
const dirs = [];
|
|
10018
10250
|
for (const { name, type } of [
|
|
@@ -10020,8 +10252,8 @@ class MakeReleaseCommand {
|
|
|
10020
10252
|
{ name: "modules", type: "module" }
|
|
10021
10253
|
]) {
|
|
10022
10254
|
try {
|
|
10023
|
-
const entries = await readdir(
|
|
10024
|
-
dirs.push(...entries.filter((d) => d.isDirectory()).map((d) => ({ base:
|
|
10255
|
+
const entries = await readdir(join26(cwd, name), { withFileTypes: true });
|
|
10256
|
+
dirs.push(...entries.filter((d) => d.isDirectory()).map((d) => ({ base: join26(name, d.name), type })));
|
|
10025
10257
|
} catch {}
|
|
10026
10258
|
}
|
|
10027
10259
|
const logOptions = { showTimestamp: false, showArrow: false, useSymbol: true };
|
|
@@ -10031,8 +10263,8 @@ class MakeReleaseCommand {
|
|
|
10031
10263
|
}
|
|
10032
10264
|
let releasedCount = 0;
|
|
10033
10265
|
for (const dir of dirs) {
|
|
10034
|
-
const fullDir =
|
|
10035
|
-
const pkgJsonPath =
|
|
10266
|
+
const fullDir = join26(cwd, dir.base);
|
|
10267
|
+
const pkgJsonPath = join26(fullDir, "package.json");
|
|
10036
10268
|
const pkgJsonFile = Bun.file(pkgJsonPath);
|
|
10037
10269
|
if (!await pkgJsonFile.exists()) {
|
|
10038
10270
|
continue;
|
|
@@ -10050,7 +10282,7 @@ class MakeReleaseCommand {
|
|
|
10050
10282
|
await Bun.write(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}
|
|
10051
10283
|
`);
|
|
10052
10284
|
await this.updateChangelog(fullDir, newVersion, tag, commits);
|
|
10053
|
-
await this.gitAdd(
|
|
10285
|
+
await this.gitAdd(join26(dir.base, "package.json"), join26(dir.base, "CHANGELOG.md"));
|
|
10054
10286
|
await this.gitCommit(`chore(release): ${pkgJson.name}@${newVersion}`);
|
|
10055
10287
|
await this.gitTag(tag, `chore(release): ${pkgJson.name}@${newVersion}`);
|
|
10056
10288
|
logger.success(`${pkgJson.name}@${newVersion} released (${bumpType} bump, ${commits.length} commit(s))`, undefined, logOptions);
|
|
@@ -10151,7 +10383,7 @@ class MakeReleaseCommand {
|
|
|
10151
10383
|
}
|
|
10152
10384
|
}
|
|
10153
10385
|
async updateChangelog(dir, version, tag, commits) {
|
|
10154
|
-
const changelogPath =
|
|
10386
|
+
const changelogPath = join26(dir, "CHANGELOG.md");
|
|
10155
10387
|
const today = new Date().toISOString().split("T")[0];
|
|
10156
10388
|
const repoUrl = await this.getRepoUrl();
|
|
10157
10389
|
const grouped = new Map;
|
|
@@ -10228,17 +10460,17 @@ ${section}
|
|
|
10228
10460
|
}
|
|
10229
10461
|
}
|
|
10230
10462
|
MakeReleaseCommand = __legacyDecorateClassTS([
|
|
10231
|
-
|
|
10463
|
+
decorator26.command()
|
|
10232
10464
|
], MakeReleaseCommand);
|
|
10233
10465
|
// src/commands/MakeRepositoryCommand.ts
|
|
10234
|
-
import { join as
|
|
10235
|
-
import { decorator as
|
|
10236
|
-
import { TerminalLogger as
|
|
10466
|
+
import { join as join27 } from "path";
|
|
10467
|
+
import { decorator as decorator27 } from "@ooneex/command";
|
|
10468
|
+
import { TerminalLogger as TerminalLogger26 } from "@ooneex/logger";
|
|
10237
10469
|
import { toPascalCase as toPascalCase14 } from "@ooneex/utils";
|
|
10238
10470
|
|
|
10239
10471
|
// src/templates/repository.test.txt
|
|
10240
10472
|
var repository_test_default = `import { describe, expect, test } from "bun:test";
|
|
10241
|
-
import { {{NAME}}Repository } from "
|
|
10473
|
+
import { {{NAME}}Repository } from "@module/{{MODULE}}/repositories/{{NAME}}Repository";
|
|
10242
10474
|
|
|
10243
10475
|
describe("{{NAME}}Repository", () => {
|
|
10244
10476
|
test("should have class name ending with 'Repository'", () => {
|
|
@@ -10447,28 +10679,28 @@ class MakeRepositoryCommand {
|
|
|
10447
10679
|
if (module) {
|
|
10448
10680
|
await ensureModule(module);
|
|
10449
10681
|
}
|
|
10450
|
-
const base = module ?
|
|
10451
|
-
const repositoriesLocalDir =
|
|
10452
|
-
const repositoriesDir =
|
|
10453
|
-
const filePath =
|
|
10682
|
+
const base = module ? join27("modules", module) : ".";
|
|
10683
|
+
const repositoriesLocalDir = join27(base, "src", "repositories");
|
|
10684
|
+
const repositoriesDir = join27(process.cwd(), repositoriesLocalDir);
|
|
10685
|
+
const filePath = join27(repositoriesDir, `${name}Repository.ts`);
|
|
10454
10686
|
await Bun.write(filePath, content);
|
|
10455
|
-
const testContent = repository_test_default.replace(/{{NAME}}/g, name);
|
|
10456
|
-
const testsLocalDir =
|
|
10457
|
-
const testsDir =
|
|
10458
|
-
const testFilePath =
|
|
10687
|
+
const testContent = repository_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
10688
|
+
const testsLocalDir = join27(base, "tests", "repositories");
|
|
10689
|
+
const testsDir = join27(process.cwd(), testsLocalDir);
|
|
10690
|
+
const testFilePath = join27(testsDir, `${name}Repository.spec.ts`);
|
|
10459
10691
|
await Bun.write(testFilePath, testContent);
|
|
10460
|
-
const logger = new
|
|
10461
|
-
logger.success(`${
|
|
10692
|
+
const logger = new TerminalLogger26;
|
|
10693
|
+
logger.success(`${join27(repositoriesLocalDir, name)}Repository.ts created successfully`, undefined, {
|
|
10462
10694
|
showTimestamp: false,
|
|
10463
10695
|
showArrow: false,
|
|
10464
10696
|
useSymbol: true
|
|
10465
10697
|
});
|
|
10466
|
-
logger.success(`${
|
|
10698
|
+
logger.success(`${join27(testsLocalDir, name)}Repository.spec.ts created successfully`, undefined, {
|
|
10467
10699
|
showTimestamp: false,
|
|
10468
10700
|
showArrow: false,
|
|
10469
10701
|
useSymbol: true
|
|
10470
10702
|
});
|
|
10471
|
-
const packageJsonPath =
|
|
10703
|
+
const packageJsonPath = join27(process.cwd(), "package.json");
|
|
10472
10704
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
10473
10705
|
const deps = packageJson.dependencies ?? {};
|
|
10474
10706
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -10483,11 +10715,11 @@ class MakeRepositoryCommand {
|
|
|
10483
10715
|
}
|
|
10484
10716
|
}
|
|
10485
10717
|
MakeRepositoryCommand = __legacyDecorateClassTS([
|
|
10486
|
-
|
|
10718
|
+
decorator27.command()
|
|
10487
10719
|
], MakeRepositoryCommand);
|
|
10488
10720
|
// src/commands/MakeResourceBookCommand.ts
|
|
10489
|
-
import { join as
|
|
10490
|
-
import { decorator as
|
|
10721
|
+
import { join as join29 } from "path";
|
|
10722
|
+
import { decorator as decorator29 } from "@ooneex/command";
|
|
10491
10723
|
var {Glob } = globalThis.Bun;
|
|
10492
10724
|
|
|
10493
10725
|
// src/templates/resources/book/BookEntity.txt
|
|
@@ -11183,14 +11415,14 @@ export class UpdateBookService implements IService {
|
|
|
11183
11415
|
`;
|
|
11184
11416
|
|
|
11185
11417
|
// src/commands/MakeServiceCommand.ts
|
|
11186
|
-
import { join as
|
|
11187
|
-
import { decorator as
|
|
11188
|
-
import { TerminalLogger as
|
|
11418
|
+
import { join as join28 } from "path";
|
|
11419
|
+
import { decorator as decorator28 } from "@ooneex/command";
|
|
11420
|
+
import { TerminalLogger as TerminalLogger27 } from "@ooneex/logger";
|
|
11189
11421
|
import { toPascalCase as toPascalCase15 } from "@ooneex/utils";
|
|
11190
11422
|
|
|
11191
11423
|
// src/templates/service.test.txt
|
|
11192
11424
|
var service_test_default = `import { describe, expect, test } from "bun:test";
|
|
11193
|
-
import { {{NAME}}Service } from "
|
|
11425
|
+
import { {{NAME}}Service } from "@module/{{MODULE}}/services/{{NAME}}Service";
|
|
11194
11426
|
|
|
11195
11427
|
describe("{{NAME}}Service", () => {
|
|
11196
11428
|
test("should have class name ending with 'Service'", () => {
|
|
@@ -11237,28 +11469,28 @@ class MakeServiceCommand {
|
|
|
11237
11469
|
if (module) {
|
|
11238
11470
|
await ensureModule(module);
|
|
11239
11471
|
}
|
|
11240
|
-
const base = module ?
|
|
11241
|
-
const serviceLocalDir =
|
|
11242
|
-
const serviceDir =
|
|
11243
|
-
const filePath =
|
|
11472
|
+
const base = module ? join28("modules", module) : ".";
|
|
11473
|
+
const serviceLocalDir = join28(base, "src", "services");
|
|
11474
|
+
const serviceDir = join28(process.cwd(), serviceLocalDir);
|
|
11475
|
+
const filePath = join28(serviceDir, `${name}Service.ts`);
|
|
11244
11476
|
await Bun.write(filePath, content);
|
|
11245
|
-
const testContent = service_test_default.replace(/{{NAME}}/g, name);
|
|
11246
|
-
const testsLocalDir =
|
|
11247
|
-
const testsDir =
|
|
11248
|
-
const testFilePath =
|
|
11477
|
+
const testContent = service_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
11478
|
+
const testsLocalDir = join28(base, "tests", "services");
|
|
11479
|
+
const testsDir = join28(process.cwd(), testsLocalDir);
|
|
11480
|
+
const testFilePath = join28(testsDir, `${name}Service.spec.ts`);
|
|
11249
11481
|
await Bun.write(testFilePath, testContent);
|
|
11250
|
-
const logger = new
|
|
11251
|
-
logger.success(`${
|
|
11482
|
+
const logger = new TerminalLogger27;
|
|
11483
|
+
logger.success(`${join28(serviceLocalDir, name)}Service.ts created successfully`, undefined, {
|
|
11252
11484
|
showTimestamp: false,
|
|
11253
11485
|
showArrow: false,
|
|
11254
11486
|
useSymbol: true
|
|
11255
11487
|
});
|
|
11256
|
-
logger.success(`${
|
|
11488
|
+
logger.success(`${join28(testsLocalDir, name)}Service.spec.ts created successfully`, undefined, {
|
|
11257
11489
|
showTimestamp: false,
|
|
11258
11490
|
showArrow: false,
|
|
11259
11491
|
useSymbol: true
|
|
11260
11492
|
});
|
|
11261
|
-
const packageJsonPath =
|
|
11493
|
+
const packageJsonPath = join28(process.cwd(), "package.json");
|
|
11262
11494
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
11263
11495
|
const deps = packageJson.dependencies ?? {};
|
|
11264
11496
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -11273,7 +11505,7 @@ class MakeServiceCommand {
|
|
|
11273
11505
|
}
|
|
11274
11506
|
}
|
|
11275
11507
|
MakeServiceCommand = __legacyDecorateClassTS([
|
|
11276
|
-
|
|
11508
|
+
decorator28.command()
|
|
11277
11509
|
], MakeServiceCommand);
|
|
11278
11510
|
|
|
11279
11511
|
// src/commands/MakeResourceBookCommand.ts
|
|
@@ -11286,7 +11518,7 @@ class MakeResourceBookCommand {
|
|
|
11286
11518
|
}
|
|
11287
11519
|
async run() {
|
|
11288
11520
|
const module = "book";
|
|
11289
|
-
const base =
|
|
11521
|
+
const base = join29("modules", module);
|
|
11290
11522
|
const makeModuleCommand = new MakeModuleCommand;
|
|
11291
11523
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
11292
11524
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -11306,26 +11538,26 @@ class MakeResourceBookCommand {
|
|
|
11306
11538
|
for (const controller of controllers) {
|
|
11307
11539
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
11308
11540
|
}
|
|
11309
|
-
const controllersDir =
|
|
11310
|
-
await Bun.write(
|
|
11311
|
-
await Bun.write(
|
|
11312
|
-
await Bun.write(
|
|
11313
|
-
await Bun.write(
|
|
11314
|
-
await Bun.write(
|
|
11541
|
+
const controllersDir = join29(process.cwd(), base, "src", "controllers");
|
|
11542
|
+
await Bun.write(join29(controllersDir, "CreateBookController.ts"), CreateBookController_default);
|
|
11543
|
+
await Bun.write(join29(controllersDir, "GetBookController.ts"), GetBookController_default);
|
|
11544
|
+
await Bun.write(join29(controllersDir, "ListBooksController.ts"), ListBooksController_default);
|
|
11545
|
+
await Bun.write(join29(controllersDir, "UpdateBookController.ts"), UpdateBookController_default);
|
|
11546
|
+
await Bun.write(join29(controllersDir, "DeleteBookController.ts"), DeleteBookController_default);
|
|
11315
11547
|
const makeServiceCommand = new MakeServiceCommand;
|
|
11316
11548
|
const services = ["CreateBook", "GetBook", "ListBooks", "UpdateBook", "DeleteBook"];
|
|
11317
11549
|
for (const name of services) {
|
|
11318
11550
|
await makeServiceCommand.run({ name, module });
|
|
11319
11551
|
}
|
|
11320
|
-
const servicesDir =
|
|
11321
|
-
await Bun.write(
|
|
11322
|
-
await Bun.write(
|
|
11323
|
-
await Bun.write(
|
|
11324
|
-
await Bun.write(
|
|
11325
|
-
await Bun.write(
|
|
11326
|
-
const entityPath =
|
|
11552
|
+
const servicesDir = join29(process.cwd(), base, "src", "services");
|
|
11553
|
+
await Bun.write(join29(servicesDir, "CreateBookService.ts"), CreateBookService_default);
|
|
11554
|
+
await Bun.write(join29(servicesDir, "GetBookService.ts"), GetBookService_default);
|
|
11555
|
+
await Bun.write(join29(servicesDir, "ListBooksService.ts"), ListBooksService_default);
|
|
11556
|
+
await Bun.write(join29(servicesDir, "UpdateBookService.ts"), UpdateBookService_default);
|
|
11557
|
+
await Bun.write(join29(servicesDir, "DeleteBookService.ts"), DeleteBookService_default);
|
|
11558
|
+
const entityPath = join29(process.cwd(), base, "src", "entities", "BookEntity.ts");
|
|
11327
11559
|
await Bun.write(entityPath, BookEntity_default);
|
|
11328
|
-
const migrationsDir =
|
|
11560
|
+
const migrationsDir = join29(process.cwd(), base, "src", "migrations");
|
|
11329
11561
|
const glob = new Glob("Migration*.ts");
|
|
11330
11562
|
for await (const file of glob.scan(migrationsDir)) {
|
|
11331
11563
|
if (file === "migrations.ts")
|
|
@@ -11333,18 +11565,18 @@ class MakeResourceBookCommand {
|
|
|
11333
11565
|
const name = file.replace(/\.ts$/, "");
|
|
11334
11566
|
const version = name.replace("Migration", "");
|
|
11335
11567
|
const content = BookMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
11336
|
-
await Bun.write(
|
|
11568
|
+
await Bun.write(join29(migrationsDir, file), content);
|
|
11337
11569
|
}
|
|
11338
|
-
const repositoryPath =
|
|
11570
|
+
const repositoryPath = join29(process.cwd(), base, "src", "repositories", "BookRepository.ts");
|
|
11339
11571
|
await Bun.write(repositoryPath, BookRepository_default);
|
|
11340
11572
|
}
|
|
11341
11573
|
}
|
|
11342
11574
|
MakeResourceBookCommand = __legacyDecorateClassTS([
|
|
11343
|
-
|
|
11575
|
+
decorator29.command()
|
|
11344
11576
|
], MakeResourceBookCommand);
|
|
11345
11577
|
// src/commands/MakeResourceCalendarEventCommand.ts
|
|
11346
|
-
import { join as
|
|
11347
|
-
import { decorator as
|
|
11578
|
+
import { join as join30 } from "path";
|
|
11579
|
+
import { decorator as decorator30 } from "@ooneex/command";
|
|
11348
11580
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
11349
11581
|
|
|
11350
11582
|
// src/templates/resources/calendar-event/CalendarEventEntity.txt
|
|
@@ -12036,7 +12268,7 @@ class MakeResourceCalendarEventCommand {
|
|
|
12036
12268
|
}
|
|
12037
12269
|
async run() {
|
|
12038
12270
|
const module = "calendar-event";
|
|
12039
|
-
const base =
|
|
12271
|
+
const base = join30("modules", module);
|
|
12040
12272
|
const makeModuleCommand = new MakeModuleCommand;
|
|
12041
12273
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
12042
12274
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -12071,12 +12303,12 @@ class MakeResourceCalendarEventCommand {
|
|
|
12071
12303
|
for (const controller of controllers) {
|
|
12072
12304
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
12073
12305
|
}
|
|
12074
|
-
const controllersDir =
|
|
12075
|
-
await Bun.write(
|
|
12076
|
-
await Bun.write(
|
|
12077
|
-
await Bun.write(
|
|
12078
|
-
await Bun.write(
|
|
12079
|
-
await Bun.write(
|
|
12306
|
+
const controllersDir = join30(process.cwd(), base, "src", "controllers");
|
|
12307
|
+
await Bun.write(join30(controllersDir, "CreateCalendarEventController.ts"), CreateCalendarEventController_default);
|
|
12308
|
+
await Bun.write(join30(controllersDir, "GetCalendarEventController.ts"), GetCalendarEventController_default);
|
|
12309
|
+
await Bun.write(join30(controllersDir, "ListCalendarEventsController.ts"), ListCalendarEventsController_default);
|
|
12310
|
+
await Bun.write(join30(controllersDir, "UpdateCalendarEventController.ts"), UpdateCalendarEventController_default);
|
|
12311
|
+
await Bun.write(join30(controllersDir, "DeleteCalendarEventController.ts"), DeleteCalendarEventController_default);
|
|
12080
12312
|
const makeServiceCommand = new MakeServiceCommand;
|
|
12081
12313
|
const services = [
|
|
12082
12314
|
"CreateCalendarEvent",
|
|
@@ -12088,15 +12320,15 @@ class MakeResourceCalendarEventCommand {
|
|
|
12088
12320
|
for (const name of services) {
|
|
12089
12321
|
await makeServiceCommand.run({ name, module });
|
|
12090
12322
|
}
|
|
12091
|
-
const servicesDir =
|
|
12092
|
-
await Bun.write(
|
|
12093
|
-
await Bun.write(
|
|
12094
|
-
await Bun.write(
|
|
12095
|
-
await Bun.write(
|
|
12096
|
-
await Bun.write(
|
|
12097
|
-
const entityPath =
|
|
12323
|
+
const servicesDir = join30(process.cwd(), base, "src", "services");
|
|
12324
|
+
await Bun.write(join30(servicesDir, "CreateCalendarEventService.ts"), CreateCalendarEventService_default);
|
|
12325
|
+
await Bun.write(join30(servicesDir, "GetCalendarEventService.ts"), GetCalendarEventService_default);
|
|
12326
|
+
await Bun.write(join30(servicesDir, "ListCalendarEventsService.ts"), ListCalendarEventsService_default);
|
|
12327
|
+
await Bun.write(join30(servicesDir, "UpdateCalendarEventService.ts"), UpdateCalendarEventService_default);
|
|
12328
|
+
await Bun.write(join30(servicesDir, "DeleteCalendarEventService.ts"), DeleteCalendarEventService_default);
|
|
12329
|
+
const entityPath = join30(process.cwd(), base, "src", "entities", "CalendarEventEntity.ts");
|
|
12098
12330
|
await Bun.write(entityPath, CalendarEventEntity_default);
|
|
12099
|
-
const migrationsDir =
|
|
12331
|
+
const migrationsDir = join30(process.cwd(), base, "src", "migrations");
|
|
12100
12332
|
const glob = new Glob2("Migration*.ts");
|
|
12101
12333
|
for await (const file of glob.scan(migrationsDir)) {
|
|
12102
12334
|
if (file === "migrations.ts")
|
|
@@ -12104,18 +12336,18 @@ class MakeResourceCalendarEventCommand {
|
|
|
12104
12336
|
const name = file.replace(/\.ts$/, "");
|
|
12105
12337
|
const version = name.replace("Migration", "");
|
|
12106
12338
|
const content = CalendarEventMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
12107
|
-
await Bun.write(
|
|
12339
|
+
await Bun.write(join30(migrationsDir, file), content);
|
|
12108
12340
|
}
|
|
12109
|
-
const repositoryPath =
|
|
12341
|
+
const repositoryPath = join30(process.cwd(), base, "src", "repositories", "CalendarEventRepository.ts");
|
|
12110
12342
|
await Bun.write(repositoryPath, CalendarEventRepository_default);
|
|
12111
12343
|
}
|
|
12112
12344
|
}
|
|
12113
12345
|
MakeResourceCalendarEventCommand = __legacyDecorateClassTS([
|
|
12114
|
-
|
|
12346
|
+
decorator30.command()
|
|
12115
12347
|
], MakeResourceCalendarEventCommand);
|
|
12116
12348
|
// src/commands/MakeResourceCategoryCommand.ts
|
|
12117
|
-
import { join as
|
|
12118
|
-
import { decorator as
|
|
12349
|
+
import { join as join31 } from "path";
|
|
12350
|
+
import { decorator as decorator31 } from "@ooneex/command";
|
|
12119
12351
|
var {Glob: Glob3 } = globalThis.Bun;
|
|
12120
12352
|
|
|
12121
12353
|
// src/templates/resources/category/CategoryEntity.txt
|
|
@@ -12706,7 +12938,7 @@ class MakeResourceCategoryCommand {
|
|
|
12706
12938
|
}
|
|
12707
12939
|
async run() {
|
|
12708
12940
|
const module = "category";
|
|
12709
|
-
const base =
|
|
12941
|
+
const base = join31("modules", module);
|
|
12710
12942
|
const makeModuleCommand = new MakeModuleCommand;
|
|
12711
12943
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
12712
12944
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -12741,26 +12973,26 @@ class MakeResourceCategoryCommand {
|
|
|
12741
12973
|
for (const controller of controllers) {
|
|
12742
12974
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
12743
12975
|
}
|
|
12744
|
-
const controllersDir =
|
|
12745
|
-
await Bun.write(
|
|
12746
|
-
await Bun.write(
|
|
12747
|
-
await Bun.write(
|
|
12748
|
-
await Bun.write(
|
|
12749
|
-
await Bun.write(
|
|
12976
|
+
const controllersDir = join31(process.cwd(), base, "src", "controllers");
|
|
12977
|
+
await Bun.write(join31(controllersDir, "CreateCategoryController.ts"), CreateCategoryController_default);
|
|
12978
|
+
await Bun.write(join31(controllersDir, "GetCategoryController.ts"), GetCategoryController_default);
|
|
12979
|
+
await Bun.write(join31(controllersDir, "ListCategoriesController.ts"), ListCategoriesController_default);
|
|
12980
|
+
await Bun.write(join31(controllersDir, "UpdateCategoryController.ts"), UpdateCategoryController_default);
|
|
12981
|
+
await Bun.write(join31(controllersDir, "DeleteCategoryController.ts"), DeleteCategoryController_default);
|
|
12750
12982
|
const makeServiceCommand = new MakeServiceCommand;
|
|
12751
12983
|
const services = ["CreateCategory", "GetCategory", "ListCategories", "UpdateCategory", "DeleteCategory"];
|
|
12752
12984
|
for (const name of services) {
|
|
12753
12985
|
await makeServiceCommand.run({ name, module });
|
|
12754
12986
|
}
|
|
12755
|
-
const servicesDir =
|
|
12756
|
-
await Bun.write(
|
|
12757
|
-
await Bun.write(
|
|
12758
|
-
await Bun.write(
|
|
12759
|
-
await Bun.write(
|
|
12760
|
-
await Bun.write(
|
|
12761
|
-
const entityPath =
|
|
12987
|
+
const servicesDir = join31(process.cwd(), base, "src", "services");
|
|
12988
|
+
await Bun.write(join31(servicesDir, "CreateCategoryService.ts"), CreateCategoryService_default);
|
|
12989
|
+
await Bun.write(join31(servicesDir, "GetCategoryService.ts"), GetCategoryService_default);
|
|
12990
|
+
await Bun.write(join31(servicesDir, "ListCategoriesService.ts"), ListCategoriesService_default);
|
|
12991
|
+
await Bun.write(join31(servicesDir, "UpdateCategoryService.ts"), UpdateCategoryService_default);
|
|
12992
|
+
await Bun.write(join31(servicesDir, "DeleteCategoryService.ts"), DeleteCategoryService_default);
|
|
12993
|
+
const entityPath = join31(process.cwd(), base, "src", "entities", "CategoryEntity.ts");
|
|
12762
12994
|
await Bun.write(entityPath, CategoryEntity_default);
|
|
12763
|
-
const migrationsDir =
|
|
12995
|
+
const migrationsDir = join31(process.cwd(), base, "src", "migrations");
|
|
12764
12996
|
const glob = new Glob3("Migration*.ts");
|
|
12765
12997
|
for await (const file of glob.scan(migrationsDir)) {
|
|
12766
12998
|
if (file === "migrations.ts")
|
|
@@ -12768,18 +13000,18 @@ class MakeResourceCategoryCommand {
|
|
|
12768
13000
|
const name = file.replace(/\.ts$/, "");
|
|
12769
13001
|
const version = name.replace("Migration", "");
|
|
12770
13002
|
const content = CategoryMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
12771
|
-
await Bun.write(
|
|
13003
|
+
await Bun.write(join31(migrationsDir, file), content);
|
|
12772
13004
|
}
|
|
12773
|
-
const repositoryPath =
|
|
13005
|
+
const repositoryPath = join31(process.cwd(), base, "src", "repositories", "CategoryRepository.ts");
|
|
12774
13006
|
await Bun.write(repositoryPath, CategoryRepository_default);
|
|
12775
13007
|
}
|
|
12776
13008
|
}
|
|
12777
13009
|
MakeResourceCategoryCommand = __legacyDecorateClassTS([
|
|
12778
|
-
|
|
13010
|
+
decorator31.command()
|
|
12779
13011
|
], MakeResourceCategoryCommand);
|
|
12780
13012
|
// src/commands/MakeResourceColorCommand.ts
|
|
12781
|
-
import { join as
|
|
12782
|
-
import { decorator as
|
|
13013
|
+
import { join as join33 } from "path";
|
|
13014
|
+
import { decorator as decorator33 } from "@ooneex/command";
|
|
12783
13015
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
12784
13016
|
|
|
12785
13017
|
// src/templates/resources/color/ColorEntity.txt
|
|
@@ -13571,9 +13803,9 @@ export class UpdateColorService implements IService {
|
|
|
13571
13803
|
`;
|
|
13572
13804
|
|
|
13573
13805
|
// src/commands/MakeSeedCommand.ts
|
|
13574
|
-
import { join as
|
|
13575
|
-
import { decorator as
|
|
13576
|
-
import { TerminalLogger as
|
|
13806
|
+
import { join as join32 } from "path";
|
|
13807
|
+
import { decorator as decorator32 } from "@ooneex/command";
|
|
13808
|
+
import { TerminalLogger as TerminalLogger28 } from "@ooneex/logger";
|
|
13577
13809
|
import { seedCreate } from "@ooneex/seeds";
|
|
13578
13810
|
|
|
13579
13811
|
// src/templates/module/seed.run.txt
|
|
@@ -13612,18 +13844,19 @@ class MakeSeedCommand {
|
|
|
13612
13844
|
if (module) {
|
|
13613
13845
|
await ensureModule(module);
|
|
13614
13846
|
}
|
|
13615
|
-
const base = module ?
|
|
13847
|
+
const base = module ? join32("modules", module) : ".";
|
|
13616
13848
|
const { seedPath: filePath, dataPath } = await seedCreate({
|
|
13617
13849
|
name,
|
|
13618
|
-
seedsDir:
|
|
13619
|
-
testsDir:
|
|
13850
|
+
seedsDir: join32(base, "src", "seeds"),
|
|
13851
|
+
testsDir: join32(base, "tests", "seeds"),
|
|
13852
|
+
module: module ?? ""
|
|
13620
13853
|
});
|
|
13621
|
-
const binSeedRunPath =
|
|
13854
|
+
const binSeedRunPath = join32(process.cwd(), base, "bin", "seed", "run.ts");
|
|
13622
13855
|
const binSeedRunFile = Bun.file(binSeedRunPath);
|
|
13623
13856
|
if (!await binSeedRunFile.exists()) {
|
|
13624
13857
|
await Bun.write(binSeedRunPath, seed_run_default.replace(/{{name}}/g, module ?? ""));
|
|
13625
13858
|
}
|
|
13626
|
-
const logger = new
|
|
13859
|
+
const logger = new TerminalLogger28;
|
|
13627
13860
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
13628
13861
|
showTimestamp: false,
|
|
13629
13862
|
showArrow: false,
|
|
@@ -13637,7 +13870,7 @@ class MakeSeedCommand {
|
|
|
13637
13870
|
}
|
|
13638
13871
|
}
|
|
13639
13872
|
MakeSeedCommand = __legacyDecorateClassTS([
|
|
13640
|
-
|
|
13873
|
+
decorator32.command()
|
|
13641
13874
|
], MakeSeedCommand);
|
|
13642
13875
|
|
|
13643
13876
|
// src/commands/MakeResourceColorCommand.ts
|
|
@@ -13650,7 +13883,7 @@ class MakeResourceColorCommand {
|
|
|
13650
13883
|
}
|
|
13651
13884
|
async run() {
|
|
13652
13885
|
const module = "color";
|
|
13653
|
-
const base =
|
|
13886
|
+
const base = join33("modules", module);
|
|
13654
13887
|
const makeModuleCommand = new MakeModuleCommand;
|
|
13655
13888
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
13656
13889
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -13673,26 +13906,26 @@ class MakeResourceColorCommand {
|
|
|
13673
13906
|
for (const controller of controllers) {
|
|
13674
13907
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
13675
13908
|
}
|
|
13676
|
-
const controllersDir =
|
|
13677
|
-
await Bun.write(
|
|
13678
|
-
await Bun.write(
|
|
13679
|
-
await Bun.write(
|
|
13680
|
-
await Bun.write(
|
|
13681
|
-
await Bun.write(
|
|
13909
|
+
const controllersDir = join33(process.cwd(), base, "src", "controllers");
|
|
13910
|
+
await Bun.write(join33(controllersDir, "CreateColorController.ts"), CreateColorController_default);
|
|
13911
|
+
await Bun.write(join33(controllersDir, "GetColorController.ts"), GetColorController_default);
|
|
13912
|
+
await Bun.write(join33(controllersDir, "ListColorsController.ts"), ListColorsController_default);
|
|
13913
|
+
await Bun.write(join33(controllersDir, "UpdateColorController.ts"), UpdateColorController_default);
|
|
13914
|
+
await Bun.write(join33(controllersDir, "DeleteColorController.ts"), DeleteColorController_default);
|
|
13682
13915
|
const makeServiceCommand = new MakeServiceCommand;
|
|
13683
13916
|
const services = ["CreateColor", "GetColor", "ListColors", "UpdateColor", "DeleteColor"];
|
|
13684
13917
|
for (const name of services) {
|
|
13685
13918
|
await makeServiceCommand.run({ name, module });
|
|
13686
13919
|
}
|
|
13687
|
-
const servicesDir =
|
|
13688
|
-
await Bun.write(
|
|
13689
|
-
await Bun.write(
|
|
13690
|
-
await Bun.write(
|
|
13691
|
-
await Bun.write(
|
|
13692
|
-
await Bun.write(
|
|
13693
|
-
const entityPath =
|
|
13920
|
+
const servicesDir = join33(process.cwd(), base, "src", "services");
|
|
13921
|
+
await Bun.write(join33(servicesDir, "CreateColorService.ts"), CreateColorService_default);
|
|
13922
|
+
await Bun.write(join33(servicesDir, "GetColorService.ts"), GetColorService_default);
|
|
13923
|
+
await Bun.write(join33(servicesDir, "ListColorsService.ts"), ListColorsService_default);
|
|
13924
|
+
await Bun.write(join33(servicesDir, "UpdateColorService.ts"), UpdateColorService_default);
|
|
13925
|
+
await Bun.write(join33(servicesDir, "DeleteColorService.ts"), DeleteColorService_default);
|
|
13926
|
+
const entityPath = join33(process.cwd(), base, "src", "entities", "ColorEntity.ts");
|
|
13694
13927
|
await Bun.write(entityPath, ColorEntity_default);
|
|
13695
|
-
const migrationsDir =
|
|
13928
|
+
const migrationsDir = join33(process.cwd(), base, "src", "migrations");
|
|
13696
13929
|
const glob = new Glob4("Migration*.ts");
|
|
13697
13930
|
for await (const file of glob.scan(migrationsDir)) {
|
|
13698
13931
|
if (file === "migrations.ts")
|
|
@@ -13700,23 +13933,23 @@ class MakeResourceColorCommand {
|
|
|
13700
13933
|
const name = file.replace(/\.ts$/, "");
|
|
13701
13934
|
const version = name.replace("Migration", "");
|
|
13702
13935
|
const content = ColorMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
13703
|
-
await Bun.write(
|
|
13936
|
+
await Bun.write(join33(migrationsDir, file), content);
|
|
13704
13937
|
}
|
|
13705
|
-
const repositoryPath =
|
|
13938
|
+
const repositoryPath = join33(process.cwd(), base, "src", "repositories", "ColorRepository.ts");
|
|
13706
13939
|
await Bun.write(repositoryPath, ColorRepository_default);
|
|
13707
13940
|
const makeSeedCommand = new MakeSeedCommand;
|
|
13708
13941
|
await makeSeedCommand.run({ name: "Color", module });
|
|
13709
|
-
const seedsDir =
|
|
13710
|
-
await Bun.write(
|
|
13711
|
-
await Bun.write(
|
|
13942
|
+
const seedsDir = join33(process.cwd(), base, "src", "seeds");
|
|
13943
|
+
await Bun.write(join33(seedsDir, "ColorSeed.ts"), ColorSeed_default);
|
|
13944
|
+
await Bun.write(join33(seedsDir, "color-seed.yml"), color_seed_default);
|
|
13712
13945
|
}
|
|
13713
13946
|
}
|
|
13714
13947
|
MakeResourceColorCommand = __legacyDecorateClassTS([
|
|
13715
|
-
|
|
13948
|
+
decorator33.command()
|
|
13716
13949
|
], MakeResourceColorCommand);
|
|
13717
13950
|
// src/commands/MakeResourceDiscountCommand.ts
|
|
13718
|
-
import { join as
|
|
13719
|
-
import { decorator as
|
|
13951
|
+
import { join as join34 } from "path";
|
|
13952
|
+
import { decorator as decorator34 } from "@ooneex/command";
|
|
13720
13953
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
13721
13954
|
|
|
13722
13955
|
// src/templates/resources/discount/controllers/CreateDiscountController.txt
|
|
@@ -14359,7 +14592,7 @@ class MakeResourceDiscountCommand {
|
|
|
14359
14592
|
}
|
|
14360
14593
|
async run() {
|
|
14361
14594
|
const module = "discount";
|
|
14362
|
-
const base =
|
|
14595
|
+
const base = join34("modules", module);
|
|
14363
14596
|
const makeModuleCommand = new MakeModuleCommand;
|
|
14364
14597
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
14365
14598
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -14394,26 +14627,26 @@ class MakeResourceDiscountCommand {
|
|
|
14394
14627
|
for (const controller of controllers) {
|
|
14395
14628
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
14396
14629
|
}
|
|
14397
|
-
const controllersDir =
|
|
14398
|
-
await Bun.write(
|
|
14399
|
-
await Bun.write(
|
|
14400
|
-
await Bun.write(
|
|
14401
|
-
await Bun.write(
|
|
14402
|
-
await Bun.write(
|
|
14630
|
+
const controllersDir = join34(process.cwd(), base, "src", "controllers");
|
|
14631
|
+
await Bun.write(join34(controllersDir, "CreateDiscountController.ts"), CreateDiscountController_default);
|
|
14632
|
+
await Bun.write(join34(controllersDir, "GetDiscountController.ts"), GetDiscountController_default);
|
|
14633
|
+
await Bun.write(join34(controllersDir, "ListDiscountsController.ts"), ListDiscountsController_default);
|
|
14634
|
+
await Bun.write(join34(controllersDir, "UpdateDiscountController.ts"), UpdateDiscountController_default);
|
|
14635
|
+
await Bun.write(join34(controllersDir, "DeleteDiscountController.ts"), DeleteDiscountController_default);
|
|
14403
14636
|
const makeServiceCommand = new MakeServiceCommand;
|
|
14404
14637
|
const services = ["CreateDiscount", "GetDiscount", "ListDiscounts", "UpdateDiscount", "DeleteDiscount"];
|
|
14405
14638
|
for (const name of services) {
|
|
14406
14639
|
await makeServiceCommand.run({ name, module });
|
|
14407
14640
|
}
|
|
14408
|
-
const servicesDir =
|
|
14409
|
-
await Bun.write(
|
|
14410
|
-
await Bun.write(
|
|
14411
|
-
await Bun.write(
|
|
14412
|
-
await Bun.write(
|
|
14413
|
-
await Bun.write(
|
|
14414
|
-
const entityPath =
|
|
14641
|
+
const servicesDir = join34(process.cwd(), base, "src", "services");
|
|
14642
|
+
await Bun.write(join34(servicesDir, "CreateDiscountService.ts"), CreateDiscountService_default);
|
|
14643
|
+
await Bun.write(join34(servicesDir, "GetDiscountService.ts"), GetDiscountService_default);
|
|
14644
|
+
await Bun.write(join34(servicesDir, "ListDiscountsService.ts"), ListDiscountsService_default);
|
|
14645
|
+
await Bun.write(join34(servicesDir, "UpdateDiscountService.ts"), UpdateDiscountService_default);
|
|
14646
|
+
await Bun.write(join34(servicesDir, "DeleteDiscountService.ts"), DeleteDiscountService_default);
|
|
14647
|
+
const entityPath = join34(process.cwd(), base, "src", "entities", "DiscountEntity.ts");
|
|
14415
14648
|
await Bun.write(entityPath, DiscountEntity_default);
|
|
14416
|
-
const migrationsDir =
|
|
14649
|
+
const migrationsDir = join34(process.cwd(), base, "src", "migrations");
|
|
14417
14650
|
const glob = new Glob5("Migration*.ts");
|
|
14418
14651
|
for await (const file of glob.scan(migrationsDir)) {
|
|
14419
14652
|
if (file === "migrations.ts")
|
|
@@ -14421,18 +14654,18 @@ class MakeResourceDiscountCommand {
|
|
|
14421
14654
|
const name = file.replace(/\.ts$/, "");
|
|
14422
14655
|
const version = name.replace("Migration", "");
|
|
14423
14656
|
const content = DiscountMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
14424
|
-
await Bun.write(
|
|
14657
|
+
await Bun.write(join34(migrationsDir, file), content);
|
|
14425
14658
|
}
|
|
14426
|
-
const repositoryPath =
|
|
14659
|
+
const repositoryPath = join34(process.cwd(), base, "src", "repositories", "DiscountRepository.ts");
|
|
14427
14660
|
await Bun.write(repositoryPath, DiscountRepository_default);
|
|
14428
14661
|
}
|
|
14429
14662
|
}
|
|
14430
14663
|
MakeResourceDiscountCommand = __legacyDecorateClassTS([
|
|
14431
|
-
|
|
14664
|
+
decorator34.command()
|
|
14432
14665
|
], MakeResourceDiscountCommand);
|
|
14433
14666
|
// src/commands/MakeResourceFolderCommand.ts
|
|
14434
|
-
import { join as
|
|
14435
|
-
import { decorator as
|
|
14667
|
+
import { join as join35 } from "path";
|
|
14668
|
+
import { decorator as decorator35 } from "@ooneex/command";
|
|
14436
14669
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
14437
14670
|
|
|
14438
14671
|
// src/templates/resources/folder/controllers/CreateFolderController.txt
|
|
@@ -15059,7 +15292,7 @@ class MakeResourceFolderCommand {
|
|
|
15059
15292
|
}
|
|
15060
15293
|
async run() {
|
|
15061
15294
|
const module = "folder";
|
|
15062
|
-
const base =
|
|
15295
|
+
const base = join35("modules", module);
|
|
15063
15296
|
const makeModuleCommand = new MakeModuleCommand;
|
|
15064
15297
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
15065
15298
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -15094,26 +15327,26 @@ class MakeResourceFolderCommand {
|
|
|
15094
15327
|
for (const controller of controllers) {
|
|
15095
15328
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
15096
15329
|
}
|
|
15097
|
-
const controllersDir =
|
|
15098
|
-
await Bun.write(
|
|
15099
|
-
await Bun.write(
|
|
15100
|
-
await Bun.write(
|
|
15101
|
-
await Bun.write(
|
|
15102
|
-
await Bun.write(
|
|
15330
|
+
const controllersDir = join35(process.cwd(), base, "src", "controllers");
|
|
15331
|
+
await Bun.write(join35(controllersDir, "CreateFolderController.ts"), CreateFolderController_default);
|
|
15332
|
+
await Bun.write(join35(controllersDir, "GetFolderController.ts"), GetFolderController_default);
|
|
15333
|
+
await Bun.write(join35(controllersDir, "ListFoldersController.ts"), ListFoldersController_default);
|
|
15334
|
+
await Bun.write(join35(controllersDir, "UpdateFolderController.ts"), UpdateFolderController_default);
|
|
15335
|
+
await Bun.write(join35(controllersDir, "DeleteFolderController.ts"), DeleteFolderController_default);
|
|
15103
15336
|
const makeServiceCommand = new MakeServiceCommand;
|
|
15104
15337
|
const services = ["CreateFolder", "GetFolder", "ListFolders", "UpdateFolder", "DeleteFolder"];
|
|
15105
15338
|
for (const name of services) {
|
|
15106
15339
|
await makeServiceCommand.run({ name, module });
|
|
15107
15340
|
}
|
|
15108
|
-
const servicesDir =
|
|
15109
|
-
await Bun.write(
|
|
15110
|
-
await Bun.write(
|
|
15111
|
-
await Bun.write(
|
|
15112
|
-
await Bun.write(
|
|
15113
|
-
await Bun.write(
|
|
15114
|
-
const entityPath =
|
|
15341
|
+
const servicesDir = join35(process.cwd(), base, "src", "services");
|
|
15342
|
+
await Bun.write(join35(servicesDir, "CreateFolderService.ts"), CreateFolderService_default);
|
|
15343
|
+
await Bun.write(join35(servicesDir, "GetFolderService.ts"), GetFolderService_default);
|
|
15344
|
+
await Bun.write(join35(servicesDir, "ListFoldersService.ts"), ListFoldersService_default);
|
|
15345
|
+
await Bun.write(join35(servicesDir, "UpdateFolderService.ts"), UpdateFolderService_default);
|
|
15346
|
+
await Bun.write(join35(servicesDir, "DeleteFolderService.ts"), DeleteFolderService_default);
|
|
15347
|
+
const entityPath = join35(process.cwd(), base, "src", "entities", "FolderEntity.ts");
|
|
15115
15348
|
await Bun.write(entityPath, FolderEntity_default);
|
|
15116
|
-
const migrationsDir =
|
|
15349
|
+
const migrationsDir = join35(process.cwd(), base, "src", "migrations");
|
|
15117
15350
|
const glob = new Glob6("Migration*.ts");
|
|
15118
15351
|
for await (const file of glob.scan(migrationsDir)) {
|
|
15119
15352
|
if (file === "migrations.ts")
|
|
@@ -15121,18 +15354,18 @@ class MakeResourceFolderCommand {
|
|
|
15121
15354
|
const name = file.replace(/\.ts$/, "");
|
|
15122
15355
|
const version = name.replace("Migration", "");
|
|
15123
15356
|
const content = FolderMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
15124
|
-
await Bun.write(
|
|
15357
|
+
await Bun.write(join35(migrationsDir, file), content);
|
|
15125
15358
|
}
|
|
15126
|
-
const repositoryPath =
|
|
15359
|
+
const repositoryPath = join35(process.cwd(), base, "src", "repositories", "FolderRepository.ts");
|
|
15127
15360
|
await Bun.write(repositoryPath, FolderRepository_default);
|
|
15128
15361
|
}
|
|
15129
15362
|
}
|
|
15130
15363
|
MakeResourceFolderCommand = __legacyDecorateClassTS([
|
|
15131
|
-
|
|
15364
|
+
decorator35.command()
|
|
15132
15365
|
], MakeResourceFolderCommand);
|
|
15133
15366
|
// src/commands/MakeResourceImageCommand.ts
|
|
15134
|
-
import { join as
|
|
15135
|
-
import { decorator as
|
|
15367
|
+
import { join as join36 } from "path";
|
|
15368
|
+
import { decorator as decorator36 } from "@ooneex/command";
|
|
15136
15369
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
15137
15370
|
|
|
15138
15371
|
// src/templates/resources/image/controllers/CreateImageController.txt
|
|
@@ -15798,7 +16031,7 @@ class MakeResourceImageCommand {
|
|
|
15798
16031
|
}
|
|
15799
16032
|
async run() {
|
|
15800
16033
|
const module = "image";
|
|
15801
|
-
const base =
|
|
16034
|
+
const base = join36("modules", module);
|
|
15802
16035
|
const makeModuleCommand = new MakeModuleCommand;
|
|
15803
16036
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
15804
16037
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -15833,26 +16066,26 @@ class MakeResourceImageCommand {
|
|
|
15833
16066
|
for (const controller of controllers) {
|
|
15834
16067
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
15835
16068
|
}
|
|
15836
|
-
const controllersDir =
|
|
15837
|
-
await Bun.write(
|
|
15838
|
-
await Bun.write(
|
|
15839
|
-
await Bun.write(
|
|
15840
|
-
await Bun.write(
|
|
15841
|
-
await Bun.write(
|
|
16069
|
+
const controllersDir = join36(process.cwd(), base, "src", "controllers");
|
|
16070
|
+
await Bun.write(join36(controllersDir, "CreateImageController.ts"), CreateImageController_default);
|
|
16071
|
+
await Bun.write(join36(controllersDir, "GetImageController.ts"), GetImageController_default);
|
|
16072
|
+
await Bun.write(join36(controllersDir, "ListImagesController.ts"), ListImagesController_default);
|
|
16073
|
+
await Bun.write(join36(controllersDir, "UpdateImageController.ts"), UpdateImageController_default);
|
|
16074
|
+
await Bun.write(join36(controllersDir, "DeleteImageController.ts"), DeleteImageController_default);
|
|
15842
16075
|
const makeServiceCommand = new MakeServiceCommand;
|
|
15843
16076
|
const services = ["CreateImage", "GetImage", "ListImages", "UpdateImage", "DeleteImage"];
|
|
15844
16077
|
for (const name of services) {
|
|
15845
16078
|
await makeServiceCommand.run({ name, module });
|
|
15846
16079
|
}
|
|
15847
|
-
const servicesDir =
|
|
15848
|
-
await Bun.write(
|
|
15849
|
-
await Bun.write(
|
|
15850
|
-
await Bun.write(
|
|
15851
|
-
await Bun.write(
|
|
15852
|
-
await Bun.write(
|
|
15853
|
-
const entityPath =
|
|
16080
|
+
const servicesDir = join36(process.cwd(), base, "src", "services");
|
|
16081
|
+
await Bun.write(join36(servicesDir, "CreateImageService.ts"), CreateImageService_default);
|
|
16082
|
+
await Bun.write(join36(servicesDir, "GetImageService.ts"), GetImageService_default);
|
|
16083
|
+
await Bun.write(join36(servicesDir, "ListImagesService.ts"), ListImagesService_default);
|
|
16084
|
+
await Bun.write(join36(servicesDir, "UpdateImageService.ts"), UpdateImageService_default);
|
|
16085
|
+
await Bun.write(join36(servicesDir, "DeleteImageService.ts"), DeleteImageService_default);
|
|
16086
|
+
const entityPath = join36(process.cwd(), base, "src", "entities", "ImageEntity.ts");
|
|
15854
16087
|
await Bun.write(entityPath, ImageEntity_default);
|
|
15855
|
-
const migrationsDir =
|
|
16088
|
+
const migrationsDir = join36(process.cwd(), base, "src", "migrations");
|
|
15856
16089
|
const glob = new Glob7("Migration*.ts");
|
|
15857
16090
|
for await (const file of glob.scan(migrationsDir)) {
|
|
15858
16091
|
if (file === "migrations.ts")
|
|
@@ -15860,18 +16093,18 @@ class MakeResourceImageCommand {
|
|
|
15860
16093
|
const name = file.replace(/\.ts$/, "");
|
|
15861
16094
|
const version = name.replace("Migration", "");
|
|
15862
16095
|
const content = ImageMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
15863
|
-
await Bun.write(
|
|
16096
|
+
await Bun.write(join36(migrationsDir, file), content);
|
|
15864
16097
|
}
|
|
15865
|
-
const repositoryPath =
|
|
16098
|
+
const repositoryPath = join36(process.cwd(), base, "src", "repositories", "ImageRepository.ts");
|
|
15866
16099
|
await Bun.write(repositoryPath, ImageRepository_default);
|
|
15867
16100
|
}
|
|
15868
16101
|
}
|
|
15869
16102
|
MakeResourceImageCommand = __legacyDecorateClassTS([
|
|
15870
|
-
|
|
16103
|
+
decorator36.command()
|
|
15871
16104
|
], MakeResourceImageCommand);
|
|
15872
16105
|
// src/commands/MakeResourceNoteCommand.ts
|
|
15873
|
-
import { join as
|
|
15874
|
-
import { decorator as
|
|
16106
|
+
import { join as join37 } from "path";
|
|
16107
|
+
import { decorator as decorator37 } from "@ooneex/command";
|
|
15875
16108
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15876
16109
|
|
|
15877
16110
|
// src/templates/resources/note/controllers/CreateNoteController.txt
|
|
@@ -16576,7 +16809,7 @@ class MakeResourceNoteCommand {
|
|
|
16576
16809
|
}
|
|
16577
16810
|
async run() {
|
|
16578
16811
|
const module = "note";
|
|
16579
|
-
const base =
|
|
16812
|
+
const base = join37("modules", module);
|
|
16580
16813
|
const makeModuleCommand = new MakeModuleCommand;
|
|
16581
16814
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
16582
16815
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -16611,26 +16844,26 @@ class MakeResourceNoteCommand {
|
|
|
16611
16844
|
for (const controller of controllers) {
|
|
16612
16845
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
16613
16846
|
}
|
|
16614
|
-
const controllersDir =
|
|
16615
|
-
await Bun.write(
|
|
16616
|
-
await Bun.write(
|
|
16617
|
-
await Bun.write(
|
|
16618
|
-
await Bun.write(
|
|
16619
|
-
await Bun.write(
|
|
16847
|
+
const controllersDir = join37(process.cwd(), base, "src", "controllers");
|
|
16848
|
+
await Bun.write(join37(controllersDir, "CreateNoteController.ts"), CreateNoteController_default);
|
|
16849
|
+
await Bun.write(join37(controllersDir, "GetNoteController.ts"), GetNoteController_default);
|
|
16850
|
+
await Bun.write(join37(controllersDir, "ListNotesController.ts"), ListNotesController_default);
|
|
16851
|
+
await Bun.write(join37(controllersDir, "UpdateNoteController.ts"), UpdateNoteController_default);
|
|
16852
|
+
await Bun.write(join37(controllersDir, "DeleteNoteController.ts"), DeleteNoteController_default);
|
|
16620
16853
|
const makeServiceCommand = new MakeServiceCommand;
|
|
16621
16854
|
const services = ["CreateNote", "GetNote", "ListNotes", "UpdateNote", "DeleteNote"];
|
|
16622
16855
|
for (const name of services) {
|
|
16623
16856
|
await makeServiceCommand.run({ name, module });
|
|
16624
16857
|
}
|
|
16625
|
-
const servicesDir =
|
|
16626
|
-
await Bun.write(
|
|
16627
|
-
await Bun.write(
|
|
16628
|
-
await Bun.write(
|
|
16629
|
-
await Bun.write(
|
|
16630
|
-
await Bun.write(
|
|
16631
|
-
const entityPath =
|
|
16858
|
+
const servicesDir = join37(process.cwd(), base, "src", "services");
|
|
16859
|
+
await Bun.write(join37(servicesDir, "CreateNoteService.ts"), CreateNoteService_default);
|
|
16860
|
+
await Bun.write(join37(servicesDir, "GetNoteService.ts"), GetNoteService_default);
|
|
16861
|
+
await Bun.write(join37(servicesDir, "ListNotesService.ts"), ListNotesService_default);
|
|
16862
|
+
await Bun.write(join37(servicesDir, "UpdateNoteService.ts"), UpdateNoteService_default);
|
|
16863
|
+
await Bun.write(join37(servicesDir, "DeleteNoteService.ts"), DeleteNoteService_default);
|
|
16864
|
+
const entityPath = join37(process.cwd(), base, "src", "entities", "NoteEntity.ts");
|
|
16632
16865
|
await Bun.write(entityPath, NoteEntity_default);
|
|
16633
|
-
const migrationsDir =
|
|
16866
|
+
const migrationsDir = join37(process.cwd(), base, "src", "migrations");
|
|
16634
16867
|
const glob = new Glob8("Migration*.ts");
|
|
16635
16868
|
for await (const file of glob.scan(migrationsDir)) {
|
|
16636
16869
|
if (file === "migrations.ts")
|
|
@@ -16638,18 +16871,18 @@ class MakeResourceNoteCommand {
|
|
|
16638
16871
|
const name = file.replace(/\.ts$/, "");
|
|
16639
16872
|
const version = name.replace("Migration", "");
|
|
16640
16873
|
const content = NoteMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
16641
|
-
await Bun.write(
|
|
16874
|
+
await Bun.write(join37(migrationsDir, file), content);
|
|
16642
16875
|
}
|
|
16643
|
-
const repositoryPath =
|
|
16876
|
+
const repositoryPath = join37(process.cwd(), base, "src", "repositories", "NoteRepository.ts");
|
|
16644
16877
|
await Bun.write(repositoryPath, NoteRepository_default);
|
|
16645
16878
|
}
|
|
16646
16879
|
}
|
|
16647
16880
|
MakeResourceNoteCommand = __legacyDecorateClassTS([
|
|
16648
|
-
|
|
16881
|
+
decorator37.command()
|
|
16649
16882
|
], MakeResourceNoteCommand);
|
|
16650
16883
|
// src/commands/MakeResourceStatusCommand.ts
|
|
16651
|
-
import { join as
|
|
16652
|
-
import { decorator as
|
|
16884
|
+
import { join as join38 } from "path";
|
|
16885
|
+
import { decorator as decorator38 } from "@ooneex/command";
|
|
16653
16886
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
16654
16887
|
|
|
16655
16888
|
// src/templates/resources/status/controllers/CreateStatusController.txt
|
|
@@ -17510,7 +17743,7 @@ class MakeResourceStatusCommand {
|
|
|
17510
17743
|
}
|
|
17511
17744
|
async run() {
|
|
17512
17745
|
const module = "status";
|
|
17513
|
-
const base =
|
|
17746
|
+
const base = join38("modules", module);
|
|
17514
17747
|
const makeModuleCommand = new MakeModuleCommand;
|
|
17515
17748
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
17516
17749
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -17545,26 +17778,26 @@ class MakeResourceStatusCommand {
|
|
|
17545
17778
|
for (const controller of controllers) {
|
|
17546
17779
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
17547
17780
|
}
|
|
17548
|
-
const controllersDir =
|
|
17549
|
-
await Bun.write(
|
|
17550
|
-
await Bun.write(
|
|
17551
|
-
await Bun.write(
|
|
17552
|
-
await Bun.write(
|
|
17553
|
-
await Bun.write(
|
|
17781
|
+
const controllersDir = join38(process.cwd(), base, "src", "controllers");
|
|
17782
|
+
await Bun.write(join38(controllersDir, "CreateStatusController.ts"), CreateStatusController_default);
|
|
17783
|
+
await Bun.write(join38(controllersDir, "GetStatusController.ts"), GetStatusController_default);
|
|
17784
|
+
await Bun.write(join38(controllersDir, "ListStatusesController.ts"), ListStatusesController_default);
|
|
17785
|
+
await Bun.write(join38(controllersDir, "UpdateStatusController.ts"), UpdateStatusController_default);
|
|
17786
|
+
await Bun.write(join38(controllersDir, "DeleteStatusController.ts"), DeleteStatusController_default);
|
|
17554
17787
|
const makeServiceCommand = new MakeServiceCommand;
|
|
17555
17788
|
const services = ["CreateStatus", "GetStatus", "ListStatuses", "UpdateStatus", "DeleteStatus"];
|
|
17556
17789
|
for (const name of services) {
|
|
17557
17790
|
await makeServiceCommand.run({ name, module });
|
|
17558
17791
|
}
|
|
17559
|
-
const servicesDir =
|
|
17560
|
-
await Bun.write(
|
|
17561
|
-
await Bun.write(
|
|
17562
|
-
await Bun.write(
|
|
17563
|
-
await Bun.write(
|
|
17564
|
-
await Bun.write(
|
|
17565
|
-
const entityPath =
|
|
17792
|
+
const servicesDir = join38(process.cwd(), base, "src", "services");
|
|
17793
|
+
await Bun.write(join38(servicesDir, "CreateStatusService.ts"), CreateStatusService_default);
|
|
17794
|
+
await Bun.write(join38(servicesDir, "GetStatusService.ts"), GetStatusService_default);
|
|
17795
|
+
await Bun.write(join38(servicesDir, "ListStatusesService.ts"), ListStatusesService_default);
|
|
17796
|
+
await Bun.write(join38(servicesDir, "UpdateStatusService.ts"), UpdateStatusService_default);
|
|
17797
|
+
await Bun.write(join38(servicesDir, "DeleteStatusService.ts"), DeleteStatusService_default);
|
|
17798
|
+
const entityPath = join38(process.cwd(), base, "src", "entities", "StatusEntity.ts");
|
|
17566
17799
|
await Bun.write(entityPath, StatusEntity_default);
|
|
17567
|
-
const migrationsDir =
|
|
17800
|
+
const migrationsDir = join38(process.cwd(), base, "src", "migrations");
|
|
17568
17801
|
const glob = new Glob9("Migration*.ts");
|
|
17569
17802
|
for await (const file of glob.scan(migrationsDir)) {
|
|
17570
17803
|
if (file === "migrations.ts")
|
|
@@ -17572,23 +17805,23 @@ class MakeResourceStatusCommand {
|
|
|
17572
17805
|
const name = file.replace(/\.ts$/, "");
|
|
17573
17806
|
const version = name.replace("Migration", "");
|
|
17574
17807
|
const content = StatusMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
17575
|
-
await Bun.write(
|
|
17808
|
+
await Bun.write(join38(migrationsDir, file), content);
|
|
17576
17809
|
}
|
|
17577
|
-
const repositoryPath =
|
|
17810
|
+
const repositoryPath = join38(process.cwd(), base, "src", "repositories", "StatusRepository.ts");
|
|
17578
17811
|
await Bun.write(repositoryPath, StatusRepository_default);
|
|
17579
17812
|
const makeSeedCommand = new MakeSeedCommand;
|
|
17580
17813
|
await makeSeedCommand.run({ name: "Status", module });
|
|
17581
|
-
const seedsDir =
|
|
17582
|
-
await Bun.write(
|
|
17583
|
-
await Bun.write(
|
|
17814
|
+
const seedsDir = join38(process.cwd(), base, "src", "seeds");
|
|
17815
|
+
await Bun.write(join38(seedsDir, "StatusSeed.ts"), StatusSeed_default);
|
|
17816
|
+
await Bun.write(join38(seedsDir, "status-seed.yml"), status_seed_default);
|
|
17584
17817
|
}
|
|
17585
17818
|
}
|
|
17586
17819
|
MakeResourceStatusCommand = __legacyDecorateClassTS([
|
|
17587
|
-
|
|
17820
|
+
decorator38.command()
|
|
17588
17821
|
], MakeResourceStatusCommand);
|
|
17589
17822
|
// src/commands/MakeResourceTagCommand.ts
|
|
17590
|
-
import { join as
|
|
17591
|
-
import { decorator as
|
|
17823
|
+
import { join as join39 } from "path";
|
|
17824
|
+
import { decorator as decorator39 } from "@ooneex/command";
|
|
17592
17825
|
var {Glob: Glob10 } = globalThis.Bun;
|
|
17593
17826
|
|
|
17594
17827
|
// src/templates/resources/tag/controllers/CreateTagController.txt
|
|
@@ -18179,7 +18412,7 @@ class MakeResourceTagCommand {
|
|
|
18179
18412
|
}
|
|
18180
18413
|
async run() {
|
|
18181
18414
|
const module = "tag";
|
|
18182
|
-
const base =
|
|
18415
|
+
const base = join39("modules", module);
|
|
18183
18416
|
const makeModuleCommand = new MakeModuleCommand;
|
|
18184
18417
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
18185
18418
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -18214,26 +18447,26 @@ class MakeResourceTagCommand {
|
|
|
18214
18447
|
for (const controller of controllers) {
|
|
18215
18448
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
18216
18449
|
}
|
|
18217
|
-
const controllersDir =
|
|
18218
|
-
await Bun.write(
|
|
18219
|
-
await Bun.write(
|
|
18220
|
-
await Bun.write(
|
|
18221
|
-
await Bun.write(
|
|
18222
|
-
await Bun.write(
|
|
18450
|
+
const controllersDir = join39(process.cwd(), base, "src", "controllers");
|
|
18451
|
+
await Bun.write(join39(controllersDir, "CreateTagController.ts"), CreateTagController_default);
|
|
18452
|
+
await Bun.write(join39(controllersDir, "GetTagController.ts"), GetTagController_default);
|
|
18453
|
+
await Bun.write(join39(controllersDir, "ListTagsController.ts"), ListTagsController_default);
|
|
18454
|
+
await Bun.write(join39(controllersDir, "UpdateTagController.ts"), UpdateTagController_default);
|
|
18455
|
+
await Bun.write(join39(controllersDir, "DeleteTagController.ts"), DeleteTagController_default);
|
|
18223
18456
|
const makeServiceCommand = new MakeServiceCommand;
|
|
18224
18457
|
const services = ["CreateTag", "GetTag", "ListTags", "UpdateTag", "DeleteTag"];
|
|
18225
18458
|
for (const name of services) {
|
|
18226
18459
|
await makeServiceCommand.run({ name, module });
|
|
18227
18460
|
}
|
|
18228
|
-
const servicesDir =
|
|
18229
|
-
await Bun.write(
|
|
18230
|
-
await Bun.write(
|
|
18231
|
-
await Bun.write(
|
|
18232
|
-
await Bun.write(
|
|
18233
|
-
await Bun.write(
|
|
18234
|
-
const entityPath =
|
|
18461
|
+
const servicesDir = join39(process.cwd(), base, "src", "services");
|
|
18462
|
+
await Bun.write(join39(servicesDir, "CreateTagService.ts"), CreateTagService_default);
|
|
18463
|
+
await Bun.write(join39(servicesDir, "GetTagService.ts"), GetTagService_default);
|
|
18464
|
+
await Bun.write(join39(servicesDir, "ListTagsService.ts"), ListTagsService_default);
|
|
18465
|
+
await Bun.write(join39(servicesDir, "UpdateTagService.ts"), UpdateTagService_default);
|
|
18466
|
+
await Bun.write(join39(servicesDir, "DeleteTagService.ts"), DeleteTagService_default);
|
|
18467
|
+
const entityPath = join39(process.cwd(), base, "src", "entities", "TagEntity.ts");
|
|
18235
18468
|
await Bun.write(entityPath, TagEntity_default);
|
|
18236
|
-
const migrationsDir =
|
|
18469
|
+
const migrationsDir = join39(process.cwd(), base, "src", "migrations");
|
|
18237
18470
|
const glob = new Glob10("Migration*.ts");
|
|
18238
18471
|
for await (const file of glob.scan(migrationsDir)) {
|
|
18239
18472
|
if (file === "migrations.ts")
|
|
@@ -18241,18 +18474,18 @@ class MakeResourceTagCommand {
|
|
|
18241
18474
|
const name = file.replace(/\.ts$/, "");
|
|
18242
18475
|
const version = name.replace("Migration", "");
|
|
18243
18476
|
const content = TagMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
18244
|
-
await Bun.write(
|
|
18477
|
+
await Bun.write(join39(migrationsDir, file), content);
|
|
18245
18478
|
}
|
|
18246
|
-
const repositoryPath =
|
|
18479
|
+
const repositoryPath = join39(process.cwd(), base, "src", "repositories", "TagRepository.ts");
|
|
18247
18480
|
await Bun.write(repositoryPath, TagRepository_default);
|
|
18248
18481
|
}
|
|
18249
18482
|
}
|
|
18250
18483
|
MakeResourceTagCommand = __legacyDecorateClassTS([
|
|
18251
|
-
|
|
18484
|
+
decorator39.command()
|
|
18252
18485
|
], MakeResourceTagCommand);
|
|
18253
18486
|
// src/commands/MakeResourceTaskCommand.ts
|
|
18254
|
-
import { join as
|
|
18255
|
-
import { decorator as
|
|
18487
|
+
import { join as join40 } from "path";
|
|
18488
|
+
import { decorator as decorator40 } from "@ooneex/command";
|
|
18256
18489
|
var {Glob: Glob11 } = globalThis.Bun;
|
|
18257
18490
|
|
|
18258
18491
|
// src/templates/resources/task/controllers/CreateTaskController.txt
|
|
@@ -18925,7 +19158,7 @@ class MakeResourceTaskCommand {
|
|
|
18925
19158
|
}
|
|
18926
19159
|
async run() {
|
|
18927
19160
|
const module = "task";
|
|
18928
|
-
const base =
|
|
19161
|
+
const base = join40("modules", module);
|
|
18929
19162
|
const makeModuleCommand = new MakeModuleCommand;
|
|
18930
19163
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
18931
19164
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -18960,26 +19193,26 @@ class MakeResourceTaskCommand {
|
|
|
18960
19193
|
for (const controller of controllers) {
|
|
18961
19194
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
18962
19195
|
}
|
|
18963
|
-
const controllersDir =
|
|
18964
|
-
await Bun.write(
|
|
18965
|
-
await Bun.write(
|
|
18966
|
-
await Bun.write(
|
|
18967
|
-
await Bun.write(
|
|
18968
|
-
await Bun.write(
|
|
19196
|
+
const controllersDir = join40(process.cwd(), base, "src", "controllers");
|
|
19197
|
+
await Bun.write(join40(controllersDir, "CreateTaskController.ts"), CreateTaskController_default);
|
|
19198
|
+
await Bun.write(join40(controllersDir, "GetTaskController.ts"), GetTaskController_default);
|
|
19199
|
+
await Bun.write(join40(controllersDir, "ListTasksController.ts"), ListTasksController_default);
|
|
19200
|
+
await Bun.write(join40(controllersDir, "UpdateTaskController.ts"), UpdateTaskController_default);
|
|
19201
|
+
await Bun.write(join40(controllersDir, "DeleteTaskController.ts"), DeleteTaskController_default);
|
|
18969
19202
|
const makeServiceCommand = new MakeServiceCommand;
|
|
18970
19203
|
const services = ["CreateTask", "GetTask", "ListTasks", "UpdateTask", "DeleteTask"];
|
|
18971
19204
|
for (const name of services) {
|
|
18972
19205
|
await makeServiceCommand.run({ name, module });
|
|
18973
19206
|
}
|
|
18974
|
-
const servicesDir =
|
|
18975
|
-
await Bun.write(
|
|
18976
|
-
await Bun.write(
|
|
18977
|
-
await Bun.write(
|
|
18978
|
-
await Bun.write(
|
|
18979
|
-
await Bun.write(
|
|
18980
|
-
const entityPath =
|
|
19207
|
+
const servicesDir = join40(process.cwd(), base, "src", "services");
|
|
19208
|
+
await Bun.write(join40(servicesDir, "CreateTaskService.ts"), CreateTaskService_default);
|
|
19209
|
+
await Bun.write(join40(servicesDir, "GetTaskService.ts"), GetTaskService_default);
|
|
19210
|
+
await Bun.write(join40(servicesDir, "ListTasksService.ts"), ListTasksService_default);
|
|
19211
|
+
await Bun.write(join40(servicesDir, "UpdateTaskService.ts"), UpdateTaskService_default);
|
|
19212
|
+
await Bun.write(join40(servicesDir, "DeleteTaskService.ts"), DeleteTaskService_default);
|
|
19213
|
+
const entityPath = join40(process.cwd(), base, "src", "entities", "TaskEntity.ts");
|
|
18981
19214
|
await Bun.write(entityPath, TaskEntity_default);
|
|
18982
|
-
const migrationsDir =
|
|
19215
|
+
const migrationsDir = join40(process.cwd(), base, "src", "migrations");
|
|
18983
19216
|
const glob = new Glob11("Migration*.ts");
|
|
18984
19217
|
for await (const file of glob.scan(migrationsDir)) {
|
|
18985
19218
|
if (file === "migrations.ts")
|
|
@@ -18987,18 +19220,18 @@ class MakeResourceTaskCommand {
|
|
|
18987
19220
|
const name = file.replace(/\.ts$/, "");
|
|
18988
19221
|
const version = name.replace("Migration", "");
|
|
18989
19222
|
const content = TaskMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
18990
|
-
await Bun.write(
|
|
19223
|
+
await Bun.write(join40(migrationsDir, file), content);
|
|
18991
19224
|
}
|
|
18992
|
-
const repositoryPath =
|
|
19225
|
+
const repositoryPath = join40(process.cwd(), base, "src", "repositories", "TaskRepository.ts");
|
|
18993
19226
|
await Bun.write(repositoryPath, TaskRepository_default);
|
|
18994
19227
|
}
|
|
18995
19228
|
}
|
|
18996
19229
|
MakeResourceTaskCommand = __legacyDecorateClassTS([
|
|
18997
|
-
|
|
19230
|
+
decorator40.command()
|
|
18998
19231
|
], MakeResourceTaskCommand);
|
|
18999
19232
|
// src/commands/MakeResourceTopicCommand.ts
|
|
19000
|
-
import { join as
|
|
19001
|
-
import { decorator as
|
|
19233
|
+
import { join as join41 } from "path";
|
|
19234
|
+
import { decorator as decorator41 } from "@ooneex/command";
|
|
19002
19235
|
var {Glob: Glob12 } = globalThis.Bun;
|
|
19003
19236
|
|
|
19004
19237
|
// src/templates/resources/topic/controllers/CreateTopicController.txt
|
|
@@ -19589,7 +19822,7 @@ class MakeResourceTopicCommand {
|
|
|
19589
19822
|
}
|
|
19590
19823
|
async run() {
|
|
19591
19824
|
const module = "topic";
|
|
19592
|
-
const base =
|
|
19825
|
+
const base = join41("modules", module);
|
|
19593
19826
|
const makeModuleCommand = new MakeModuleCommand;
|
|
19594
19827
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
19595
19828
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -19624,26 +19857,26 @@ class MakeResourceTopicCommand {
|
|
|
19624
19857
|
for (const controller of controllers) {
|
|
19625
19858
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
19626
19859
|
}
|
|
19627
|
-
const controllersDir =
|
|
19628
|
-
await Bun.write(
|
|
19629
|
-
await Bun.write(
|
|
19630
|
-
await Bun.write(
|
|
19631
|
-
await Bun.write(
|
|
19632
|
-
await Bun.write(
|
|
19860
|
+
const controllersDir = join41(process.cwd(), base, "src", "controllers");
|
|
19861
|
+
await Bun.write(join41(controllersDir, "CreateTopicController.ts"), CreateTopicController_default);
|
|
19862
|
+
await Bun.write(join41(controllersDir, "GetTopicController.ts"), GetTopicController_default);
|
|
19863
|
+
await Bun.write(join41(controllersDir, "ListTopicsController.ts"), ListTopicsController_default);
|
|
19864
|
+
await Bun.write(join41(controllersDir, "UpdateTopicController.ts"), UpdateTopicController_default);
|
|
19865
|
+
await Bun.write(join41(controllersDir, "DeleteTopicController.ts"), DeleteTopicController_default);
|
|
19633
19866
|
const makeServiceCommand = new MakeServiceCommand;
|
|
19634
19867
|
const services = ["CreateTopic", "GetTopic", "ListTopics", "UpdateTopic", "DeleteTopic"];
|
|
19635
19868
|
for (const name of services) {
|
|
19636
19869
|
await makeServiceCommand.run({ name, module });
|
|
19637
19870
|
}
|
|
19638
|
-
const servicesDir =
|
|
19639
|
-
await Bun.write(
|
|
19640
|
-
await Bun.write(
|
|
19641
|
-
await Bun.write(
|
|
19642
|
-
await Bun.write(
|
|
19643
|
-
await Bun.write(
|
|
19644
|
-
const entityPath =
|
|
19871
|
+
const servicesDir = join41(process.cwd(), base, "src", "services");
|
|
19872
|
+
await Bun.write(join41(servicesDir, "CreateTopicService.ts"), CreateTopicService_default);
|
|
19873
|
+
await Bun.write(join41(servicesDir, "GetTopicService.ts"), GetTopicService_default);
|
|
19874
|
+
await Bun.write(join41(servicesDir, "ListTopicsService.ts"), ListTopicsService_default);
|
|
19875
|
+
await Bun.write(join41(servicesDir, "UpdateTopicService.ts"), UpdateTopicService_default);
|
|
19876
|
+
await Bun.write(join41(servicesDir, "DeleteTopicService.ts"), DeleteTopicService_default);
|
|
19877
|
+
const entityPath = join41(process.cwd(), base, "src", "entities", "TopicEntity.ts");
|
|
19645
19878
|
await Bun.write(entityPath, TopicEntity_default);
|
|
19646
|
-
const migrationsDir =
|
|
19879
|
+
const migrationsDir = join41(process.cwd(), base, "src", "migrations");
|
|
19647
19880
|
const glob = new Glob12("Migration*.ts");
|
|
19648
19881
|
for await (const file of glob.scan(migrationsDir)) {
|
|
19649
19882
|
if (file === "migrations.ts")
|
|
@@ -19651,18 +19884,18 @@ class MakeResourceTopicCommand {
|
|
|
19651
19884
|
const name = file.replace(/\.ts$/, "");
|
|
19652
19885
|
const version = name.replace("Migration", "");
|
|
19653
19886
|
const content = TopicMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
19654
|
-
await Bun.write(
|
|
19887
|
+
await Bun.write(join41(migrationsDir, file), content);
|
|
19655
19888
|
}
|
|
19656
|
-
const repositoryPath =
|
|
19889
|
+
const repositoryPath = join41(process.cwd(), base, "src", "repositories", "TopicRepository.ts");
|
|
19657
19890
|
await Bun.write(repositoryPath, TopicRepository_default);
|
|
19658
19891
|
}
|
|
19659
19892
|
}
|
|
19660
19893
|
MakeResourceTopicCommand = __legacyDecorateClassTS([
|
|
19661
|
-
|
|
19894
|
+
decorator41.command()
|
|
19662
19895
|
], MakeResourceTopicCommand);
|
|
19663
19896
|
// src/commands/MakeResourceUserCommand.ts
|
|
19664
|
-
import { join as
|
|
19665
|
-
import { decorator as
|
|
19897
|
+
import { join as join42 } from "path";
|
|
19898
|
+
import { decorator as decorator42 } from "@ooneex/command";
|
|
19666
19899
|
var {Glob: Glob13 } = globalThis.Bun;
|
|
19667
19900
|
|
|
19668
19901
|
// src/templates/resources/user/controllers/BanUserController.txt
|
|
@@ -20483,7 +20716,7 @@ class MakeResourceUserCommand {
|
|
|
20483
20716
|
}
|
|
20484
20717
|
async run() {
|
|
20485
20718
|
const module = "user";
|
|
20486
|
-
const base =
|
|
20719
|
+
const base = join42("modules", module);
|
|
20487
20720
|
const makeModuleCommand = new MakeModuleCommand;
|
|
20488
20721
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
20489
20722
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -20534,14 +20767,14 @@ class MakeResourceUserCommand {
|
|
|
20534
20767
|
for (const controller of controllers) {
|
|
20535
20768
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
20536
20769
|
}
|
|
20537
|
-
const controllersDir =
|
|
20538
|
-
await Bun.write(
|
|
20539
|
-
await Bun.write(
|
|
20540
|
-
await Bun.write(
|
|
20541
|
-
await Bun.write(
|
|
20542
|
-
await Bun.write(
|
|
20543
|
-
await Bun.write(
|
|
20544
|
-
await Bun.write(
|
|
20770
|
+
const controllersDir = join42(process.cwd(), base, "src", "controllers");
|
|
20771
|
+
await Bun.write(join42(controllersDir, "BanUserController.ts"), BanUserController_default);
|
|
20772
|
+
await Bun.write(join42(controllersDir, "LockUserController.ts"), LockUserController_default);
|
|
20773
|
+
await Bun.write(join42(controllersDir, "SignOutController.ts"), SignOutController_default);
|
|
20774
|
+
await Bun.write(join42(controllersDir, "UpdateUserProfileController.ts"), UpdateUserProfileController_default);
|
|
20775
|
+
await Bun.write(join42(controllersDir, "UpdateUserProfileImageController.ts"), UpdateUserProfileImageController_default);
|
|
20776
|
+
await Bun.write(join42(controllersDir, "DeleteUserProfileImageController.ts"), DeleteUserProfileImageController_default);
|
|
20777
|
+
await Bun.write(join42(controllersDir, "UpdateUserRolesController.ts"), UpdateUserRolesController_default);
|
|
20545
20778
|
const makeServiceCommand = new MakeServiceCommand;
|
|
20546
20779
|
const services = [
|
|
20547
20780
|
"BanUser",
|
|
@@ -20555,17 +20788,17 @@ class MakeResourceUserCommand {
|
|
|
20555
20788
|
for (const name of services) {
|
|
20556
20789
|
await makeServiceCommand.run({ name, module });
|
|
20557
20790
|
}
|
|
20558
|
-
const servicesDir =
|
|
20559
|
-
await Bun.write(
|
|
20560
|
-
await Bun.write(
|
|
20561
|
-
await Bun.write(
|
|
20562
|
-
await Bun.write(
|
|
20563
|
-
await Bun.write(
|
|
20564
|
-
await Bun.write(
|
|
20565
|
-
await Bun.write(
|
|
20566
|
-
const entityPath =
|
|
20791
|
+
const servicesDir = join42(process.cwd(), base, "src", "services");
|
|
20792
|
+
await Bun.write(join42(servicesDir, "BanUserService.ts"), BanUserService_default);
|
|
20793
|
+
await Bun.write(join42(servicesDir, "LockUserService.ts"), LockUserService_default);
|
|
20794
|
+
await Bun.write(join42(servicesDir, "SignOutService.ts"), SignOutService_default);
|
|
20795
|
+
await Bun.write(join42(servicesDir, "UpdateUserProfileService.ts"), UpdateUserProfileService_default);
|
|
20796
|
+
await Bun.write(join42(servicesDir, "UpdateUserProfileImageService.ts"), UpdateUserProfileImageService_default);
|
|
20797
|
+
await Bun.write(join42(servicesDir, "DeleteUserProfileImageService.ts"), DeleteUserProfileImageService_default);
|
|
20798
|
+
await Bun.write(join42(servicesDir, "UpdateUserRolesService.ts"), UpdateUserRolesService_default);
|
|
20799
|
+
const entityPath = join42(process.cwd(), base, "src", "entities", "UserEntity.ts");
|
|
20567
20800
|
await Bun.write(entityPath, UserEntity_default);
|
|
20568
|
-
const migrationsDir =
|
|
20801
|
+
const migrationsDir = join42(process.cwd(), base, "src", "migrations");
|
|
20569
20802
|
const glob = new Glob13("Migration*.ts");
|
|
20570
20803
|
for await (const file of glob.scan(migrationsDir)) {
|
|
20571
20804
|
if (file === "migrations.ts")
|
|
@@ -20573,18 +20806,18 @@ class MakeResourceUserCommand {
|
|
|
20573
20806
|
const name = file.replace(/\.ts$/, "");
|
|
20574
20807
|
const version = name.replace("Migration", "");
|
|
20575
20808
|
const content = UserMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
20576
|
-
await Bun.write(
|
|
20809
|
+
await Bun.write(join42(migrationsDir, file), content);
|
|
20577
20810
|
}
|
|
20578
|
-
const repositoryPath =
|
|
20811
|
+
const repositoryPath = join42(process.cwd(), base, "src", "repositories", "UserRepository.ts");
|
|
20579
20812
|
await Bun.write(repositoryPath, UserRepository_default);
|
|
20580
20813
|
}
|
|
20581
20814
|
}
|
|
20582
20815
|
MakeResourceUserCommand = __legacyDecorateClassTS([
|
|
20583
|
-
|
|
20816
|
+
decorator42.command()
|
|
20584
20817
|
], MakeResourceUserCommand);
|
|
20585
20818
|
// src/commands/MakeResourceVideoCommand.ts
|
|
20586
|
-
import { join as
|
|
20587
|
-
import { decorator as
|
|
20819
|
+
import { join as join43 } from "path";
|
|
20820
|
+
import { decorator as decorator43 } from "@ooneex/command";
|
|
20588
20821
|
var {Glob: Glob14 } = globalThis.Bun;
|
|
20589
20822
|
|
|
20590
20823
|
// src/templates/resources/video/controllers/CreateVideoController.txt
|
|
@@ -21263,7 +21496,7 @@ class MakeResourceVideoCommand {
|
|
|
21263
21496
|
}
|
|
21264
21497
|
async run() {
|
|
21265
21498
|
const module = "video";
|
|
21266
|
-
const base =
|
|
21499
|
+
const base = join43("modules", module);
|
|
21267
21500
|
const makeModuleCommand = new MakeModuleCommand;
|
|
21268
21501
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
21269
21502
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -21298,26 +21531,26 @@ class MakeResourceVideoCommand {
|
|
|
21298
21531
|
for (const controller of controllers) {
|
|
21299
21532
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
21300
21533
|
}
|
|
21301
|
-
const controllersDir =
|
|
21302
|
-
await Bun.write(
|
|
21303
|
-
await Bun.write(
|
|
21304
|
-
await Bun.write(
|
|
21305
|
-
await Bun.write(
|
|
21306
|
-
await Bun.write(
|
|
21534
|
+
const controllersDir = join43(process.cwd(), base, "src", "controllers");
|
|
21535
|
+
await Bun.write(join43(controllersDir, "CreateVideoController.ts"), CreateVideoController_default);
|
|
21536
|
+
await Bun.write(join43(controllersDir, "GetVideoController.ts"), GetVideoController_default);
|
|
21537
|
+
await Bun.write(join43(controllersDir, "ListVideosController.ts"), ListVideosController_default);
|
|
21538
|
+
await Bun.write(join43(controllersDir, "UpdateVideoController.ts"), UpdateVideoController_default);
|
|
21539
|
+
await Bun.write(join43(controllersDir, "DeleteVideoController.ts"), DeleteVideoController_default);
|
|
21307
21540
|
const makeServiceCommand = new MakeServiceCommand;
|
|
21308
21541
|
const services = ["CreateVideo", "GetVideo", "ListVideos", "UpdateVideo", "DeleteVideo"];
|
|
21309
21542
|
for (const name of services) {
|
|
21310
21543
|
await makeServiceCommand.run({ name, module });
|
|
21311
21544
|
}
|
|
21312
|
-
const servicesDir =
|
|
21313
|
-
await Bun.write(
|
|
21314
|
-
await Bun.write(
|
|
21315
|
-
await Bun.write(
|
|
21316
|
-
await Bun.write(
|
|
21317
|
-
await Bun.write(
|
|
21318
|
-
const entityPath =
|
|
21545
|
+
const servicesDir = join43(process.cwd(), base, "src", "services");
|
|
21546
|
+
await Bun.write(join43(servicesDir, "CreateVideoService.ts"), CreateVideoService_default);
|
|
21547
|
+
await Bun.write(join43(servicesDir, "GetVideoService.ts"), GetVideoService_default);
|
|
21548
|
+
await Bun.write(join43(servicesDir, "ListVideosService.ts"), ListVideosService_default);
|
|
21549
|
+
await Bun.write(join43(servicesDir, "UpdateVideoService.ts"), UpdateVideoService_default);
|
|
21550
|
+
await Bun.write(join43(servicesDir, "DeleteVideoService.ts"), DeleteVideoService_default);
|
|
21551
|
+
const entityPath = join43(process.cwd(), base, "src", "entities", "VideoEntity.ts");
|
|
21319
21552
|
await Bun.write(entityPath, VideoEntity_default);
|
|
21320
|
-
const migrationsDir =
|
|
21553
|
+
const migrationsDir = join43(process.cwd(), base, "src", "migrations");
|
|
21321
21554
|
const glob = new Glob14("Migration*.ts");
|
|
21322
21555
|
for await (const file of glob.scan(migrationsDir)) {
|
|
21323
21556
|
if (file === "migrations.ts")
|
|
@@ -21325,24 +21558,24 @@ class MakeResourceVideoCommand {
|
|
|
21325
21558
|
const name = file.replace(/\.ts$/, "");
|
|
21326
21559
|
const version = name.replace("Migration", "");
|
|
21327
21560
|
const content = VideoMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
21328
|
-
await Bun.write(
|
|
21561
|
+
await Bun.write(join43(migrationsDir, file), content);
|
|
21329
21562
|
}
|
|
21330
|
-
const repositoryPath =
|
|
21563
|
+
const repositoryPath = join43(process.cwd(), base, "src", "repositories", "VideoRepository.ts");
|
|
21331
21564
|
await Bun.write(repositoryPath, VideoRepository_default);
|
|
21332
21565
|
}
|
|
21333
21566
|
}
|
|
21334
21567
|
MakeResourceVideoCommand = __legacyDecorateClassTS([
|
|
21335
|
-
|
|
21568
|
+
decorator43.command()
|
|
21336
21569
|
], MakeResourceVideoCommand);
|
|
21337
21570
|
// src/commands/MakeStorageCommand.ts
|
|
21338
|
-
import { join as
|
|
21339
|
-
import { decorator as
|
|
21340
|
-
import { TerminalLogger as
|
|
21571
|
+
import { join as join44 } from "path";
|
|
21572
|
+
import { decorator as decorator44 } from "@ooneex/command";
|
|
21573
|
+
import { TerminalLogger as TerminalLogger29 } from "@ooneex/logger";
|
|
21341
21574
|
import { toPascalCase as toPascalCase16, toSnakeCase as toSnakeCase3 } from "@ooneex/utils";
|
|
21342
21575
|
|
|
21343
21576
|
// src/templates/storage.test.txt
|
|
21344
21577
|
var storage_test_default = `import { describe, expect, test } from "bun:test";
|
|
21345
|
-
import { {{NAME}}StorageAdapter } from "
|
|
21578
|
+
import { {{NAME}}StorageAdapter } from "@module/{{MODULE}}/storage/{{NAME}}StorageAdapter";
|
|
21346
21579
|
|
|
21347
21580
|
describe("{{NAME}}StorageAdapter", () => {
|
|
21348
21581
|
test("should have class name ending with 'StorageAdapter'", () => {
|
|
@@ -21437,28 +21670,28 @@ class MakeStorageCommand {
|
|
|
21437
21670
|
if (module) {
|
|
21438
21671
|
await ensureModule(module);
|
|
21439
21672
|
}
|
|
21440
|
-
const base = module ?
|
|
21441
|
-
const storageLocalDir =
|
|
21442
|
-
const storageDir =
|
|
21443
|
-
const filePath =
|
|
21673
|
+
const base = module ? join44("modules", module) : ".";
|
|
21674
|
+
const storageLocalDir = join44(base, "src", "storage");
|
|
21675
|
+
const storageDir = join44(process.cwd(), storageLocalDir);
|
|
21676
|
+
const filePath = join44(storageDir, `${name}Storage.ts`);
|
|
21444
21677
|
await Bun.write(filePath, content);
|
|
21445
|
-
const testContent = storage_test_default.replace(/{{NAME}}/g, name);
|
|
21446
|
-
const testsLocalDir =
|
|
21447
|
-
const testsDir =
|
|
21448
|
-
const testFilePath =
|
|
21678
|
+
const testContent = storage_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
21679
|
+
const testsLocalDir = join44(base, "tests", "storage");
|
|
21680
|
+
const testsDir = join44(process.cwd(), testsLocalDir);
|
|
21681
|
+
const testFilePath = join44(testsDir, `${name}Storage.spec.ts`);
|
|
21449
21682
|
await Bun.write(testFilePath, testContent);
|
|
21450
|
-
const logger = new
|
|
21451
|
-
logger.success(`${
|
|
21683
|
+
const logger = new TerminalLogger29;
|
|
21684
|
+
logger.success(`${join44(storageLocalDir, name)}Storage.ts created successfully`, undefined, {
|
|
21452
21685
|
showTimestamp: false,
|
|
21453
21686
|
showArrow: false,
|
|
21454
21687
|
useSymbol: true
|
|
21455
21688
|
});
|
|
21456
|
-
logger.success(`${
|
|
21689
|
+
logger.success(`${join44(testsLocalDir, name)}Storage.spec.ts created successfully`, undefined, {
|
|
21457
21690
|
showTimestamp: false,
|
|
21458
21691
|
showArrow: false,
|
|
21459
21692
|
useSymbol: true
|
|
21460
21693
|
});
|
|
21461
|
-
const packageJsonPath =
|
|
21694
|
+
const packageJsonPath = join44(process.cwd(), "package.json");
|
|
21462
21695
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
21463
21696
|
const deps = packageJson.dependencies ?? {};
|
|
21464
21697
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -21473,17 +21706,17 @@ class MakeStorageCommand {
|
|
|
21473
21706
|
}
|
|
21474
21707
|
}
|
|
21475
21708
|
MakeStorageCommand = __legacyDecorateClassTS([
|
|
21476
|
-
|
|
21709
|
+
decorator44.command()
|
|
21477
21710
|
], MakeStorageCommand);
|
|
21478
21711
|
// src/commands/MakeVectorDatabaseCommand.ts
|
|
21479
|
-
import { join as
|
|
21480
|
-
import { decorator as
|
|
21481
|
-
import { TerminalLogger as
|
|
21712
|
+
import { join as join45 } from "path";
|
|
21713
|
+
import { decorator as decorator45 } from "@ooneex/command";
|
|
21714
|
+
import { TerminalLogger as TerminalLogger30 } from "@ooneex/logger";
|
|
21482
21715
|
import { toPascalCase as toPascalCase17 } from "@ooneex/utils";
|
|
21483
21716
|
|
|
21484
21717
|
// src/templates/vector-database.test.txt
|
|
21485
21718
|
var vector_database_test_default = `import { describe, expect, test } from "bun:test";
|
|
21486
|
-
import { {{NAME}}VectorDatabase } from "
|
|
21719
|
+
import { {{NAME}}VectorDatabase } from "@module/{{MODULE}}/databases/{{NAME}}VectorDatabase";
|
|
21487
21720
|
|
|
21488
21721
|
describe("{{NAME}}VectorDatabase", () => {
|
|
21489
21722
|
test("should have class name ending with 'VectorDatabase'", () => {
|
|
@@ -21552,28 +21785,28 @@ class MakeVectorDatabaseCommand {
|
|
|
21552
21785
|
if (module) {
|
|
21553
21786
|
await ensureModule(module);
|
|
21554
21787
|
}
|
|
21555
|
-
const base = module ?
|
|
21556
|
-
const vectorDatabaseLocalDir =
|
|
21557
|
-
const vectorDatabaseDir =
|
|
21558
|
-
const filePath =
|
|
21788
|
+
const base = module ? join45("modules", module) : ".";
|
|
21789
|
+
const vectorDatabaseLocalDir = join45(base, "src", "databases");
|
|
21790
|
+
const vectorDatabaseDir = join45(process.cwd(), vectorDatabaseLocalDir);
|
|
21791
|
+
const filePath = join45(vectorDatabaseDir, `${name}VectorDatabase.ts`);
|
|
21559
21792
|
await Bun.write(filePath, content);
|
|
21560
|
-
const testContent = vector_database_test_default.replace(/{{NAME}}/g, name);
|
|
21561
|
-
const testsLocalDir =
|
|
21562
|
-
const testsDir =
|
|
21563
|
-
const testFilePath =
|
|
21793
|
+
const testContent = vector_database_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
21794
|
+
const testsLocalDir = join45(base, "tests", "databases");
|
|
21795
|
+
const testsDir = join45(process.cwd(), testsLocalDir);
|
|
21796
|
+
const testFilePath = join45(testsDir, `${name}VectorDatabase.spec.ts`);
|
|
21564
21797
|
await Bun.write(testFilePath, testContent);
|
|
21565
|
-
const logger = new
|
|
21566
|
-
logger.success(`${
|
|
21798
|
+
const logger = new TerminalLogger30;
|
|
21799
|
+
logger.success(`${join45(vectorDatabaseLocalDir, name)}VectorDatabase.ts created successfully`, undefined, {
|
|
21567
21800
|
showTimestamp: false,
|
|
21568
21801
|
showArrow: false,
|
|
21569
21802
|
useSymbol: true
|
|
21570
21803
|
});
|
|
21571
|
-
logger.success(`${
|
|
21804
|
+
logger.success(`${join45(testsLocalDir, name)}VectorDatabase.spec.ts created successfully`, undefined, {
|
|
21572
21805
|
showTimestamp: false,
|
|
21573
21806
|
showArrow: false,
|
|
21574
21807
|
useSymbol: true
|
|
21575
21808
|
});
|
|
21576
|
-
const packageJsonPath =
|
|
21809
|
+
const packageJsonPath = join45(process.cwd(), "package.json");
|
|
21577
21810
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
21578
21811
|
const deps = packageJson.dependencies ?? {};
|
|
21579
21812
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -21588,13 +21821,13 @@ class MakeVectorDatabaseCommand {
|
|
|
21588
21821
|
}
|
|
21589
21822
|
}
|
|
21590
21823
|
MakeVectorDatabaseCommand = __legacyDecorateClassTS([
|
|
21591
|
-
|
|
21824
|
+
decorator45.command()
|
|
21592
21825
|
], MakeVectorDatabaseCommand);
|
|
21593
21826
|
// src/commands/MigrationUpCommand.ts
|
|
21594
21827
|
import { existsSync as existsSync2 } from "fs";
|
|
21595
|
-
import { join as
|
|
21596
|
-
import { decorator as
|
|
21597
|
-
import { TerminalLogger as
|
|
21828
|
+
import { join as join46 } from "path";
|
|
21829
|
+
import { decorator as decorator46 } from "@ooneex/command";
|
|
21830
|
+
import { TerminalLogger as TerminalLogger31 } from "@ooneex/logger";
|
|
21598
21831
|
class MigrationUpCommand {
|
|
21599
21832
|
getName() {
|
|
21600
21833
|
return "migration:up";
|
|
@@ -21603,8 +21836,8 @@ class MigrationUpCommand {
|
|
|
21603
21836
|
return "Run migrations for all modules";
|
|
21604
21837
|
}
|
|
21605
21838
|
async run(options) {
|
|
21606
|
-
const logger = new
|
|
21607
|
-
const modulesDir =
|
|
21839
|
+
const logger = new TerminalLogger31;
|
|
21840
|
+
const modulesDir = join46(process.cwd(), "modules");
|
|
21608
21841
|
if (!existsSync2(modulesDir)) {
|
|
21609
21842
|
logger.warn("No modules with migrations found", undefined, {
|
|
21610
21843
|
showTimestamp: false,
|
|
@@ -21617,10 +21850,10 @@ class MigrationUpCommand {
|
|
|
21617
21850
|
const modules = [];
|
|
21618
21851
|
for await (const match of glob.scan({ cwd: modulesDir, onlyFiles: true })) {
|
|
21619
21852
|
const entry = match.replace("/package.json", "");
|
|
21620
|
-
const moduleDir =
|
|
21621
|
-
const migrationUpFile = Bun.file(
|
|
21853
|
+
const moduleDir = join46(modulesDir, entry);
|
|
21854
|
+
const migrationUpFile = Bun.file(join46(moduleDir, "bin", "migration", "up.ts"));
|
|
21622
21855
|
if (await migrationUpFile.exists()) {
|
|
21623
|
-
const packageJson = await Bun.file(
|
|
21856
|
+
const packageJson = await Bun.file(join46(modulesDir, match)).json();
|
|
21624
21857
|
modules.push({ name: packageJson.name ?? entry, dir: moduleDir });
|
|
21625
21858
|
}
|
|
21626
21859
|
}
|
|
@@ -21633,7 +21866,7 @@ class MigrationUpCommand {
|
|
|
21633
21866
|
return;
|
|
21634
21867
|
}
|
|
21635
21868
|
for (const { name, dir } of modules) {
|
|
21636
|
-
const migrationUpPath =
|
|
21869
|
+
const migrationUpPath = join46(dir, "bin", "migration", "up.ts");
|
|
21637
21870
|
logger.info(`Running migrations for ${name}...`, undefined, {
|
|
21638
21871
|
showTimestamp: false,
|
|
21639
21872
|
showArrow: false,
|
|
@@ -21666,13 +21899,140 @@ class MigrationUpCommand {
|
|
|
21666
21899
|
}
|
|
21667
21900
|
}
|
|
21668
21901
|
MigrationUpCommand = __legacyDecorateClassTS([
|
|
21669
|
-
|
|
21902
|
+
decorator46.command()
|
|
21670
21903
|
], MigrationUpCommand);
|
|
21904
|
+
// src/commands/RemoveModuleCommand.ts
|
|
21905
|
+
import { rmdir } from "fs/promises";
|
|
21906
|
+
import { join as join47 } from "path";
|
|
21907
|
+
import { decorator as decorator47 } from "@ooneex/command";
|
|
21908
|
+
import { TerminalLogger as TerminalLogger32 } from "@ooneex/logger";
|
|
21909
|
+
import { toKebabCase as toKebabCase5, toPascalCase as toPascalCase18 } from "@ooneex/utils";
|
|
21910
|
+
class RemoveModuleCommand {
|
|
21911
|
+
getName() {
|
|
21912
|
+
return "remove:module";
|
|
21913
|
+
}
|
|
21914
|
+
getDescription() {
|
|
21915
|
+
return "Remove an existing module";
|
|
21916
|
+
}
|
|
21917
|
+
async removeFromAppModule(appModulePath, pascalName, kebabName) {
|
|
21918
|
+
if (!await Bun.file(appModulePath).exists())
|
|
21919
|
+
return;
|
|
21920
|
+
let content = await Bun.file(appModulePath).text();
|
|
21921
|
+
const moduleName = `${pascalName}Module`;
|
|
21922
|
+
const importPath = `@module/${kebabName}/${moduleName}`;
|
|
21923
|
+
const importRegex = new RegExp(`import\\s*\\{\\s*${moduleName}\\s*\\}\\s*from\\s*"${importPath.replace(/\//g, "\\/")}";\\s*\\n`, "g");
|
|
21924
|
+
content = content.replace(importRegex, "");
|
|
21925
|
+
const fields = ["controllers", "middlewares", "cronJobs", "events"];
|
|
21926
|
+
for (const field of fields) {
|
|
21927
|
+
const spread = `...${moduleName}.${field}`;
|
|
21928
|
+
content = content.replace(new RegExp(`,\\s*${spread.replace(/\./g, "\\.")}`, "g"), "");
|
|
21929
|
+
content = content.replace(new RegExp(`${spread.replace(/\./g, "\\.")}\\s*,\\s*`, "g"), "");
|
|
21930
|
+
content = content.replace(new RegExp(`${spread.replace(/\./g, "\\.")}`, "g"), "");
|
|
21931
|
+
}
|
|
21932
|
+
await Bun.write(appModulePath, content);
|
|
21933
|
+
}
|
|
21934
|
+
async removeFromSharedModule(sharedModulePath, pascalName, kebabName) {
|
|
21935
|
+
if (!await Bun.file(sharedModulePath).exists())
|
|
21936
|
+
return;
|
|
21937
|
+
let content = await Bun.file(sharedModulePath).text();
|
|
21938
|
+
const moduleName = `${pascalName}Module`;
|
|
21939
|
+
const importPath = `@module/${kebabName}/${moduleName}`;
|
|
21940
|
+
const importRegex = new RegExp(`import\\s*\\{\\s*${moduleName}\\s*\\}\\s*from\\s*"${importPath.replace(/\//g, "\\/")}";\\s*\\n`, "g");
|
|
21941
|
+
content = content.replace(importRegex, "");
|
|
21942
|
+
const spread = `...${moduleName}.entities`;
|
|
21943
|
+
content = content.replace(new RegExp(`,\\s*${spread.replace(/\./g, "\\.")}`, "g"), "");
|
|
21944
|
+
content = content.replace(new RegExp(`${spread.replace(/\./g, "\\.")}\\s*,\\s*`, "g"), "");
|
|
21945
|
+
content = content.replace(new RegExp(`${spread.replace(/\./g, "\\.")}`, "g"), "");
|
|
21946
|
+
await Bun.write(sharedModulePath, content);
|
|
21947
|
+
}
|
|
21948
|
+
async removeModuleScope(commitlintPath, kebabName) {
|
|
21949
|
+
if (!await Bun.file(commitlintPath).exists())
|
|
21950
|
+
return;
|
|
21951
|
+
let content = await Bun.file(commitlintPath).text();
|
|
21952
|
+
const scope = `"${kebabName}"`;
|
|
21953
|
+
content = content.replace(new RegExp(`\\s*${scope.replace(/"/g, "\\\"")}\\s*,?`, "g"), "");
|
|
21954
|
+
content = content.replace(/,\s*,/g, ",");
|
|
21955
|
+
content = content.replace(/,(\s*\])/g, "$1");
|
|
21956
|
+
await Bun.write(commitlintPath, content);
|
|
21957
|
+
}
|
|
21958
|
+
async removePathAlias(tsconfigPath, kebabName) {
|
|
21959
|
+
if (!await Bun.file(tsconfigPath).exists())
|
|
21960
|
+
return;
|
|
21961
|
+
const content = await Bun.file(tsconfigPath).text();
|
|
21962
|
+
const tsconfig = JSON.parse(content);
|
|
21963
|
+
if (tsconfig.compilerOptions?.paths) {
|
|
21964
|
+
delete tsconfig.compilerOptions.paths[`@module/${kebabName}/*`];
|
|
21965
|
+
}
|
|
21966
|
+
await Bun.write(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}
|
|
21967
|
+
`);
|
|
21968
|
+
}
|
|
21969
|
+
async run(options) {
|
|
21970
|
+
const { cwd = process.cwd(), silent = false } = options;
|
|
21971
|
+
let { name } = options;
|
|
21972
|
+
if (!name) {
|
|
21973
|
+
name = await askName({ message: "Enter module name to remove" });
|
|
21974
|
+
}
|
|
21975
|
+
const pascalName = toPascalCase18(name).replace(/Module$/, "");
|
|
21976
|
+
const kebabName = toKebabCase5(pascalName);
|
|
21977
|
+
if (kebabName === "app" || kebabName === "shared") {
|
|
21978
|
+
if (!silent) {
|
|
21979
|
+
const logger = new TerminalLogger32;
|
|
21980
|
+
logger.error(`Cannot remove the "${kebabName}" module`, undefined, {
|
|
21981
|
+
showTimestamp: false,
|
|
21982
|
+
showArrow: false,
|
|
21983
|
+
useSymbol: true
|
|
21984
|
+
});
|
|
21985
|
+
}
|
|
21986
|
+
return;
|
|
21987
|
+
}
|
|
21988
|
+
const moduleDir = join47(cwd, "modules", kebabName);
|
|
21989
|
+
const moduleDirExists = await Bun.file(join47(moduleDir, "package.json")).exists();
|
|
21990
|
+
if (!moduleDirExists) {
|
|
21991
|
+
if (!silent) {
|
|
21992
|
+
const logger = new TerminalLogger32;
|
|
21993
|
+
logger.error(`Module "${kebabName}" does not exist`, undefined, {
|
|
21994
|
+
showTimestamp: false,
|
|
21995
|
+
showArrow: false,
|
|
21996
|
+
useSymbol: true
|
|
21997
|
+
});
|
|
21998
|
+
}
|
|
21999
|
+
return;
|
|
22000
|
+
}
|
|
22001
|
+
if (!silent) {
|
|
22002
|
+
const confirmed = await askConfirm({
|
|
22003
|
+
message: `Are you sure you want to remove the "${kebabName}" module?`,
|
|
22004
|
+
initial: false
|
|
22005
|
+
});
|
|
22006
|
+
if (!confirmed)
|
|
22007
|
+
return;
|
|
22008
|
+
}
|
|
22009
|
+
const appModulePath = join47(cwd, "modules", "app", "src", "AppModule.ts");
|
|
22010
|
+
await this.removeFromAppModule(appModulePath, pascalName, kebabName);
|
|
22011
|
+
const sharedModulePath = join47(cwd, "modules", "shared", "src", "SharedModule.ts");
|
|
22012
|
+
await this.removeFromSharedModule(sharedModulePath, pascalName, kebabName);
|
|
22013
|
+
const appTsconfigPath = join47(cwd, "tsconfig.json");
|
|
22014
|
+
await this.removePathAlias(appTsconfigPath, kebabName);
|
|
22015
|
+
const commitlintPath = join47(cwd, ".commitlintrc.ts");
|
|
22016
|
+
await this.removeModuleScope(commitlintPath, kebabName);
|
|
22017
|
+
await rmdir(moduleDir, { recursive: true });
|
|
22018
|
+
if (!silent) {
|
|
22019
|
+
const logger = new TerminalLogger32;
|
|
22020
|
+
logger.success(`modules/${kebabName} removed successfully`, undefined, {
|
|
22021
|
+
showTimestamp: false,
|
|
22022
|
+
showArrow: false,
|
|
22023
|
+
useSymbol: true
|
|
22024
|
+
});
|
|
22025
|
+
}
|
|
22026
|
+
}
|
|
22027
|
+
}
|
|
22028
|
+
RemoveModuleCommand = __legacyDecorateClassTS([
|
|
22029
|
+
decorator47.command()
|
|
22030
|
+
], RemoveModuleCommand);
|
|
21671
22031
|
// src/commands/SeedRunCommand.ts
|
|
21672
22032
|
import { existsSync as existsSync3 } from "fs";
|
|
21673
|
-
import { join as
|
|
21674
|
-
import { decorator as
|
|
21675
|
-
import { TerminalLogger as
|
|
22033
|
+
import { join as join48 } from "path";
|
|
22034
|
+
import { decorator as decorator48 } from "@ooneex/command";
|
|
22035
|
+
import { TerminalLogger as TerminalLogger33 } from "@ooneex/logger";
|
|
21676
22036
|
class SeedRunCommand {
|
|
21677
22037
|
getName() {
|
|
21678
22038
|
return "seed:run";
|
|
@@ -21681,8 +22041,8 @@ class SeedRunCommand {
|
|
|
21681
22041
|
return "Run seeds for all modules";
|
|
21682
22042
|
}
|
|
21683
22043
|
async run(options) {
|
|
21684
|
-
const logger = new
|
|
21685
|
-
const modulesDir =
|
|
22044
|
+
const logger = new TerminalLogger33;
|
|
22045
|
+
const modulesDir = join48(process.cwd(), "modules");
|
|
21686
22046
|
if (!existsSync3(modulesDir)) {
|
|
21687
22047
|
logger.warn("No modules with seeds found", undefined, {
|
|
21688
22048
|
showTimestamp: false,
|
|
@@ -21695,10 +22055,10 @@ class SeedRunCommand {
|
|
|
21695
22055
|
const modules = [];
|
|
21696
22056
|
for await (const match of glob.scan({ cwd: modulesDir, onlyFiles: true })) {
|
|
21697
22057
|
const entry = match.replace("/package.json", "");
|
|
21698
|
-
const moduleDir =
|
|
21699
|
-
const seedRunFile = Bun.file(
|
|
22058
|
+
const moduleDir = join48(modulesDir, entry);
|
|
22059
|
+
const seedRunFile = Bun.file(join48(moduleDir, "bin", "seed", "run.ts"));
|
|
21700
22060
|
if (await seedRunFile.exists()) {
|
|
21701
|
-
const packageJson = await Bun.file(
|
|
22061
|
+
const packageJson = await Bun.file(join48(modulesDir, match)).json();
|
|
21702
22062
|
modules.push({ name: packageJson.name ?? entry, dir: moduleDir });
|
|
21703
22063
|
}
|
|
21704
22064
|
}
|
|
@@ -21711,7 +22071,7 @@ class SeedRunCommand {
|
|
|
21711
22071
|
return;
|
|
21712
22072
|
}
|
|
21713
22073
|
for (const { name, dir } of modules) {
|
|
21714
|
-
const seedRunPath =
|
|
22074
|
+
const seedRunPath = join48(dir, "bin", "seed", "run.ts");
|
|
21715
22075
|
logger.info(`Running seeds for ${name}...`, undefined, {
|
|
21716
22076
|
showTimestamp: false,
|
|
21717
22077
|
showArrow: false,
|
|
@@ -21744,9 +22104,9 @@ class SeedRunCommand {
|
|
|
21744
22104
|
}
|
|
21745
22105
|
}
|
|
21746
22106
|
SeedRunCommand = __legacyDecorateClassTS([
|
|
21747
|
-
|
|
22107
|
+
decorator48.command()
|
|
21748
22108
|
], SeedRunCommand);
|
|
21749
22109
|
// src/index.ts
|
|
21750
22110
|
await run();
|
|
21751
22111
|
|
|
21752
|
-
//# debugId=
|
|
22112
|
+
//# debugId=6B8391ED70E28F2564756E2164756E21
|