@ooneex/cli 1.22.0 → 1.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +859 -648
- package/dist/index.js.map +6 -5
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -5175,6 +5175,22 @@ _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
|
|
@@ -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'
|
|
@@ -5250,6 +5267,12 @@ _oo() {
|
|
|
5250
5267
|
_arguments -s \\
|
|
5251
5268
|
'1:command name:_oo_custom_commands'
|
|
5252
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
|
+
;;
|
|
5253
5276
|
make:controller)
|
|
5254
5277
|
_arguments -s \\
|
|
5255
5278
|
'--name=[Name of the resource]:name' \\
|
|
@@ -5334,6 +5357,22 @@ _ooneex_modules() {
|
|
|
5334
5357
|
fi
|
|
5335
5358
|
}
|
|
5336
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
|
+
|
|
5337
5376
|
_ooneex_custom_commands() {
|
|
5338
5377
|
local -a cmds
|
|
5339
5378
|
if [[ -d modules ]]; then
|
|
@@ -5353,6 +5392,7 @@ _ooneex() {
|
|
|
5353
5392
|
'help:Show available commands'
|
|
5354
5393
|
'make\\:ai:Generate a new AI class'
|
|
5355
5394
|
'make\\:analytics:Generate a new analytics class'
|
|
5395
|
+
'make\\:benchmark:Generate a new benchmark file'
|
|
5356
5396
|
'make\\:app:Generate a new application'
|
|
5357
5397
|
'make\\:cache:Generate a new cache class'
|
|
5358
5398
|
'make\\:claude\\:skill:Generate Claude skills from templates'
|
|
@@ -5409,6 +5449,12 @@ _ooneex() {
|
|
|
5409
5449
|
_arguments -s \\
|
|
5410
5450
|
'1:command name:_ooneex_custom_commands'
|
|
5411
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
|
+
;;
|
|
5412
5458
|
make:controller)
|
|
5413
5459
|
_arguments -s \\
|
|
5414
5460
|
'--name=[Name of the resource]:name' \\
|
|
@@ -5910,10 +5956,124 @@ class MakeAiCommand {
|
|
|
5910
5956
|
MakeAiCommand = __legacyDecorateClassTS([
|
|
5911
5957
|
decorator8.command()
|
|
5912
5958
|
], MakeAiCommand);
|
|
5913
|
-
// src/commands/
|
|
5959
|
+
// src/commands/MakeBenchmarkCommand.ts
|
|
5914
5960
|
import { join as join9 } from "path";
|
|
5915
5961
|
import { decorator as decorator9 } from "@ooneex/command";
|
|
5916
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 = `${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";
|
|
5917
6077
|
import { toPascalCase as toPascalCase3 } from "@ooneex/utils";
|
|
5918
6078
|
|
|
5919
6079
|
// src/templates/analytics.test.txt
|
|
@@ -5964,28 +6124,28 @@ class MakeAnalyticsCommand {
|
|
|
5964
6124
|
if (module) {
|
|
5965
6125
|
await ensureModule(module);
|
|
5966
6126
|
}
|
|
5967
|
-
const base = module ?
|
|
5968
|
-
const analyticsLocalDir =
|
|
5969
|
-
const analyticsDir =
|
|
5970
|
-
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`);
|
|
5971
6131
|
await Bun.write(filePath, content);
|
|
5972
6132
|
const testContent = analytics_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
5973
|
-
const testsLocalDir =
|
|
5974
|
-
const testsDir =
|
|
5975
|
-
const testFilePath =
|
|
6133
|
+
const testsLocalDir = join10(base, "tests", "analytics");
|
|
6134
|
+
const testsDir = join10(process.cwd(), testsLocalDir);
|
|
6135
|
+
const testFilePath = join10(testsDir, `${name}Analytics.spec.ts`);
|
|
5976
6136
|
await Bun.write(testFilePath, testContent);
|
|
5977
|
-
const logger = new
|
|
5978
|
-
logger.success(`${
|
|
6137
|
+
const logger = new TerminalLogger9;
|
|
6138
|
+
logger.success(`${join10(analyticsLocalDir, name)}Analytics.ts created successfully`, undefined, {
|
|
5979
6139
|
showTimestamp: false,
|
|
5980
6140
|
showArrow: false,
|
|
5981
6141
|
useSymbol: true
|
|
5982
6142
|
});
|
|
5983
|
-
logger.success(`${
|
|
6143
|
+
logger.success(`${join10(testsLocalDir, name)}Analytics.spec.ts created successfully`, undefined, {
|
|
5984
6144
|
showTimestamp: false,
|
|
5985
6145
|
showArrow: false,
|
|
5986
6146
|
useSymbol: true
|
|
5987
6147
|
});
|
|
5988
|
-
const packageJsonPath =
|
|
6148
|
+
const packageJsonPath = join10(process.cwd(), "package.json");
|
|
5989
6149
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
5990
6150
|
const deps = packageJson.dependencies ?? {};
|
|
5991
6151
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -6000,12 +6160,12 @@ class MakeAnalyticsCommand {
|
|
|
6000
6160
|
}
|
|
6001
6161
|
}
|
|
6002
6162
|
MakeAnalyticsCommand = __legacyDecorateClassTS([
|
|
6003
|
-
|
|
6163
|
+
decorator10.command()
|
|
6004
6164
|
], MakeAnalyticsCommand);
|
|
6005
6165
|
// src/commands/MakeAppCommand.ts
|
|
6006
|
-
import { join as
|
|
6007
|
-
import { decorator as
|
|
6008
|
-
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";
|
|
6009
6169
|
import { toKebabCase as toKebabCase2, toSnakeCase } from "@ooneex/utils";
|
|
6010
6170
|
|
|
6011
6171
|
// src/prompts/askDestination.ts
|
|
@@ -6724,6 +6884,8 @@ POLAR_ENVIRONMENT=
|
|
|
6724
6884
|
# Authentication
|
|
6725
6885
|
# =============================================================================
|
|
6726
6886
|
|
|
6887
|
+
# Authentication token for API access
|
|
6888
|
+
AUTH_TOKEN=
|
|
6727
6889
|
# Clerk authentication secret key
|
|
6728
6890
|
CLERK_SECRET_KEY=
|
|
6729
6891
|
|
|
@@ -7156,40 +7318,40 @@ class MakeAppCommand {
|
|
|
7156
7318
|
destination = await askDestination({ message: "Enter destination path", initial: kebabName });
|
|
7157
7319
|
}
|
|
7158
7320
|
const packageContent = package_json_default.replace(/{{NAME}}/g, kebabName);
|
|
7159
|
-
await Bun.write(
|
|
7160
|
-
await Bun.write(
|
|
7161
|
-
await Bun.write(
|
|
7162
|
-
await Bun.write(
|
|
7163
|
-
await Bun.write(
|
|
7164
|
-
await Bun.write(
|
|
7165
|
-
await Bun.write(
|
|
7166
|
-
await Bun.write(
|
|
7167
|
-
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);
|
|
7168
7330
|
const makeModuleCommand = new MakeModuleCommand;
|
|
7169
7331
|
await makeModuleCommand.run({
|
|
7170
7332
|
name: "app",
|
|
7171
7333
|
cwd: destination,
|
|
7172
7334
|
silent: true
|
|
7173
7335
|
});
|
|
7174
|
-
const appModulePackagePath =
|
|
7336
|
+
const appModulePackagePath = join11(destination, "modules", "app", "package.json");
|
|
7175
7337
|
const appModulePackageJson = await Bun.file(appModulePackagePath).json();
|
|
7176
7338
|
await Bun.write(appModulePackagePath, JSON.stringify(appModulePackageJson, null, 2));
|
|
7177
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"');
|
|
7178
|
-
await Bun.write(
|
|
7179
|
-
await Bun.write(
|
|
7180
|
-
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);
|
|
7181
7343
|
await makeModuleCommand.run({
|
|
7182
7344
|
name: "shared",
|
|
7183
7345
|
cwd: destination,
|
|
7184
7346
|
silent: true
|
|
7185
7347
|
});
|
|
7186
|
-
await Bun.write(
|
|
7348
|
+
await Bun.write(join11(destination, "modules", "shared", "src", "databases", "SharedDatabase.ts"), app_database_default);
|
|
7187
7349
|
const snakeName = toSnakeCase(name);
|
|
7188
7350
|
const dockerComposeContent = docker_compose_yml_default.replace(/{{NAME}}/g, snakeName);
|
|
7189
|
-
await Bun.write(
|
|
7351
|
+
await Bun.write(join11(destination, "modules", "app", "docker-compose.yml"), dockerComposeContent);
|
|
7190
7352
|
const dockerfileContent = Dockerfile_default.replace(/{{NAME}}/g, snakeName);
|
|
7191
|
-
await Bun.write(
|
|
7192
|
-
await Bun.write(
|
|
7353
|
+
await Bun.write(join11(destination, "modules", "app", "Dockerfile"), dockerfileContent);
|
|
7354
|
+
await Bun.write(join11(destination, "modules", "app", "var", ".gitkeep"), "");
|
|
7193
7355
|
const gitInit = Bun.spawn(["git", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
7194
7356
|
await gitInit.exited;
|
|
7195
7357
|
const addDeps = Bun.spawn([
|
|
@@ -7251,9 +7413,9 @@ class MakeAppCommand {
|
|
|
7251
7413
|
await addDevDeps.exited;
|
|
7252
7414
|
const huskyInit = Bun.spawn(["bunx", "husky", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
7253
7415
|
await huskyInit.exited;
|
|
7254
|
-
await Bun.write(
|
|
7255
|
-
await Bun.write(
|
|
7256
|
-
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;
|
|
7257
7419
|
logger.success(`${kebabName} created successfully at ${destination}`, undefined, {
|
|
7258
7420
|
showTimestamp: false,
|
|
7259
7421
|
showArrow: false,
|
|
@@ -7262,12 +7424,12 @@ class MakeAppCommand {
|
|
|
7262
7424
|
}
|
|
7263
7425
|
}
|
|
7264
7426
|
MakeAppCommand = __legacyDecorateClassTS([
|
|
7265
|
-
|
|
7427
|
+
decorator11.command()
|
|
7266
7428
|
], MakeAppCommand);
|
|
7267
7429
|
// src/commands/MakeCacheCommand.ts
|
|
7268
|
-
import { join as
|
|
7269
|
-
import { decorator as
|
|
7270
|
-
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";
|
|
7271
7433
|
import { toPascalCase as toPascalCase4 } from "@ooneex/utils";
|
|
7272
7434
|
|
|
7273
7435
|
// src/templates/cache.test.txt
|
|
@@ -7343,28 +7505,28 @@ class MakeCacheCommand {
|
|
|
7343
7505
|
if (module) {
|
|
7344
7506
|
await ensureModule(module);
|
|
7345
7507
|
}
|
|
7346
|
-
const base = module ?
|
|
7347
|
-
const cacheLocalDir =
|
|
7348
|
-
const cacheDir =
|
|
7349
|
-
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`);
|
|
7350
7512
|
await Bun.write(filePath, content);
|
|
7351
7513
|
const testContent = cache_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
7352
|
-
const testsLocalDir =
|
|
7353
|
-
const testsDir =
|
|
7354
|
-
const testFilePath =
|
|
7514
|
+
const testsLocalDir = join12(base, "tests", "cache");
|
|
7515
|
+
const testsDir = join12(process.cwd(), testsLocalDir);
|
|
7516
|
+
const testFilePath = join12(testsDir, `${name}Cache.spec.ts`);
|
|
7355
7517
|
await Bun.write(testFilePath, testContent);
|
|
7356
|
-
const logger = new
|
|
7357
|
-
logger.success(`${
|
|
7518
|
+
const logger = new TerminalLogger11;
|
|
7519
|
+
logger.success(`${join12(cacheLocalDir, name)}Cache.ts created successfully`, undefined, {
|
|
7358
7520
|
showTimestamp: false,
|
|
7359
7521
|
showArrow: false,
|
|
7360
7522
|
useSymbol: true
|
|
7361
7523
|
});
|
|
7362
|
-
logger.success(`${
|
|
7524
|
+
logger.success(`${join12(testsLocalDir, name)}Cache.spec.ts created successfully`, undefined, {
|
|
7363
7525
|
showTimestamp: false,
|
|
7364
7526
|
showArrow: false,
|
|
7365
7527
|
useSymbol: true
|
|
7366
7528
|
});
|
|
7367
|
-
const packageJsonPath =
|
|
7529
|
+
const packageJsonPath = join12(process.cwd(), "package.json");
|
|
7368
7530
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
7369
7531
|
const deps = packageJson.dependencies ?? {};
|
|
7370
7532
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -7379,12 +7541,12 @@ class MakeCacheCommand {
|
|
|
7379
7541
|
}
|
|
7380
7542
|
}
|
|
7381
7543
|
MakeCacheCommand = __legacyDecorateClassTS([
|
|
7382
|
-
|
|
7544
|
+
decorator12.command()
|
|
7383
7545
|
], MakeCacheCommand);
|
|
7384
7546
|
// src/commands/MakeClaudeSkillCommand.ts
|
|
7385
|
-
import { join as
|
|
7386
|
-
import { decorator as
|
|
7387
|
-
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";
|
|
7388
7550
|
|
|
7389
7551
|
// src/templates/claude/skills/commit.md.txt
|
|
7390
7552
|
var commit_md_default = `---
|
|
@@ -7620,7 +7782,7 @@ var make_middleware_md_default = '---\nname: make:middleware\ndescription: Gener
|
|
|
7620
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';
|
|
7621
7783
|
|
|
7622
7784
|
// src/templates/claude/skills/make.permission.md.txt
|
|
7623
|
-
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';
|
|
7624
7786
|
|
|
7625
7787
|
// src/templates/claude/skills/make.pubsub.md.txt
|
|
7626
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';
|
|
@@ -7675,14 +7837,14 @@ class MakeClaudeSkillCommand {
|
|
|
7675
7837
|
return "Generate Claude skills from templates";
|
|
7676
7838
|
}
|
|
7677
7839
|
async run() {
|
|
7678
|
-
const skillsLocalDir =
|
|
7679
|
-
const skillsDir =
|
|
7680
|
-
const logger = new
|
|
7840
|
+
const skillsLocalDir = join13(".claude", "skills");
|
|
7841
|
+
const skillsDir = join13(process.cwd(), skillsLocalDir);
|
|
7842
|
+
const logger = new TerminalLogger12;
|
|
7681
7843
|
for (const [skillName, content] of Object.entries(skills)) {
|
|
7682
7844
|
const dirName = skillName.replace(/\./g, "-");
|
|
7683
|
-
const filePath =
|
|
7845
|
+
const filePath = join13(skillsDir, dirName, "SKILL.md");
|
|
7684
7846
|
await Bun.write(filePath, content);
|
|
7685
|
-
logger.success(`${
|
|
7847
|
+
logger.success(`${join13(skillsLocalDir, dirName, "SKILL.md")} created successfully`, undefined, {
|
|
7686
7848
|
showTimestamp: false,
|
|
7687
7849
|
showArrow: false,
|
|
7688
7850
|
useSymbol: true
|
|
@@ -7691,12 +7853,12 @@ class MakeClaudeSkillCommand {
|
|
|
7691
7853
|
}
|
|
7692
7854
|
}
|
|
7693
7855
|
MakeClaudeSkillCommand = __legacyDecorateClassTS([
|
|
7694
|
-
|
|
7856
|
+
decorator13.command()
|
|
7695
7857
|
], MakeClaudeSkillCommand);
|
|
7696
7858
|
// src/commands/MakeCommandCommand.ts
|
|
7697
|
-
import { join as
|
|
7698
|
-
import { commandCreate, decorator as
|
|
7699
|
-
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";
|
|
7700
7862
|
|
|
7701
7863
|
// src/templates/module/command.run.txt
|
|
7702
7864
|
var command_run_default = `#!/usr/bin/env bun
|
|
@@ -7723,18 +7885,18 @@ class MakeCommandCommand {
|
|
|
7723
7885
|
if (module) {
|
|
7724
7886
|
await ensureModule(module);
|
|
7725
7887
|
}
|
|
7726
|
-
const base = module ?
|
|
7888
|
+
const base = module ? join14("modules", module) : ".";
|
|
7727
7889
|
const { commandPath: filePath, testPath } = await commandCreate({
|
|
7728
7890
|
name,
|
|
7729
|
-
commandDir:
|
|
7730
|
-
testsDir:
|
|
7891
|
+
commandDir: join14(base, "src", "commands"),
|
|
7892
|
+
testsDir: join14(base, "tests", "commands")
|
|
7731
7893
|
});
|
|
7732
|
-
const binCommandRunPath =
|
|
7894
|
+
const binCommandRunPath = join14(process.cwd(), base, "bin", "command", "run.ts");
|
|
7733
7895
|
const binCommandRunFile = Bun.file(binCommandRunPath);
|
|
7734
7896
|
if (!await binCommandRunFile.exists()) {
|
|
7735
7897
|
await Bun.write(binCommandRunPath, command_run_default.replace(/{{name}}/g, module ?? ""));
|
|
7736
7898
|
}
|
|
7737
|
-
const logger = new
|
|
7899
|
+
const logger = new TerminalLogger13;
|
|
7738
7900
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
7739
7901
|
showTimestamp: false,
|
|
7740
7902
|
showArrow: false,
|
|
@@ -7748,12 +7910,12 @@ class MakeCommandCommand {
|
|
|
7748
7910
|
}
|
|
7749
7911
|
}
|
|
7750
7912
|
MakeCommandCommand = __legacyDecorateClassTS([
|
|
7751
|
-
|
|
7913
|
+
decorator14.command()
|
|
7752
7914
|
], MakeCommandCommand);
|
|
7753
7915
|
// src/commands/MakeControllerCommand.ts
|
|
7754
|
-
import { basename, join as
|
|
7755
|
-
import { decorator as
|
|
7756
|
-
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";
|
|
7757
7919
|
import { toKebabCase as toKebabCase3, toPascalCase as toPascalCase5, trim } from "@ooneex/utils";
|
|
7758
7920
|
|
|
7759
7921
|
// src/prompts/askConfirm.ts
|
|
@@ -8173,33 +8335,33 @@ class MakeControllerCommand {
|
|
|
8173
8335
|
if (module) {
|
|
8174
8336
|
await ensureModule(module);
|
|
8175
8337
|
}
|
|
8176
|
-
const base = module ?
|
|
8177
|
-
const controllersLocalDir =
|
|
8178
|
-
const controllersDir =
|
|
8179
|
-
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`);
|
|
8180
8342
|
await Bun.write(filePath, content);
|
|
8181
8343
|
const testContent = controller_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
8182
|
-
const testsLocalDir =
|
|
8183
|
-
const testsDir =
|
|
8184
|
-
const testFilePath =
|
|
8344
|
+
const testsLocalDir = join15(base, "tests", "controllers");
|
|
8345
|
+
const testsDir = join15(process.cwd(), testsLocalDir);
|
|
8346
|
+
const testFilePath = join15(testsDir, `${name}Controller.spec.ts`);
|
|
8185
8347
|
await Bun.write(testFilePath, testContent);
|
|
8186
8348
|
const modulePascalName = module ? toPascalCase5(module) : toPascalCase5(basename(process.cwd()));
|
|
8187
|
-
const modulePath =
|
|
8349
|
+
const modulePath = join15(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
8188
8350
|
if (await Bun.file(modulePath).exists()) {
|
|
8189
8351
|
await this.addToModule(modulePath, name);
|
|
8190
8352
|
}
|
|
8191
|
-
const logger = new
|
|
8192
|
-
logger.success(`${
|
|
8353
|
+
const logger = new TerminalLogger14;
|
|
8354
|
+
logger.success(`${join15(controllersLocalDir, name)}Controller.ts created successfully`, undefined, {
|
|
8193
8355
|
showTimestamp: false,
|
|
8194
8356
|
showArrow: false,
|
|
8195
8357
|
useSymbol: true
|
|
8196
8358
|
});
|
|
8197
|
-
logger.success(`${
|
|
8359
|
+
logger.success(`${join15(testsLocalDir, name)}Controller.spec.ts created successfully`, undefined, {
|
|
8198
8360
|
showTimestamp: false,
|
|
8199
8361
|
showArrow: false,
|
|
8200
8362
|
useSymbol: true
|
|
8201
8363
|
});
|
|
8202
|
-
const packageJsonPath =
|
|
8364
|
+
const packageJsonPath = join15(process.cwd(), "package.json");
|
|
8203
8365
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8204
8366
|
const deps = packageJson.dependencies ?? {};
|
|
8205
8367
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8214,12 +8376,12 @@ class MakeControllerCommand {
|
|
|
8214
8376
|
}
|
|
8215
8377
|
}
|
|
8216
8378
|
MakeControllerCommand = __legacyDecorateClassTS([
|
|
8217
|
-
|
|
8379
|
+
decorator15.command()
|
|
8218
8380
|
], MakeControllerCommand);
|
|
8219
8381
|
// src/commands/MakeCronCommand.ts
|
|
8220
|
-
import { basename as basename2, join as
|
|
8221
|
-
import { decorator as
|
|
8222
|
-
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";
|
|
8223
8385
|
import { toPascalCase as toPascalCase6 } from "@ooneex/utils";
|
|
8224
8386
|
|
|
8225
8387
|
// src/templates/cron.test.txt
|
|
@@ -8308,33 +8470,33 @@ class MakeCronCommand {
|
|
|
8308
8470
|
if (module) {
|
|
8309
8471
|
await ensureModule(module);
|
|
8310
8472
|
}
|
|
8311
|
-
const base = module ?
|
|
8312
|
-
const cronLocalDir =
|
|
8313
|
-
const cronDir =
|
|
8314
|
-
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`);
|
|
8315
8477
|
await Bun.write(filePath, content);
|
|
8316
8478
|
const testContent = cron_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
8317
|
-
const testsLocalDir =
|
|
8318
|
-
const testsDir =
|
|
8319
|
-
const testFilePath =
|
|
8479
|
+
const testsLocalDir = join16(base, "tests", "crons");
|
|
8480
|
+
const testsDir = join16(process.cwd(), testsLocalDir);
|
|
8481
|
+
const testFilePath = join16(testsDir, `${name}Cron.spec.ts`);
|
|
8320
8482
|
await Bun.write(testFilePath, testContent);
|
|
8321
8483
|
const modulePascalName = module ? toPascalCase6(module) : toPascalCase6(basename2(process.cwd()));
|
|
8322
|
-
const modulePath =
|
|
8484
|
+
const modulePath = join16(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
8323
8485
|
if (await Bun.file(modulePath).exists()) {
|
|
8324
8486
|
await this.addToModule(modulePath, name);
|
|
8325
8487
|
}
|
|
8326
|
-
const logger = new
|
|
8327
|
-
logger.success(`${
|
|
8488
|
+
const logger = new TerminalLogger15;
|
|
8489
|
+
logger.success(`${join16(cronLocalDir, name)}Cron.ts created successfully`, undefined, {
|
|
8328
8490
|
showTimestamp: false,
|
|
8329
8491
|
showArrow: false,
|
|
8330
8492
|
useSymbol: true
|
|
8331
8493
|
});
|
|
8332
|
-
logger.success(`${
|
|
8494
|
+
logger.success(`${join16(testsLocalDir, name)}Cron.spec.ts created successfully`, undefined, {
|
|
8333
8495
|
showTimestamp: false,
|
|
8334
8496
|
showArrow: false,
|
|
8335
8497
|
useSymbol: true
|
|
8336
8498
|
});
|
|
8337
|
-
const packageJsonPath =
|
|
8499
|
+
const packageJsonPath = join16(process.cwd(), "package.json");
|
|
8338
8500
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8339
8501
|
const deps = packageJson.dependencies ?? {};
|
|
8340
8502
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8349,12 +8511,12 @@ class MakeCronCommand {
|
|
|
8349
8511
|
}
|
|
8350
8512
|
}
|
|
8351
8513
|
MakeCronCommand = __legacyDecorateClassTS([
|
|
8352
|
-
|
|
8514
|
+
decorator16.command()
|
|
8353
8515
|
], MakeCronCommand);
|
|
8354
8516
|
// src/commands/MakeDatabaseCommand.ts
|
|
8355
|
-
import { join as
|
|
8356
|
-
import { decorator as
|
|
8357
|
-
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";
|
|
8358
8520
|
import { toPascalCase as toPascalCase7 } from "@ooneex/utils";
|
|
8359
8521
|
|
|
8360
8522
|
// src/templates/database.test.txt
|
|
@@ -8417,28 +8579,28 @@ class MakeDatabaseCommand {
|
|
|
8417
8579
|
if (module) {
|
|
8418
8580
|
await ensureModule(module);
|
|
8419
8581
|
}
|
|
8420
|
-
const base = module ?
|
|
8421
|
-
const databaseLocalDir =
|
|
8422
|
-
const databaseDir =
|
|
8423
|
-
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`);
|
|
8424
8586
|
await Bun.write(filePath, content);
|
|
8425
8587
|
const testContent = database_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
8426
|
-
const testsLocalDir =
|
|
8427
|
-
const testsDir =
|
|
8428
|
-
const testFilePath =
|
|
8588
|
+
const testsLocalDir = join17(base, "tests", "databases");
|
|
8589
|
+
const testsDir = join17(process.cwd(), testsLocalDir);
|
|
8590
|
+
const testFilePath = join17(testsDir, `${name}Database.spec.ts`);
|
|
8429
8591
|
await Bun.write(testFilePath, testContent);
|
|
8430
|
-
const logger = new
|
|
8431
|
-
logger.success(`${
|
|
8592
|
+
const logger = new TerminalLogger16;
|
|
8593
|
+
logger.success(`${join17(databaseLocalDir, name)}Database.ts created successfully`, undefined, {
|
|
8432
8594
|
showTimestamp: false,
|
|
8433
8595
|
showArrow: false,
|
|
8434
8596
|
useSymbol: true
|
|
8435
8597
|
});
|
|
8436
|
-
logger.success(`${
|
|
8598
|
+
logger.success(`${join17(testsLocalDir, name)}Database.spec.ts created successfully`, undefined, {
|
|
8437
8599
|
showTimestamp: false,
|
|
8438
8600
|
showArrow: false,
|
|
8439
8601
|
useSymbol: true
|
|
8440
8602
|
});
|
|
8441
|
-
const packageJsonPath =
|
|
8603
|
+
const packageJsonPath = join17(process.cwd(), "package.json");
|
|
8442
8604
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
8443
8605
|
const deps = packageJson.dependencies ?? {};
|
|
8444
8606
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -8453,12 +8615,12 @@ class MakeDatabaseCommand {
|
|
|
8453
8615
|
}
|
|
8454
8616
|
}
|
|
8455
8617
|
MakeDatabaseCommand = __legacyDecorateClassTS([
|
|
8456
|
-
|
|
8618
|
+
decorator17.command()
|
|
8457
8619
|
], MakeDatabaseCommand);
|
|
8458
8620
|
// src/commands/MakeDockerCommand.ts
|
|
8459
|
-
import { join as
|
|
8460
|
-
import { decorator as
|
|
8461
|
-
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";
|
|
8462
8624
|
var {YAML } = globalThis.Bun;
|
|
8463
8625
|
|
|
8464
8626
|
// src/prompts/askDockerService.ts
|
|
@@ -8951,9 +9113,9 @@ class MakeDockerCommand {
|
|
|
8951
9113
|
name = await askDockerService({ message: "Select docker service" });
|
|
8952
9114
|
}
|
|
8953
9115
|
const templateContent = templates[name];
|
|
8954
|
-
const base =
|
|
8955
|
-
const composePath =
|
|
8956
|
-
const logger = new
|
|
9116
|
+
const base = join18("modules", "app");
|
|
9117
|
+
const composePath = join18(process.cwd(), base, "docker-compose.yml");
|
|
9118
|
+
const logger = new TerminalLogger17;
|
|
8957
9119
|
const composeFile = Bun.file(composePath);
|
|
8958
9120
|
if (await composeFile.exists()) {
|
|
8959
9121
|
const existingContent = await composeFile.text();
|
|
@@ -9012,7 +9174,7 @@ volumes:
|
|
|
9012
9174
|
} else {
|
|
9013
9175
|
await Bun.write(composePath, templateContent);
|
|
9014
9176
|
}
|
|
9015
|
-
const packageJsonPath =
|
|
9177
|
+
const packageJsonPath = join18(process.cwd(), base, "package.json");
|
|
9016
9178
|
const packageJsonFile = Bun.file(packageJsonPath);
|
|
9017
9179
|
if (await packageJsonFile.exists()) {
|
|
9018
9180
|
const packageJson = await packageJsonFile.json();
|
|
@@ -9033,13 +9195,13 @@ volumes:
|
|
|
9033
9195
|
}
|
|
9034
9196
|
}
|
|
9035
9197
|
MakeDockerCommand = __legacyDecorateClassTS([
|
|
9036
|
-
|
|
9198
|
+
decorator18.command()
|
|
9037
9199
|
], MakeDockerCommand);
|
|
9038
9200
|
// src/commands/MakeEntityCommand.ts
|
|
9039
9201
|
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
9040
|
-
import { basename as basename3, join as
|
|
9041
|
-
import { decorator as
|
|
9042
|
-
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";
|
|
9043
9205
|
import { toPascalCase as toPascalCase8, toSnakeCase as toSnakeCase2 } from "@ooneex/utils";
|
|
9044
9206
|
|
|
9045
9207
|
// src/templates/entity.test.txt
|
|
@@ -9203,28 +9365,28 @@ class MakeEntityCommand {
|
|
|
9203
9365
|
if (module) {
|
|
9204
9366
|
await ensureModule(module);
|
|
9205
9367
|
}
|
|
9206
|
-
const base = module ?
|
|
9207
|
-
const entitiesLocalDir =
|
|
9208
|
-
const entitiesDir =
|
|
9209
|
-
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`);
|
|
9210
9372
|
await Bun.write(filePath, content);
|
|
9211
9373
|
const testContent = entity_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9212
|
-
const testsLocalDir =
|
|
9213
|
-
const testsDir =
|
|
9214
|
-
const testFilePath =
|
|
9374
|
+
const testsLocalDir = join19(base, "tests", "entities");
|
|
9375
|
+
const testsDir = join19(process.cwd(), testsLocalDir);
|
|
9376
|
+
const testFilePath = join19(testsDir, `${name}Entity.spec.ts`);
|
|
9215
9377
|
await Bun.write(testFilePath, testContent);
|
|
9216
9378
|
const modulePascalName = module ? toPascalCase8(module) : toPascalCase8(basename3(process.cwd()));
|
|
9217
|
-
const modulePath =
|
|
9379
|
+
const modulePath = join19(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9218
9380
|
if (await Bun.file(modulePath).exists()) {
|
|
9219
9381
|
await this.addToModule(modulePath, name);
|
|
9220
9382
|
}
|
|
9221
|
-
const logger = new
|
|
9222
|
-
logger.success(`${
|
|
9383
|
+
const logger = new TerminalLogger18;
|
|
9384
|
+
logger.success(`${join19(entitiesLocalDir, name)}Entity.ts created successfully`, undefined, {
|
|
9223
9385
|
showTimestamp: false,
|
|
9224
9386
|
showArrow: false,
|
|
9225
9387
|
useSymbol: true
|
|
9226
9388
|
});
|
|
9227
|
-
logger.success(`${
|
|
9389
|
+
logger.success(`${join19(testsLocalDir, name)}Entity.spec.ts created successfully`, undefined, {
|
|
9228
9390
|
showTimestamp: false,
|
|
9229
9391
|
showArrow: false,
|
|
9230
9392
|
useSymbol: true
|
|
@@ -9232,12 +9394,12 @@ class MakeEntityCommand {
|
|
|
9232
9394
|
}
|
|
9233
9395
|
}
|
|
9234
9396
|
MakeEntityCommand = __legacyDecorateClassTS([
|
|
9235
|
-
|
|
9397
|
+
decorator19.command()
|
|
9236
9398
|
], MakeEntityCommand);
|
|
9237
9399
|
// src/commands/MakeLoggerCommand.ts
|
|
9238
|
-
import { join as
|
|
9239
|
-
import { decorator as
|
|
9240
|
-
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";
|
|
9241
9403
|
import { toPascalCase as toPascalCase9 } from "@ooneex/utils";
|
|
9242
9404
|
|
|
9243
9405
|
// src/templates/logger.test.txt
|
|
@@ -9342,28 +9504,28 @@ class MakeLoggerCommand {
|
|
|
9342
9504
|
if (module) {
|
|
9343
9505
|
await ensureModule(module);
|
|
9344
9506
|
}
|
|
9345
|
-
const base = module ?
|
|
9346
|
-
const loggerLocalDir =
|
|
9347
|
-
const loggerDir =
|
|
9348
|
-
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`);
|
|
9349
9511
|
await Bun.write(filePath, content);
|
|
9350
9512
|
const testContent = logger_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9351
|
-
const testsLocalDir =
|
|
9352
|
-
const testsDir =
|
|
9353
|
-
const testFilePath =
|
|
9513
|
+
const testsLocalDir = join20(base, "tests", "loggers");
|
|
9514
|
+
const testsDir = join20(process.cwd(), testsLocalDir);
|
|
9515
|
+
const testFilePath = join20(testsDir, `${name}Logger.spec.ts`);
|
|
9354
9516
|
await Bun.write(testFilePath, testContent);
|
|
9355
|
-
const logger = new
|
|
9356
|
-
logger.success(`${
|
|
9517
|
+
const logger = new TerminalLogger19;
|
|
9518
|
+
logger.success(`${join20(loggerLocalDir, name)}Logger.ts created successfully`, undefined, {
|
|
9357
9519
|
showTimestamp: false,
|
|
9358
9520
|
showArrow: false,
|
|
9359
9521
|
useSymbol: true
|
|
9360
9522
|
});
|
|
9361
|
-
logger.success(`${
|
|
9523
|
+
logger.success(`${join20(testsLocalDir, name)}Logger.spec.ts created successfully`, undefined, {
|
|
9362
9524
|
showTimestamp: false,
|
|
9363
9525
|
showArrow: false,
|
|
9364
9526
|
useSymbol: true
|
|
9365
9527
|
});
|
|
9366
|
-
const packageJsonPath =
|
|
9528
|
+
const packageJsonPath = join20(process.cwd(), "package.json");
|
|
9367
9529
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9368
9530
|
const deps = packageJson.dependencies ?? {};
|
|
9369
9531
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9378,12 +9540,12 @@ class MakeLoggerCommand {
|
|
|
9378
9540
|
}
|
|
9379
9541
|
}
|
|
9380
9542
|
MakeLoggerCommand = __legacyDecorateClassTS([
|
|
9381
|
-
|
|
9543
|
+
decorator20.command()
|
|
9382
9544
|
], MakeLoggerCommand);
|
|
9383
9545
|
// src/commands/MakeMailerCommand.ts
|
|
9384
|
-
import { join as
|
|
9385
|
-
import { decorator as
|
|
9386
|
-
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";
|
|
9387
9549
|
import { toPascalCase as toPascalCase10 } from "@ooneex/utils";
|
|
9388
9550
|
|
|
9389
9551
|
// src/templates/mailer/mailer.test.txt
|
|
@@ -9481,43 +9643,43 @@ class MakeMailerCommand {
|
|
|
9481
9643
|
if (module) {
|
|
9482
9644
|
await ensureModule(module);
|
|
9483
9645
|
}
|
|
9484
|
-
const base = module ?
|
|
9485
|
-
const mailerLocalDir =
|
|
9486
|
-
const mailerDir =
|
|
9487
|
-
const mailerFilePath =
|
|
9488
|
-
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`);
|
|
9489
9651
|
await Bun.write(mailerFilePath, mailerContent);
|
|
9490
9652
|
await Bun.write(templateFilePath, templateContent);
|
|
9491
9653
|
const mailerTestContent = mailer_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9492
9654
|
const templateTestContent = mailer_template_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9493
|
-
const testsLocalDir =
|
|
9494
|
-
const testsDir =
|
|
9495
|
-
const mailerTestFilePath =
|
|
9496
|
-
const templateTestFilePath =
|
|
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`);
|
|
9497
9659
|
await Bun.write(mailerTestFilePath, mailerTestContent);
|
|
9498
9660
|
await Bun.write(templateTestFilePath, templateTestContent);
|
|
9499
|
-
const logger = new
|
|
9500
|
-
logger.success(`${
|
|
9661
|
+
const logger = new TerminalLogger20;
|
|
9662
|
+
logger.success(`${join21(mailerLocalDir, name)}Mailer.ts created successfully`, undefined, {
|
|
9501
9663
|
showTimestamp: false,
|
|
9502
9664
|
showArrow: false,
|
|
9503
9665
|
useSymbol: true
|
|
9504
9666
|
});
|
|
9505
|
-
logger.success(`${
|
|
9667
|
+
logger.success(`${join21(mailerLocalDir, name)}MailerTemplate.tsx created successfully`, undefined, {
|
|
9506
9668
|
showTimestamp: false,
|
|
9507
9669
|
showArrow: false,
|
|
9508
9670
|
useSymbol: true
|
|
9509
9671
|
});
|
|
9510
|
-
logger.success(`${
|
|
9672
|
+
logger.success(`${join21(testsLocalDir, name)}Mailer.spec.ts created successfully`, undefined, {
|
|
9511
9673
|
showTimestamp: false,
|
|
9512
9674
|
showArrow: false,
|
|
9513
9675
|
useSymbol: true
|
|
9514
9676
|
});
|
|
9515
|
-
logger.success(`${
|
|
9677
|
+
logger.success(`${join21(testsLocalDir, name)}MailerTemplate.spec.ts created successfully`, undefined, {
|
|
9516
9678
|
showTimestamp: false,
|
|
9517
9679
|
showArrow: false,
|
|
9518
9680
|
useSymbol: true
|
|
9519
9681
|
});
|
|
9520
|
-
const packageJsonPath =
|
|
9682
|
+
const packageJsonPath = join21(process.cwd(), "package.json");
|
|
9521
9683
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9522
9684
|
const deps = packageJson.dependencies ?? {};
|
|
9523
9685
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9532,12 +9694,12 @@ class MakeMailerCommand {
|
|
|
9532
9694
|
}
|
|
9533
9695
|
}
|
|
9534
9696
|
MakeMailerCommand = __legacyDecorateClassTS([
|
|
9535
|
-
|
|
9697
|
+
decorator21.command()
|
|
9536
9698
|
], MakeMailerCommand);
|
|
9537
9699
|
// src/commands/MakeMiddlewareCommand.ts
|
|
9538
|
-
import { basename as basename4, join as
|
|
9539
|
-
import { decorator as
|
|
9540
|
-
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";
|
|
9541
9703
|
import { toPascalCase as toPascalCase11 } from "@ooneex/utils";
|
|
9542
9704
|
|
|
9543
9705
|
// src/templates/middleware.socket.txt
|
|
@@ -9626,33 +9788,33 @@ class MakeMiddlewareCommand {
|
|
|
9626
9788
|
if (module) {
|
|
9627
9789
|
await ensureModule(module);
|
|
9628
9790
|
}
|
|
9629
|
-
const base = module ?
|
|
9630
|
-
const middlewareLocalDir =
|
|
9631
|
-
const middlewareDir =
|
|
9632
|
-
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`);
|
|
9633
9795
|
await Bun.write(filePath, content);
|
|
9634
9796
|
const testContent = middleware_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9635
|
-
const testsLocalDir =
|
|
9636
|
-
const testsDir =
|
|
9637
|
-
const testFilePath =
|
|
9797
|
+
const testsLocalDir = join22(base, "tests", "middlewares");
|
|
9798
|
+
const testsDir = join22(process.cwd(), testsLocalDir);
|
|
9799
|
+
const testFilePath = join22(testsDir, `${name}Middleware.spec.ts`);
|
|
9638
9800
|
await Bun.write(testFilePath, testContent);
|
|
9639
9801
|
const modulePascalName = module ? toPascalCase11(module) : toPascalCase11(basename4(process.cwd()));
|
|
9640
|
-
const modulePath =
|
|
9802
|
+
const modulePath = join22(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9641
9803
|
if (await Bun.file(modulePath).exists()) {
|
|
9642
9804
|
await this.addToModule(modulePath, name);
|
|
9643
9805
|
}
|
|
9644
|
-
const logger = new
|
|
9645
|
-
logger.success(`${
|
|
9806
|
+
const logger = new TerminalLogger21;
|
|
9807
|
+
logger.success(`${join22(middlewareLocalDir, name)}Middleware.ts created successfully`, undefined, {
|
|
9646
9808
|
showTimestamp: false,
|
|
9647
9809
|
showArrow: false,
|
|
9648
9810
|
useSymbol: true
|
|
9649
9811
|
});
|
|
9650
|
-
logger.success(`${
|
|
9812
|
+
logger.success(`${join22(testsLocalDir, name)}Middleware.spec.ts created successfully`, undefined, {
|
|
9651
9813
|
showTimestamp: false,
|
|
9652
9814
|
showArrow: false,
|
|
9653
9815
|
useSymbol: true
|
|
9654
9816
|
});
|
|
9655
|
-
const packageJsonPath =
|
|
9817
|
+
const packageJsonPath = join22(process.cwd(), "package.json");
|
|
9656
9818
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9657
9819
|
const deps = packageJson.dependencies ?? {};
|
|
9658
9820
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9667,12 +9829,12 @@ class MakeMiddlewareCommand {
|
|
|
9667
9829
|
}
|
|
9668
9830
|
}
|
|
9669
9831
|
MakeMiddlewareCommand = __legacyDecorateClassTS([
|
|
9670
|
-
|
|
9832
|
+
decorator22.command()
|
|
9671
9833
|
], MakeMiddlewareCommand);
|
|
9672
9834
|
// src/commands/MakeMigrationCommand.ts
|
|
9673
|
-
import { join as
|
|
9674
|
-
import { decorator as
|
|
9675
|
-
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";
|
|
9676
9838
|
import { migrationCreate } from "@ooneex/migrations";
|
|
9677
9839
|
|
|
9678
9840
|
// src/templates/module/migration.up.txt
|
|
@@ -9700,17 +9862,18 @@ class MakeMigrationCommand {
|
|
|
9700
9862
|
if (module) {
|
|
9701
9863
|
await ensureModule(module);
|
|
9702
9864
|
}
|
|
9703
|
-
const base = module ?
|
|
9865
|
+
const base = module ? join23("modules", module) : ".";
|
|
9704
9866
|
const { migrationPath: filePath } = await migrationCreate({
|
|
9705
|
-
migrationsDir:
|
|
9706
|
-
testsDir:
|
|
9867
|
+
migrationsDir: join23(base, "src", "migrations"),
|
|
9868
|
+
testsDir: join23(base, "tests", "migrations"),
|
|
9869
|
+
module: module ?? ""
|
|
9707
9870
|
});
|
|
9708
|
-
const binMigrationUpPath =
|
|
9871
|
+
const binMigrationUpPath = join23(process.cwd(), base, "bin", "migration", "up.ts");
|
|
9709
9872
|
const binMigrationUpFile = Bun.file(binMigrationUpPath);
|
|
9710
9873
|
if (!await binMigrationUpFile.exists()) {
|
|
9711
9874
|
await Bun.write(binMigrationUpPath, migration_up_default.replace(/{{name}}/g, module ?? ""));
|
|
9712
9875
|
}
|
|
9713
|
-
const logger = new
|
|
9876
|
+
const logger = new TerminalLogger22;
|
|
9714
9877
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
9715
9878
|
showTimestamp: false,
|
|
9716
9879
|
showArrow: false,
|
|
@@ -9719,12 +9882,12 @@ class MakeMigrationCommand {
|
|
|
9719
9882
|
}
|
|
9720
9883
|
}
|
|
9721
9884
|
MakeMigrationCommand = __legacyDecorateClassTS([
|
|
9722
|
-
|
|
9885
|
+
decorator23.command()
|
|
9723
9886
|
], MakeMigrationCommand);
|
|
9724
9887
|
// src/commands/MakePermissionCommand.ts
|
|
9725
|
-
import { join as
|
|
9726
|
-
import { decorator as
|
|
9727
|
-
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";
|
|
9728
9891
|
import { toPascalCase as toPascalCase12 } from "@ooneex/utils";
|
|
9729
9892
|
|
|
9730
9893
|
// src/templates/permission.test.txt
|
|
@@ -9752,12 +9915,17 @@ describe("{{NAME}}Permission", () => {
|
|
|
9752
9915
|
expect(typeof {{NAME}}Permission.prototype.setUserPermissions).toBe("function");
|
|
9753
9916
|
});
|
|
9754
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
|
+
|
|
9755
9923
|
});
|
|
9756
9924
|
`;
|
|
9757
9925
|
|
|
9758
9926
|
// src/templates/permission.txt
|
|
9759
|
-
var permission_default = `import {
|
|
9760
|
-
import
|
|
9927
|
+
var permission_default = `import type { ContextType } from "@ooneex/controller";
|
|
9928
|
+
import { decorator, Permission } from "@ooneex/permission";
|
|
9761
9929
|
|
|
9762
9930
|
@decorator.permission()
|
|
9763
9931
|
export class {{NAME}}Permission extends Permission {
|
|
@@ -9769,12 +9937,14 @@ export class {{NAME}}Permission extends Permission {
|
|
|
9769
9937
|
return this;
|
|
9770
9938
|
}
|
|
9771
9939
|
|
|
9772
|
-
public setUserPermissions(
|
|
9773
|
-
if (!user) {
|
|
9774
|
-
return this;
|
|
9775
|
-
}
|
|
9776
|
-
|
|
9940
|
+
public setUserPermissions(context: ContextType): this {
|
|
9777
9941
|
// Example: Grant full access to admins
|
|
9942
|
+
// const { user } = context;
|
|
9943
|
+
//
|
|
9944
|
+
// if (!user) {
|
|
9945
|
+
// return this;
|
|
9946
|
+
// }
|
|
9947
|
+
//
|
|
9778
9948
|
// const { roles } = user;
|
|
9779
9949
|
// if (roles.includes(ERole.ADMIN)) {
|
|
9780
9950
|
// this.ability.can("manage", "all");
|
|
@@ -9782,18 +9952,58 @@ export class {{NAME}}Permission extends Permission {
|
|
|
9782
9952
|
// }
|
|
9783
9953
|
|
|
9784
9954
|
// Example: Grant specific permissions based on roles
|
|
9785
|
-
//
|
|
9786
|
-
// if (role === ERole.USER) {
|
|
9787
|
-
// this.ability.can(["read", "update"], "YourEntity", { userId: user.id });
|
|
9788
|
-
// }
|
|
9955
|
+
// const { user } = context;
|
|
9789
9956
|
//
|
|
9790
|
-
//
|
|
9791
|
-
//
|
|
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
|
+
// }
|
|
9962
|
+
//
|
|
9963
|
+
// if (role === ERole.GUEST) {
|
|
9964
|
+
// this.ability.can("read", "YourEntity", { public: true });
|
|
9965
|
+
// }
|
|
9792
9966
|
// }
|
|
9793
9967
|
// }
|
|
9794
9968
|
|
|
9795
9969
|
return this;
|
|
9796
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
|
+
}
|
|
9797
10007
|
}
|
|
9798
10008
|
`;
|
|
9799
10009
|
|
|
@@ -9815,28 +10025,28 @@ class MakePermissionCommand {
|
|
|
9815
10025
|
if (module) {
|
|
9816
10026
|
await ensureModule(module);
|
|
9817
10027
|
}
|
|
9818
|
-
const base = module ?
|
|
9819
|
-
const permissionLocalDir =
|
|
9820
|
-
const permissionDir =
|
|
9821
|
-
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`);
|
|
9822
10032
|
await Bun.write(filePath, content);
|
|
9823
10033
|
const testContent = permission_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9824
|
-
const testsLocalDir =
|
|
9825
|
-
const testsDir =
|
|
9826
|
-
const testFilePath =
|
|
10034
|
+
const testsLocalDir = join24(base, "tests", "permissions");
|
|
10035
|
+
const testsDir = join24(process.cwd(), testsLocalDir);
|
|
10036
|
+
const testFilePath = join24(testsDir, `${name}Permission.spec.ts`);
|
|
9827
10037
|
await Bun.write(testFilePath, testContent);
|
|
9828
|
-
const logger = new
|
|
9829
|
-
logger.success(`${
|
|
10038
|
+
const logger = new TerminalLogger23;
|
|
10039
|
+
logger.success(`${join24(permissionLocalDir, name)}Permission.ts created successfully`, undefined, {
|
|
9830
10040
|
showTimestamp: false,
|
|
9831
10041
|
showArrow: false,
|
|
9832
10042
|
useSymbol: true
|
|
9833
10043
|
});
|
|
9834
|
-
logger.success(`${
|
|
10044
|
+
logger.success(`${join24(testsLocalDir, name)}Permission.spec.ts created successfully`, undefined, {
|
|
9835
10045
|
showTimestamp: false,
|
|
9836
10046
|
showArrow: false,
|
|
9837
10047
|
useSymbol: true
|
|
9838
10048
|
});
|
|
9839
|
-
const packageJsonPath =
|
|
10049
|
+
const packageJsonPath = join24(process.cwd(), "package.json");
|
|
9840
10050
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9841
10051
|
const deps = packageJson.dependencies ?? {};
|
|
9842
10052
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -9851,12 +10061,12 @@ class MakePermissionCommand {
|
|
|
9851
10061
|
}
|
|
9852
10062
|
}
|
|
9853
10063
|
MakePermissionCommand = __legacyDecorateClassTS([
|
|
9854
|
-
|
|
10064
|
+
decorator24.command()
|
|
9855
10065
|
], MakePermissionCommand);
|
|
9856
10066
|
// src/commands/MakePubSubCommand.ts
|
|
9857
|
-
import { basename as basename5, join as
|
|
9858
|
-
import { decorator as
|
|
9859
|
-
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";
|
|
9860
10070
|
import { toKebabCase as toKebabCase4, toPascalCase as toPascalCase13 } from "@ooneex/utils";
|
|
9861
10071
|
|
|
9862
10072
|
// src/templates/pubsub.test.txt
|
|
@@ -9964,33 +10174,33 @@ class MakePubSubCommand {
|
|
|
9964
10174
|
if (module) {
|
|
9965
10175
|
await ensureModule(module);
|
|
9966
10176
|
}
|
|
9967
|
-
const base = module ?
|
|
9968
|
-
const pubSubLocalDir =
|
|
9969
|
-
const pubSubDir =
|
|
9970
|
-
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`);
|
|
9971
10181
|
await Bun.write(filePath, content);
|
|
9972
10182
|
const testContent = pubsub_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
9973
|
-
const testsLocalDir =
|
|
9974
|
-
const testsDir =
|
|
9975
|
-
const testFilePath =
|
|
10183
|
+
const testsLocalDir = join25(base, "tests", "events");
|
|
10184
|
+
const testsDir = join25(process.cwd(), testsLocalDir);
|
|
10185
|
+
const testFilePath = join25(testsDir, `${name}Event.spec.ts`);
|
|
9976
10186
|
await Bun.write(testFilePath, testContent);
|
|
9977
10187
|
const modulePascalName = module ? toPascalCase13(module) : toPascalCase13(basename5(process.cwd()));
|
|
9978
|
-
const modulePath =
|
|
10188
|
+
const modulePath = join25(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
|
|
9979
10189
|
if (await Bun.file(modulePath).exists()) {
|
|
9980
10190
|
await this.addToModule(modulePath, name);
|
|
9981
10191
|
}
|
|
9982
|
-
const logger = new
|
|
9983
|
-
logger.success(`${
|
|
10192
|
+
const logger = new TerminalLogger24;
|
|
10193
|
+
logger.success(`${join25(pubSubLocalDir, name)}Event.ts created successfully`, undefined, {
|
|
9984
10194
|
showTimestamp: false,
|
|
9985
10195
|
showArrow: false,
|
|
9986
10196
|
useSymbol: true
|
|
9987
10197
|
});
|
|
9988
|
-
logger.success(`${
|
|
10198
|
+
logger.success(`${join25(testsLocalDir, name)}Event.spec.ts created successfully`, undefined, {
|
|
9989
10199
|
showTimestamp: false,
|
|
9990
10200
|
showArrow: false,
|
|
9991
10201
|
useSymbol: true
|
|
9992
10202
|
});
|
|
9993
|
-
const packageJsonPath =
|
|
10203
|
+
const packageJsonPath = join25(process.cwd(), "package.json");
|
|
9994
10204
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
9995
10205
|
const deps = packageJson.dependencies ?? {};
|
|
9996
10206
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -10005,13 +10215,13 @@ class MakePubSubCommand {
|
|
|
10005
10215
|
}
|
|
10006
10216
|
}
|
|
10007
10217
|
MakePubSubCommand = __legacyDecorateClassTS([
|
|
10008
|
-
|
|
10218
|
+
decorator25.command()
|
|
10009
10219
|
], MakePubSubCommand);
|
|
10010
10220
|
// src/commands/MakeReleaseCommand.ts
|
|
10011
10221
|
import { readdir } from "fs/promises";
|
|
10012
|
-
import { join as
|
|
10013
|
-
import { decorator as
|
|
10014
|
-
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";
|
|
10015
10225
|
var {$ } = globalThis.Bun;
|
|
10016
10226
|
var COMMIT_TYPE_TO_CATEGORY = {
|
|
10017
10227
|
feat: "Added",
|
|
@@ -10034,7 +10244,7 @@ class MakeReleaseCommand {
|
|
|
10034
10244
|
return "Release packages with version bump, changelog, and git tag";
|
|
10035
10245
|
}
|
|
10036
10246
|
async run() {
|
|
10037
|
-
const logger = new
|
|
10247
|
+
const logger = new TerminalLogger25;
|
|
10038
10248
|
const cwd = process.cwd();
|
|
10039
10249
|
const dirs = [];
|
|
10040
10250
|
for (const { name, type } of [
|
|
@@ -10042,8 +10252,8 @@ class MakeReleaseCommand {
|
|
|
10042
10252
|
{ name: "modules", type: "module" }
|
|
10043
10253
|
]) {
|
|
10044
10254
|
try {
|
|
10045
|
-
const entries = await readdir(
|
|
10046
|
-
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 })));
|
|
10047
10257
|
} catch {}
|
|
10048
10258
|
}
|
|
10049
10259
|
const logOptions = { showTimestamp: false, showArrow: false, useSymbol: true };
|
|
@@ -10053,8 +10263,8 @@ class MakeReleaseCommand {
|
|
|
10053
10263
|
}
|
|
10054
10264
|
let releasedCount = 0;
|
|
10055
10265
|
for (const dir of dirs) {
|
|
10056
|
-
const fullDir =
|
|
10057
|
-
const pkgJsonPath =
|
|
10266
|
+
const fullDir = join26(cwd, dir.base);
|
|
10267
|
+
const pkgJsonPath = join26(fullDir, "package.json");
|
|
10058
10268
|
const pkgJsonFile = Bun.file(pkgJsonPath);
|
|
10059
10269
|
if (!await pkgJsonFile.exists()) {
|
|
10060
10270
|
continue;
|
|
@@ -10072,7 +10282,7 @@ class MakeReleaseCommand {
|
|
|
10072
10282
|
await Bun.write(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}
|
|
10073
10283
|
`);
|
|
10074
10284
|
await this.updateChangelog(fullDir, newVersion, tag, commits);
|
|
10075
|
-
await this.gitAdd(
|
|
10285
|
+
await this.gitAdd(join26(dir.base, "package.json"), join26(dir.base, "CHANGELOG.md"));
|
|
10076
10286
|
await this.gitCommit(`chore(release): ${pkgJson.name}@${newVersion}`);
|
|
10077
10287
|
await this.gitTag(tag, `chore(release): ${pkgJson.name}@${newVersion}`);
|
|
10078
10288
|
logger.success(`${pkgJson.name}@${newVersion} released (${bumpType} bump, ${commits.length} commit(s))`, undefined, logOptions);
|
|
@@ -10173,7 +10383,7 @@ class MakeReleaseCommand {
|
|
|
10173
10383
|
}
|
|
10174
10384
|
}
|
|
10175
10385
|
async updateChangelog(dir, version, tag, commits) {
|
|
10176
|
-
const changelogPath =
|
|
10386
|
+
const changelogPath = join26(dir, "CHANGELOG.md");
|
|
10177
10387
|
const today = new Date().toISOString().split("T")[0];
|
|
10178
10388
|
const repoUrl = await this.getRepoUrl();
|
|
10179
10389
|
const grouped = new Map;
|
|
@@ -10250,12 +10460,12 @@ ${section}
|
|
|
10250
10460
|
}
|
|
10251
10461
|
}
|
|
10252
10462
|
MakeReleaseCommand = __legacyDecorateClassTS([
|
|
10253
|
-
|
|
10463
|
+
decorator26.command()
|
|
10254
10464
|
], MakeReleaseCommand);
|
|
10255
10465
|
// src/commands/MakeRepositoryCommand.ts
|
|
10256
|
-
import { join as
|
|
10257
|
-
import { decorator as
|
|
10258
|
-
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";
|
|
10259
10469
|
import { toPascalCase as toPascalCase14 } from "@ooneex/utils";
|
|
10260
10470
|
|
|
10261
10471
|
// src/templates/repository.test.txt
|
|
@@ -10469,28 +10679,28 @@ class MakeRepositoryCommand {
|
|
|
10469
10679
|
if (module) {
|
|
10470
10680
|
await ensureModule(module);
|
|
10471
10681
|
}
|
|
10472
|
-
const base = module ?
|
|
10473
|
-
const repositoriesLocalDir =
|
|
10474
|
-
const repositoriesDir =
|
|
10475
|
-
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`);
|
|
10476
10686
|
await Bun.write(filePath, content);
|
|
10477
10687
|
const testContent = repository_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
10478
|
-
const testsLocalDir =
|
|
10479
|
-
const testsDir =
|
|
10480
|
-
const testFilePath =
|
|
10688
|
+
const testsLocalDir = join27(base, "tests", "repositories");
|
|
10689
|
+
const testsDir = join27(process.cwd(), testsLocalDir);
|
|
10690
|
+
const testFilePath = join27(testsDir, `${name}Repository.spec.ts`);
|
|
10481
10691
|
await Bun.write(testFilePath, testContent);
|
|
10482
|
-
const logger = new
|
|
10483
|
-
logger.success(`${
|
|
10692
|
+
const logger = new TerminalLogger26;
|
|
10693
|
+
logger.success(`${join27(repositoriesLocalDir, name)}Repository.ts created successfully`, undefined, {
|
|
10484
10694
|
showTimestamp: false,
|
|
10485
10695
|
showArrow: false,
|
|
10486
10696
|
useSymbol: true
|
|
10487
10697
|
});
|
|
10488
|
-
logger.success(`${
|
|
10698
|
+
logger.success(`${join27(testsLocalDir, name)}Repository.spec.ts created successfully`, undefined, {
|
|
10489
10699
|
showTimestamp: false,
|
|
10490
10700
|
showArrow: false,
|
|
10491
10701
|
useSymbol: true
|
|
10492
10702
|
});
|
|
10493
|
-
const packageJsonPath =
|
|
10703
|
+
const packageJsonPath = join27(process.cwd(), "package.json");
|
|
10494
10704
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
10495
10705
|
const deps = packageJson.dependencies ?? {};
|
|
10496
10706
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -10505,11 +10715,11 @@ class MakeRepositoryCommand {
|
|
|
10505
10715
|
}
|
|
10506
10716
|
}
|
|
10507
10717
|
MakeRepositoryCommand = __legacyDecorateClassTS([
|
|
10508
|
-
|
|
10718
|
+
decorator27.command()
|
|
10509
10719
|
], MakeRepositoryCommand);
|
|
10510
10720
|
// src/commands/MakeResourceBookCommand.ts
|
|
10511
|
-
import { join as
|
|
10512
|
-
import { decorator as
|
|
10721
|
+
import { join as join29 } from "path";
|
|
10722
|
+
import { decorator as decorator29 } from "@ooneex/command";
|
|
10513
10723
|
var {Glob } = globalThis.Bun;
|
|
10514
10724
|
|
|
10515
10725
|
// src/templates/resources/book/BookEntity.txt
|
|
@@ -11205,9 +11415,9 @@ export class UpdateBookService implements IService {
|
|
|
11205
11415
|
`;
|
|
11206
11416
|
|
|
11207
11417
|
// src/commands/MakeServiceCommand.ts
|
|
11208
|
-
import { join as
|
|
11209
|
-
import { decorator as
|
|
11210
|
-
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";
|
|
11211
11421
|
import { toPascalCase as toPascalCase15 } from "@ooneex/utils";
|
|
11212
11422
|
|
|
11213
11423
|
// src/templates/service.test.txt
|
|
@@ -11259,28 +11469,28 @@ class MakeServiceCommand {
|
|
|
11259
11469
|
if (module) {
|
|
11260
11470
|
await ensureModule(module);
|
|
11261
11471
|
}
|
|
11262
|
-
const base = module ?
|
|
11263
|
-
const serviceLocalDir =
|
|
11264
|
-
const serviceDir =
|
|
11265
|
-
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`);
|
|
11266
11476
|
await Bun.write(filePath, content);
|
|
11267
11477
|
const testContent = service_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
11268
|
-
const testsLocalDir =
|
|
11269
|
-
const testsDir =
|
|
11270
|
-
const testFilePath =
|
|
11478
|
+
const testsLocalDir = join28(base, "tests", "services");
|
|
11479
|
+
const testsDir = join28(process.cwd(), testsLocalDir);
|
|
11480
|
+
const testFilePath = join28(testsDir, `${name}Service.spec.ts`);
|
|
11271
11481
|
await Bun.write(testFilePath, testContent);
|
|
11272
|
-
const logger = new
|
|
11273
|
-
logger.success(`${
|
|
11482
|
+
const logger = new TerminalLogger27;
|
|
11483
|
+
logger.success(`${join28(serviceLocalDir, name)}Service.ts created successfully`, undefined, {
|
|
11274
11484
|
showTimestamp: false,
|
|
11275
11485
|
showArrow: false,
|
|
11276
11486
|
useSymbol: true
|
|
11277
11487
|
});
|
|
11278
|
-
logger.success(`${
|
|
11488
|
+
logger.success(`${join28(testsLocalDir, name)}Service.spec.ts created successfully`, undefined, {
|
|
11279
11489
|
showTimestamp: false,
|
|
11280
11490
|
showArrow: false,
|
|
11281
11491
|
useSymbol: true
|
|
11282
11492
|
});
|
|
11283
|
-
const packageJsonPath =
|
|
11493
|
+
const packageJsonPath = join28(process.cwd(), "package.json");
|
|
11284
11494
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
11285
11495
|
const deps = packageJson.dependencies ?? {};
|
|
11286
11496
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -11295,7 +11505,7 @@ class MakeServiceCommand {
|
|
|
11295
11505
|
}
|
|
11296
11506
|
}
|
|
11297
11507
|
MakeServiceCommand = __legacyDecorateClassTS([
|
|
11298
|
-
|
|
11508
|
+
decorator28.command()
|
|
11299
11509
|
], MakeServiceCommand);
|
|
11300
11510
|
|
|
11301
11511
|
// src/commands/MakeResourceBookCommand.ts
|
|
@@ -11308,7 +11518,7 @@ class MakeResourceBookCommand {
|
|
|
11308
11518
|
}
|
|
11309
11519
|
async run() {
|
|
11310
11520
|
const module = "book";
|
|
11311
|
-
const base =
|
|
11521
|
+
const base = join29("modules", module);
|
|
11312
11522
|
const makeModuleCommand = new MakeModuleCommand;
|
|
11313
11523
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
11314
11524
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -11328,26 +11538,26 @@ class MakeResourceBookCommand {
|
|
|
11328
11538
|
for (const controller of controllers) {
|
|
11329
11539
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
11330
11540
|
}
|
|
11331
|
-
const controllersDir =
|
|
11332
|
-
await Bun.write(
|
|
11333
|
-
await Bun.write(
|
|
11334
|
-
await Bun.write(
|
|
11335
|
-
await Bun.write(
|
|
11336
|
-
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);
|
|
11337
11547
|
const makeServiceCommand = new MakeServiceCommand;
|
|
11338
11548
|
const services = ["CreateBook", "GetBook", "ListBooks", "UpdateBook", "DeleteBook"];
|
|
11339
11549
|
for (const name of services) {
|
|
11340
11550
|
await makeServiceCommand.run({ name, module });
|
|
11341
11551
|
}
|
|
11342
|
-
const servicesDir =
|
|
11343
|
-
await Bun.write(
|
|
11344
|
-
await Bun.write(
|
|
11345
|
-
await Bun.write(
|
|
11346
|
-
await Bun.write(
|
|
11347
|
-
await Bun.write(
|
|
11348
|
-
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");
|
|
11349
11559
|
await Bun.write(entityPath, BookEntity_default);
|
|
11350
|
-
const migrationsDir =
|
|
11560
|
+
const migrationsDir = join29(process.cwd(), base, "src", "migrations");
|
|
11351
11561
|
const glob = new Glob("Migration*.ts");
|
|
11352
11562
|
for await (const file of glob.scan(migrationsDir)) {
|
|
11353
11563
|
if (file === "migrations.ts")
|
|
@@ -11355,18 +11565,18 @@ class MakeResourceBookCommand {
|
|
|
11355
11565
|
const name = file.replace(/\.ts$/, "");
|
|
11356
11566
|
const version = name.replace("Migration", "");
|
|
11357
11567
|
const content = BookMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
11358
|
-
await Bun.write(
|
|
11568
|
+
await Bun.write(join29(migrationsDir, file), content);
|
|
11359
11569
|
}
|
|
11360
|
-
const repositoryPath =
|
|
11570
|
+
const repositoryPath = join29(process.cwd(), base, "src", "repositories", "BookRepository.ts");
|
|
11361
11571
|
await Bun.write(repositoryPath, BookRepository_default);
|
|
11362
11572
|
}
|
|
11363
11573
|
}
|
|
11364
11574
|
MakeResourceBookCommand = __legacyDecorateClassTS([
|
|
11365
|
-
|
|
11575
|
+
decorator29.command()
|
|
11366
11576
|
], MakeResourceBookCommand);
|
|
11367
11577
|
// src/commands/MakeResourceCalendarEventCommand.ts
|
|
11368
|
-
import { join as
|
|
11369
|
-
import { decorator as
|
|
11578
|
+
import { join as join30 } from "path";
|
|
11579
|
+
import { decorator as decorator30 } from "@ooneex/command";
|
|
11370
11580
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
11371
11581
|
|
|
11372
11582
|
// src/templates/resources/calendar-event/CalendarEventEntity.txt
|
|
@@ -12058,7 +12268,7 @@ class MakeResourceCalendarEventCommand {
|
|
|
12058
12268
|
}
|
|
12059
12269
|
async run() {
|
|
12060
12270
|
const module = "calendar-event";
|
|
12061
|
-
const base =
|
|
12271
|
+
const base = join30("modules", module);
|
|
12062
12272
|
const makeModuleCommand = new MakeModuleCommand;
|
|
12063
12273
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
12064
12274
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -12093,12 +12303,12 @@ class MakeResourceCalendarEventCommand {
|
|
|
12093
12303
|
for (const controller of controllers) {
|
|
12094
12304
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
12095
12305
|
}
|
|
12096
|
-
const controllersDir =
|
|
12097
|
-
await Bun.write(
|
|
12098
|
-
await Bun.write(
|
|
12099
|
-
await Bun.write(
|
|
12100
|
-
await Bun.write(
|
|
12101
|
-
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);
|
|
12102
12312
|
const makeServiceCommand = new MakeServiceCommand;
|
|
12103
12313
|
const services = [
|
|
12104
12314
|
"CreateCalendarEvent",
|
|
@@ -12110,15 +12320,15 @@ class MakeResourceCalendarEventCommand {
|
|
|
12110
12320
|
for (const name of services) {
|
|
12111
12321
|
await makeServiceCommand.run({ name, module });
|
|
12112
12322
|
}
|
|
12113
|
-
const servicesDir =
|
|
12114
|
-
await Bun.write(
|
|
12115
|
-
await Bun.write(
|
|
12116
|
-
await Bun.write(
|
|
12117
|
-
await Bun.write(
|
|
12118
|
-
await Bun.write(
|
|
12119
|
-
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");
|
|
12120
12330
|
await Bun.write(entityPath, CalendarEventEntity_default);
|
|
12121
|
-
const migrationsDir =
|
|
12331
|
+
const migrationsDir = join30(process.cwd(), base, "src", "migrations");
|
|
12122
12332
|
const glob = new Glob2("Migration*.ts");
|
|
12123
12333
|
for await (const file of glob.scan(migrationsDir)) {
|
|
12124
12334
|
if (file === "migrations.ts")
|
|
@@ -12126,18 +12336,18 @@ class MakeResourceCalendarEventCommand {
|
|
|
12126
12336
|
const name = file.replace(/\.ts$/, "");
|
|
12127
12337
|
const version = name.replace("Migration", "");
|
|
12128
12338
|
const content = CalendarEventMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
12129
|
-
await Bun.write(
|
|
12339
|
+
await Bun.write(join30(migrationsDir, file), content);
|
|
12130
12340
|
}
|
|
12131
|
-
const repositoryPath =
|
|
12341
|
+
const repositoryPath = join30(process.cwd(), base, "src", "repositories", "CalendarEventRepository.ts");
|
|
12132
12342
|
await Bun.write(repositoryPath, CalendarEventRepository_default);
|
|
12133
12343
|
}
|
|
12134
12344
|
}
|
|
12135
12345
|
MakeResourceCalendarEventCommand = __legacyDecorateClassTS([
|
|
12136
|
-
|
|
12346
|
+
decorator30.command()
|
|
12137
12347
|
], MakeResourceCalendarEventCommand);
|
|
12138
12348
|
// src/commands/MakeResourceCategoryCommand.ts
|
|
12139
|
-
import { join as
|
|
12140
|
-
import { decorator as
|
|
12349
|
+
import { join as join31 } from "path";
|
|
12350
|
+
import { decorator as decorator31 } from "@ooneex/command";
|
|
12141
12351
|
var {Glob: Glob3 } = globalThis.Bun;
|
|
12142
12352
|
|
|
12143
12353
|
// src/templates/resources/category/CategoryEntity.txt
|
|
@@ -12728,7 +12938,7 @@ class MakeResourceCategoryCommand {
|
|
|
12728
12938
|
}
|
|
12729
12939
|
async run() {
|
|
12730
12940
|
const module = "category";
|
|
12731
|
-
const base =
|
|
12941
|
+
const base = join31("modules", module);
|
|
12732
12942
|
const makeModuleCommand = new MakeModuleCommand;
|
|
12733
12943
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
12734
12944
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -12763,26 +12973,26 @@ class MakeResourceCategoryCommand {
|
|
|
12763
12973
|
for (const controller of controllers) {
|
|
12764
12974
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
12765
12975
|
}
|
|
12766
|
-
const controllersDir =
|
|
12767
|
-
await Bun.write(
|
|
12768
|
-
await Bun.write(
|
|
12769
|
-
await Bun.write(
|
|
12770
|
-
await Bun.write(
|
|
12771
|
-
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);
|
|
12772
12982
|
const makeServiceCommand = new MakeServiceCommand;
|
|
12773
12983
|
const services = ["CreateCategory", "GetCategory", "ListCategories", "UpdateCategory", "DeleteCategory"];
|
|
12774
12984
|
for (const name of services) {
|
|
12775
12985
|
await makeServiceCommand.run({ name, module });
|
|
12776
12986
|
}
|
|
12777
|
-
const servicesDir =
|
|
12778
|
-
await Bun.write(
|
|
12779
|
-
await Bun.write(
|
|
12780
|
-
await Bun.write(
|
|
12781
|
-
await Bun.write(
|
|
12782
|
-
await Bun.write(
|
|
12783
|
-
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");
|
|
12784
12994
|
await Bun.write(entityPath, CategoryEntity_default);
|
|
12785
|
-
const migrationsDir =
|
|
12995
|
+
const migrationsDir = join31(process.cwd(), base, "src", "migrations");
|
|
12786
12996
|
const glob = new Glob3("Migration*.ts");
|
|
12787
12997
|
for await (const file of glob.scan(migrationsDir)) {
|
|
12788
12998
|
if (file === "migrations.ts")
|
|
@@ -12790,18 +13000,18 @@ class MakeResourceCategoryCommand {
|
|
|
12790
13000
|
const name = file.replace(/\.ts$/, "");
|
|
12791
13001
|
const version = name.replace("Migration", "");
|
|
12792
13002
|
const content = CategoryMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
12793
|
-
await Bun.write(
|
|
13003
|
+
await Bun.write(join31(migrationsDir, file), content);
|
|
12794
13004
|
}
|
|
12795
|
-
const repositoryPath =
|
|
13005
|
+
const repositoryPath = join31(process.cwd(), base, "src", "repositories", "CategoryRepository.ts");
|
|
12796
13006
|
await Bun.write(repositoryPath, CategoryRepository_default);
|
|
12797
13007
|
}
|
|
12798
13008
|
}
|
|
12799
13009
|
MakeResourceCategoryCommand = __legacyDecorateClassTS([
|
|
12800
|
-
|
|
13010
|
+
decorator31.command()
|
|
12801
13011
|
], MakeResourceCategoryCommand);
|
|
12802
13012
|
// src/commands/MakeResourceColorCommand.ts
|
|
12803
|
-
import { join as
|
|
12804
|
-
import { decorator as
|
|
13013
|
+
import { join as join33 } from "path";
|
|
13014
|
+
import { decorator as decorator33 } from "@ooneex/command";
|
|
12805
13015
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
12806
13016
|
|
|
12807
13017
|
// src/templates/resources/color/ColorEntity.txt
|
|
@@ -13593,9 +13803,9 @@ export class UpdateColorService implements IService {
|
|
|
13593
13803
|
`;
|
|
13594
13804
|
|
|
13595
13805
|
// src/commands/MakeSeedCommand.ts
|
|
13596
|
-
import { join as
|
|
13597
|
-
import { decorator as
|
|
13598
|
-
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";
|
|
13599
13809
|
import { seedCreate } from "@ooneex/seeds";
|
|
13600
13810
|
|
|
13601
13811
|
// src/templates/module/seed.run.txt
|
|
@@ -13634,18 +13844,19 @@ class MakeSeedCommand {
|
|
|
13634
13844
|
if (module) {
|
|
13635
13845
|
await ensureModule(module);
|
|
13636
13846
|
}
|
|
13637
|
-
const base = module ?
|
|
13847
|
+
const base = module ? join32("modules", module) : ".";
|
|
13638
13848
|
const { seedPath: filePath, dataPath } = await seedCreate({
|
|
13639
13849
|
name,
|
|
13640
|
-
seedsDir:
|
|
13641
|
-
testsDir:
|
|
13850
|
+
seedsDir: join32(base, "src", "seeds"),
|
|
13851
|
+
testsDir: join32(base, "tests", "seeds"),
|
|
13852
|
+
module: module ?? ""
|
|
13642
13853
|
});
|
|
13643
|
-
const binSeedRunPath =
|
|
13854
|
+
const binSeedRunPath = join32(process.cwd(), base, "bin", "seed", "run.ts");
|
|
13644
13855
|
const binSeedRunFile = Bun.file(binSeedRunPath);
|
|
13645
13856
|
if (!await binSeedRunFile.exists()) {
|
|
13646
13857
|
await Bun.write(binSeedRunPath, seed_run_default.replace(/{{name}}/g, module ?? ""));
|
|
13647
13858
|
}
|
|
13648
|
-
const logger = new
|
|
13859
|
+
const logger = new TerminalLogger28;
|
|
13649
13860
|
logger.success(`${filePath} created successfully`, undefined, {
|
|
13650
13861
|
showTimestamp: false,
|
|
13651
13862
|
showArrow: false,
|
|
@@ -13659,7 +13870,7 @@ class MakeSeedCommand {
|
|
|
13659
13870
|
}
|
|
13660
13871
|
}
|
|
13661
13872
|
MakeSeedCommand = __legacyDecorateClassTS([
|
|
13662
|
-
|
|
13873
|
+
decorator32.command()
|
|
13663
13874
|
], MakeSeedCommand);
|
|
13664
13875
|
|
|
13665
13876
|
// src/commands/MakeResourceColorCommand.ts
|
|
@@ -13672,7 +13883,7 @@ class MakeResourceColorCommand {
|
|
|
13672
13883
|
}
|
|
13673
13884
|
async run() {
|
|
13674
13885
|
const module = "color";
|
|
13675
|
-
const base =
|
|
13886
|
+
const base = join33("modules", module);
|
|
13676
13887
|
const makeModuleCommand = new MakeModuleCommand;
|
|
13677
13888
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
13678
13889
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -13695,26 +13906,26 @@ class MakeResourceColorCommand {
|
|
|
13695
13906
|
for (const controller of controllers) {
|
|
13696
13907
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
13697
13908
|
}
|
|
13698
|
-
const controllersDir =
|
|
13699
|
-
await Bun.write(
|
|
13700
|
-
await Bun.write(
|
|
13701
|
-
await Bun.write(
|
|
13702
|
-
await Bun.write(
|
|
13703
|
-
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);
|
|
13704
13915
|
const makeServiceCommand = new MakeServiceCommand;
|
|
13705
13916
|
const services = ["CreateColor", "GetColor", "ListColors", "UpdateColor", "DeleteColor"];
|
|
13706
13917
|
for (const name of services) {
|
|
13707
13918
|
await makeServiceCommand.run({ name, module });
|
|
13708
13919
|
}
|
|
13709
|
-
const servicesDir =
|
|
13710
|
-
await Bun.write(
|
|
13711
|
-
await Bun.write(
|
|
13712
|
-
await Bun.write(
|
|
13713
|
-
await Bun.write(
|
|
13714
|
-
await Bun.write(
|
|
13715
|
-
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");
|
|
13716
13927
|
await Bun.write(entityPath, ColorEntity_default);
|
|
13717
|
-
const migrationsDir =
|
|
13928
|
+
const migrationsDir = join33(process.cwd(), base, "src", "migrations");
|
|
13718
13929
|
const glob = new Glob4("Migration*.ts");
|
|
13719
13930
|
for await (const file of glob.scan(migrationsDir)) {
|
|
13720
13931
|
if (file === "migrations.ts")
|
|
@@ -13722,23 +13933,23 @@ class MakeResourceColorCommand {
|
|
|
13722
13933
|
const name = file.replace(/\.ts$/, "");
|
|
13723
13934
|
const version = name.replace("Migration", "");
|
|
13724
13935
|
const content = ColorMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
13725
|
-
await Bun.write(
|
|
13936
|
+
await Bun.write(join33(migrationsDir, file), content);
|
|
13726
13937
|
}
|
|
13727
|
-
const repositoryPath =
|
|
13938
|
+
const repositoryPath = join33(process.cwd(), base, "src", "repositories", "ColorRepository.ts");
|
|
13728
13939
|
await Bun.write(repositoryPath, ColorRepository_default);
|
|
13729
13940
|
const makeSeedCommand = new MakeSeedCommand;
|
|
13730
13941
|
await makeSeedCommand.run({ name: "Color", module });
|
|
13731
|
-
const seedsDir =
|
|
13732
|
-
await Bun.write(
|
|
13733
|
-
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);
|
|
13734
13945
|
}
|
|
13735
13946
|
}
|
|
13736
13947
|
MakeResourceColorCommand = __legacyDecorateClassTS([
|
|
13737
|
-
|
|
13948
|
+
decorator33.command()
|
|
13738
13949
|
], MakeResourceColorCommand);
|
|
13739
13950
|
// src/commands/MakeResourceDiscountCommand.ts
|
|
13740
|
-
import { join as
|
|
13741
|
-
import { decorator as
|
|
13951
|
+
import { join as join34 } from "path";
|
|
13952
|
+
import { decorator as decorator34 } from "@ooneex/command";
|
|
13742
13953
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
13743
13954
|
|
|
13744
13955
|
// src/templates/resources/discount/controllers/CreateDiscountController.txt
|
|
@@ -14381,7 +14592,7 @@ class MakeResourceDiscountCommand {
|
|
|
14381
14592
|
}
|
|
14382
14593
|
async run() {
|
|
14383
14594
|
const module = "discount";
|
|
14384
|
-
const base =
|
|
14595
|
+
const base = join34("modules", module);
|
|
14385
14596
|
const makeModuleCommand = new MakeModuleCommand;
|
|
14386
14597
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
14387
14598
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -14416,26 +14627,26 @@ class MakeResourceDiscountCommand {
|
|
|
14416
14627
|
for (const controller of controllers) {
|
|
14417
14628
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
14418
14629
|
}
|
|
14419
|
-
const controllersDir =
|
|
14420
|
-
await Bun.write(
|
|
14421
|
-
await Bun.write(
|
|
14422
|
-
await Bun.write(
|
|
14423
|
-
await Bun.write(
|
|
14424
|
-
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);
|
|
14425
14636
|
const makeServiceCommand = new MakeServiceCommand;
|
|
14426
14637
|
const services = ["CreateDiscount", "GetDiscount", "ListDiscounts", "UpdateDiscount", "DeleteDiscount"];
|
|
14427
14638
|
for (const name of services) {
|
|
14428
14639
|
await makeServiceCommand.run({ name, module });
|
|
14429
14640
|
}
|
|
14430
|
-
const servicesDir =
|
|
14431
|
-
await Bun.write(
|
|
14432
|
-
await Bun.write(
|
|
14433
|
-
await Bun.write(
|
|
14434
|
-
await Bun.write(
|
|
14435
|
-
await Bun.write(
|
|
14436
|
-
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");
|
|
14437
14648
|
await Bun.write(entityPath, DiscountEntity_default);
|
|
14438
|
-
const migrationsDir =
|
|
14649
|
+
const migrationsDir = join34(process.cwd(), base, "src", "migrations");
|
|
14439
14650
|
const glob = new Glob5("Migration*.ts");
|
|
14440
14651
|
for await (const file of glob.scan(migrationsDir)) {
|
|
14441
14652
|
if (file === "migrations.ts")
|
|
@@ -14443,18 +14654,18 @@ class MakeResourceDiscountCommand {
|
|
|
14443
14654
|
const name = file.replace(/\.ts$/, "");
|
|
14444
14655
|
const version = name.replace("Migration", "");
|
|
14445
14656
|
const content = DiscountMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
14446
|
-
await Bun.write(
|
|
14657
|
+
await Bun.write(join34(migrationsDir, file), content);
|
|
14447
14658
|
}
|
|
14448
|
-
const repositoryPath =
|
|
14659
|
+
const repositoryPath = join34(process.cwd(), base, "src", "repositories", "DiscountRepository.ts");
|
|
14449
14660
|
await Bun.write(repositoryPath, DiscountRepository_default);
|
|
14450
14661
|
}
|
|
14451
14662
|
}
|
|
14452
14663
|
MakeResourceDiscountCommand = __legacyDecorateClassTS([
|
|
14453
|
-
|
|
14664
|
+
decorator34.command()
|
|
14454
14665
|
], MakeResourceDiscountCommand);
|
|
14455
14666
|
// src/commands/MakeResourceFolderCommand.ts
|
|
14456
|
-
import { join as
|
|
14457
|
-
import { decorator as
|
|
14667
|
+
import { join as join35 } from "path";
|
|
14668
|
+
import { decorator as decorator35 } from "@ooneex/command";
|
|
14458
14669
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
14459
14670
|
|
|
14460
14671
|
// src/templates/resources/folder/controllers/CreateFolderController.txt
|
|
@@ -15081,7 +15292,7 @@ class MakeResourceFolderCommand {
|
|
|
15081
15292
|
}
|
|
15082
15293
|
async run() {
|
|
15083
15294
|
const module = "folder";
|
|
15084
|
-
const base =
|
|
15295
|
+
const base = join35("modules", module);
|
|
15085
15296
|
const makeModuleCommand = new MakeModuleCommand;
|
|
15086
15297
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
15087
15298
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -15116,26 +15327,26 @@ class MakeResourceFolderCommand {
|
|
|
15116
15327
|
for (const controller of controllers) {
|
|
15117
15328
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
15118
15329
|
}
|
|
15119
|
-
const controllersDir =
|
|
15120
|
-
await Bun.write(
|
|
15121
|
-
await Bun.write(
|
|
15122
|
-
await Bun.write(
|
|
15123
|
-
await Bun.write(
|
|
15124
|
-
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);
|
|
15125
15336
|
const makeServiceCommand = new MakeServiceCommand;
|
|
15126
15337
|
const services = ["CreateFolder", "GetFolder", "ListFolders", "UpdateFolder", "DeleteFolder"];
|
|
15127
15338
|
for (const name of services) {
|
|
15128
15339
|
await makeServiceCommand.run({ name, module });
|
|
15129
15340
|
}
|
|
15130
|
-
const servicesDir =
|
|
15131
|
-
await Bun.write(
|
|
15132
|
-
await Bun.write(
|
|
15133
|
-
await Bun.write(
|
|
15134
|
-
await Bun.write(
|
|
15135
|
-
await Bun.write(
|
|
15136
|
-
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");
|
|
15137
15348
|
await Bun.write(entityPath, FolderEntity_default);
|
|
15138
|
-
const migrationsDir =
|
|
15349
|
+
const migrationsDir = join35(process.cwd(), base, "src", "migrations");
|
|
15139
15350
|
const glob = new Glob6("Migration*.ts");
|
|
15140
15351
|
for await (const file of glob.scan(migrationsDir)) {
|
|
15141
15352
|
if (file === "migrations.ts")
|
|
@@ -15143,18 +15354,18 @@ class MakeResourceFolderCommand {
|
|
|
15143
15354
|
const name = file.replace(/\.ts$/, "");
|
|
15144
15355
|
const version = name.replace("Migration", "");
|
|
15145
15356
|
const content = FolderMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
15146
|
-
await Bun.write(
|
|
15357
|
+
await Bun.write(join35(migrationsDir, file), content);
|
|
15147
15358
|
}
|
|
15148
|
-
const repositoryPath =
|
|
15359
|
+
const repositoryPath = join35(process.cwd(), base, "src", "repositories", "FolderRepository.ts");
|
|
15149
15360
|
await Bun.write(repositoryPath, FolderRepository_default);
|
|
15150
15361
|
}
|
|
15151
15362
|
}
|
|
15152
15363
|
MakeResourceFolderCommand = __legacyDecorateClassTS([
|
|
15153
|
-
|
|
15364
|
+
decorator35.command()
|
|
15154
15365
|
], MakeResourceFolderCommand);
|
|
15155
15366
|
// src/commands/MakeResourceImageCommand.ts
|
|
15156
|
-
import { join as
|
|
15157
|
-
import { decorator as
|
|
15367
|
+
import { join as join36 } from "path";
|
|
15368
|
+
import { decorator as decorator36 } from "@ooneex/command";
|
|
15158
15369
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
15159
15370
|
|
|
15160
15371
|
// src/templates/resources/image/controllers/CreateImageController.txt
|
|
@@ -15820,7 +16031,7 @@ class MakeResourceImageCommand {
|
|
|
15820
16031
|
}
|
|
15821
16032
|
async run() {
|
|
15822
16033
|
const module = "image";
|
|
15823
|
-
const base =
|
|
16034
|
+
const base = join36("modules", module);
|
|
15824
16035
|
const makeModuleCommand = new MakeModuleCommand;
|
|
15825
16036
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
15826
16037
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -15855,26 +16066,26 @@ class MakeResourceImageCommand {
|
|
|
15855
16066
|
for (const controller of controllers) {
|
|
15856
16067
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
15857
16068
|
}
|
|
15858
|
-
const controllersDir =
|
|
15859
|
-
await Bun.write(
|
|
15860
|
-
await Bun.write(
|
|
15861
|
-
await Bun.write(
|
|
15862
|
-
await Bun.write(
|
|
15863
|
-
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);
|
|
15864
16075
|
const makeServiceCommand = new MakeServiceCommand;
|
|
15865
16076
|
const services = ["CreateImage", "GetImage", "ListImages", "UpdateImage", "DeleteImage"];
|
|
15866
16077
|
for (const name of services) {
|
|
15867
16078
|
await makeServiceCommand.run({ name, module });
|
|
15868
16079
|
}
|
|
15869
|
-
const servicesDir =
|
|
15870
|
-
await Bun.write(
|
|
15871
|
-
await Bun.write(
|
|
15872
|
-
await Bun.write(
|
|
15873
|
-
await Bun.write(
|
|
15874
|
-
await Bun.write(
|
|
15875
|
-
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");
|
|
15876
16087
|
await Bun.write(entityPath, ImageEntity_default);
|
|
15877
|
-
const migrationsDir =
|
|
16088
|
+
const migrationsDir = join36(process.cwd(), base, "src", "migrations");
|
|
15878
16089
|
const glob = new Glob7("Migration*.ts");
|
|
15879
16090
|
for await (const file of glob.scan(migrationsDir)) {
|
|
15880
16091
|
if (file === "migrations.ts")
|
|
@@ -15882,18 +16093,18 @@ class MakeResourceImageCommand {
|
|
|
15882
16093
|
const name = file.replace(/\.ts$/, "");
|
|
15883
16094
|
const version = name.replace("Migration", "");
|
|
15884
16095
|
const content = ImageMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
15885
|
-
await Bun.write(
|
|
16096
|
+
await Bun.write(join36(migrationsDir, file), content);
|
|
15886
16097
|
}
|
|
15887
|
-
const repositoryPath =
|
|
16098
|
+
const repositoryPath = join36(process.cwd(), base, "src", "repositories", "ImageRepository.ts");
|
|
15888
16099
|
await Bun.write(repositoryPath, ImageRepository_default);
|
|
15889
16100
|
}
|
|
15890
16101
|
}
|
|
15891
16102
|
MakeResourceImageCommand = __legacyDecorateClassTS([
|
|
15892
|
-
|
|
16103
|
+
decorator36.command()
|
|
15893
16104
|
], MakeResourceImageCommand);
|
|
15894
16105
|
// src/commands/MakeResourceNoteCommand.ts
|
|
15895
|
-
import { join as
|
|
15896
|
-
import { decorator as
|
|
16106
|
+
import { join as join37 } from "path";
|
|
16107
|
+
import { decorator as decorator37 } from "@ooneex/command";
|
|
15897
16108
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15898
16109
|
|
|
15899
16110
|
// src/templates/resources/note/controllers/CreateNoteController.txt
|
|
@@ -16598,7 +16809,7 @@ class MakeResourceNoteCommand {
|
|
|
16598
16809
|
}
|
|
16599
16810
|
async run() {
|
|
16600
16811
|
const module = "note";
|
|
16601
|
-
const base =
|
|
16812
|
+
const base = join37("modules", module);
|
|
16602
16813
|
const makeModuleCommand = new MakeModuleCommand;
|
|
16603
16814
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
16604
16815
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -16633,26 +16844,26 @@ class MakeResourceNoteCommand {
|
|
|
16633
16844
|
for (const controller of controllers) {
|
|
16634
16845
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
16635
16846
|
}
|
|
16636
|
-
const controllersDir =
|
|
16637
|
-
await Bun.write(
|
|
16638
|
-
await Bun.write(
|
|
16639
|
-
await Bun.write(
|
|
16640
|
-
await Bun.write(
|
|
16641
|
-
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);
|
|
16642
16853
|
const makeServiceCommand = new MakeServiceCommand;
|
|
16643
16854
|
const services = ["CreateNote", "GetNote", "ListNotes", "UpdateNote", "DeleteNote"];
|
|
16644
16855
|
for (const name of services) {
|
|
16645
16856
|
await makeServiceCommand.run({ name, module });
|
|
16646
16857
|
}
|
|
16647
|
-
const servicesDir =
|
|
16648
|
-
await Bun.write(
|
|
16649
|
-
await Bun.write(
|
|
16650
|
-
await Bun.write(
|
|
16651
|
-
await Bun.write(
|
|
16652
|
-
await Bun.write(
|
|
16653
|
-
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");
|
|
16654
16865
|
await Bun.write(entityPath, NoteEntity_default);
|
|
16655
|
-
const migrationsDir =
|
|
16866
|
+
const migrationsDir = join37(process.cwd(), base, "src", "migrations");
|
|
16656
16867
|
const glob = new Glob8("Migration*.ts");
|
|
16657
16868
|
for await (const file of glob.scan(migrationsDir)) {
|
|
16658
16869
|
if (file === "migrations.ts")
|
|
@@ -16660,18 +16871,18 @@ class MakeResourceNoteCommand {
|
|
|
16660
16871
|
const name = file.replace(/\.ts$/, "");
|
|
16661
16872
|
const version = name.replace("Migration", "");
|
|
16662
16873
|
const content = NoteMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
16663
|
-
await Bun.write(
|
|
16874
|
+
await Bun.write(join37(migrationsDir, file), content);
|
|
16664
16875
|
}
|
|
16665
|
-
const repositoryPath =
|
|
16876
|
+
const repositoryPath = join37(process.cwd(), base, "src", "repositories", "NoteRepository.ts");
|
|
16666
16877
|
await Bun.write(repositoryPath, NoteRepository_default);
|
|
16667
16878
|
}
|
|
16668
16879
|
}
|
|
16669
16880
|
MakeResourceNoteCommand = __legacyDecorateClassTS([
|
|
16670
|
-
|
|
16881
|
+
decorator37.command()
|
|
16671
16882
|
], MakeResourceNoteCommand);
|
|
16672
16883
|
// src/commands/MakeResourceStatusCommand.ts
|
|
16673
|
-
import { join as
|
|
16674
|
-
import { decorator as
|
|
16884
|
+
import { join as join38 } from "path";
|
|
16885
|
+
import { decorator as decorator38 } from "@ooneex/command";
|
|
16675
16886
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
16676
16887
|
|
|
16677
16888
|
// src/templates/resources/status/controllers/CreateStatusController.txt
|
|
@@ -17532,7 +17743,7 @@ class MakeResourceStatusCommand {
|
|
|
17532
17743
|
}
|
|
17533
17744
|
async run() {
|
|
17534
17745
|
const module = "status";
|
|
17535
|
-
const base =
|
|
17746
|
+
const base = join38("modules", module);
|
|
17536
17747
|
const makeModuleCommand = new MakeModuleCommand;
|
|
17537
17748
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
17538
17749
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -17567,26 +17778,26 @@ class MakeResourceStatusCommand {
|
|
|
17567
17778
|
for (const controller of controllers) {
|
|
17568
17779
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
17569
17780
|
}
|
|
17570
|
-
const controllersDir =
|
|
17571
|
-
await Bun.write(
|
|
17572
|
-
await Bun.write(
|
|
17573
|
-
await Bun.write(
|
|
17574
|
-
await Bun.write(
|
|
17575
|
-
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);
|
|
17576
17787
|
const makeServiceCommand = new MakeServiceCommand;
|
|
17577
17788
|
const services = ["CreateStatus", "GetStatus", "ListStatuses", "UpdateStatus", "DeleteStatus"];
|
|
17578
17789
|
for (const name of services) {
|
|
17579
17790
|
await makeServiceCommand.run({ name, module });
|
|
17580
17791
|
}
|
|
17581
|
-
const servicesDir =
|
|
17582
|
-
await Bun.write(
|
|
17583
|
-
await Bun.write(
|
|
17584
|
-
await Bun.write(
|
|
17585
|
-
await Bun.write(
|
|
17586
|
-
await Bun.write(
|
|
17587
|
-
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");
|
|
17588
17799
|
await Bun.write(entityPath, StatusEntity_default);
|
|
17589
|
-
const migrationsDir =
|
|
17800
|
+
const migrationsDir = join38(process.cwd(), base, "src", "migrations");
|
|
17590
17801
|
const glob = new Glob9("Migration*.ts");
|
|
17591
17802
|
for await (const file of glob.scan(migrationsDir)) {
|
|
17592
17803
|
if (file === "migrations.ts")
|
|
@@ -17594,23 +17805,23 @@ class MakeResourceStatusCommand {
|
|
|
17594
17805
|
const name = file.replace(/\.ts$/, "");
|
|
17595
17806
|
const version = name.replace("Migration", "");
|
|
17596
17807
|
const content = StatusMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
17597
|
-
await Bun.write(
|
|
17808
|
+
await Bun.write(join38(migrationsDir, file), content);
|
|
17598
17809
|
}
|
|
17599
|
-
const repositoryPath =
|
|
17810
|
+
const repositoryPath = join38(process.cwd(), base, "src", "repositories", "StatusRepository.ts");
|
|
17600
17811
|
await Bun.write(repositoryPath, StatusRepository_default);
|
|
17601
17812
|
const makeSeedCommand = new MakeSeedCommand;
|
|
17602
17813
|
await makeSeedCommand.run({ name: "Status", module });
|
|
17603
|
-
const seedsDir =
|
|
17604
|
-
await Bun.write(
|
|
17605
|
-
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);
|
|
17606
17817
|
}
|
|
17607
17818
|
}
|
|
17608
17819
|
MakeResourceStatusCommand = __legacyDecorateClassTS([
|
|
17609
|
-
|
|
17820
|
+
decorator38.command()
|
|
17610
17821
|
], MakeResourceStatusCommand);
|
|
17611
17822
|
// src/commands/MakeResourceTagCommand.ts
|
|
17612
|
-
import { join as
|
|
17613
|
-
import { decorator as
|
|
17823
|
+
import { join as join39 } from "path";
|
|
17824
|
+
import { decorator as decorator39 } from "@ooneex/command";
|
|
17614
17825
|
var {Glob: Glob10 } = globalThis.Bun;
|
|
17615
17826
|
|
|
17616
17827
|
// src/templates/resources/tag/controllers/CreateTagController.txt
|
|
@@ -18201,7 +18412,7 @@ class MakeResourceTagCommand {
|
|
|
18201
18412
|
}
|
|
18202
18413
|
async run() {
|
|
18203
18414
|
const module = "tag";
|
|
18204
|
-
const base =
|
|
18415
|
+
const base = join39("modules", module);
|
|
18205
18416
|
const makeModuleCommand = new MakeModuleCommand;
|
|
18206
18417
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
18207
18418
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -18236,26 +18447,26 @@ class MakeResourceTagCommand {
|
|
|
18236
18447
|
for (const controller of controllers) {
|
|
18237
18448
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
18238
18449
|
}
|
|
18239
|
-
const controllersDir =
|
|
18240
|
-
await Bun.write(
|
|
18241
|
-
await Bun.write(
|
|
18242
|
-
await Bun.write(
|
|
18243
|
-
await Bun.write(
|
|
18244
|
-
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);
|
|
18245
18456
|
const makeServiceCommand = new MakeServiceCommand;
|
|
18246
18457
|
const services = ["CreateTag", "GetTag", "ListTags", "UpdateTag", "DeleteTag"];
|
|
18247
18458
|
for (const name of services) {
|
|
18248
18459
|
await makeServiceCommand.run({ name, module });
|
|
18249
18460
|
}
|
|
18250
|
-
const servicesDir =
|
|
18251
|
-
await Bun.write(
|
|
18252
|
-
await Bun.write(
|
|
18253
|
-
await Bun.write(
|
|
18254
|
-
await Bun.write(
|
|
18255
|
-
await Bun.write(
|
|
18256
|
-
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");
|
|
18257
18468
|
await Bun.write(entityPath, TagEntity_default);
|
|
18258
|
-
const migrationsDir =
|
|
18469
|
+
const migrationsDir = join39(process.cwd(), base, "src", "migrations");
|
|
18259
18470
|
const glob = new Glob10("Migration*.ts");
|
|
18260
18471
|
for await (const file of glob.scan(migrationsDir)) {
|
|
18261
18472
|
if (file === "migrations.ts")
|
|
@@ -18263,18 +18474,18 @@ class MakeResourceTagCommand {
|
|
|
18263
18474
|
const name = file.replace(/\.ts$/, "");
|
|
18264
18475
|
const version = name.replace("Migration", "");
|
|
18265
18476
|
const content = TagMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
18266
|
-
await Bun.write(
|
|
18477
|
+
await Bun.write(join39(migrationsDir, file), content);
|
|
18267
18478
|
}
|
|
18268
|
-
const repositoryPath =
|
|
18479
|
+
const repositoryPath = join39(process.cwd(), base, "src", "repositories", "TagRepository.ts");
|
|
18269
18480
|
await Bun.write(repositoryPath, TagRepository_default);
|
|
18270
18481
|
}
|
|
18271
18482
|
}
|
|
18272
18483
|
MakeResourceTagCommand = __legacyDecorateClassTS([
|
|
18273
|
-
|
|
18484
|
+
decorator39.command()
|
|
18274
18485
|
], MakeResourceTagCommand);
|
|
18275
18486
|
// src/commands/MakeResourceTaskCommand.ts
|
|
18276
|
-
import { join as
|
|
18277
|
-
import { decorator as
|
|
18487
|
+
import { join as join40 } from "path";
|
|
18488
|
+
import { decorator as decorator40 } from "@ooneex/command";
|
|
18278
18489
|
var {Glob: Glob11 } = globalThis.Bun;
|
|
18279
18490
|
|
|
18280
18491
|
// src/templates/resources/task/controllers/CreateTaskController.txt
|
|
@@ -18947,7 +19158,7 @@ class MakeResourceTaskCommand {
|
|
|
18947
19158
|
}
|
|
18948
19159
|
async run() {
|
|
18949
19160
|
const module = "task";
|
|
18950
|
-
const base =
|
|
19161
|
+
const base = join40("modules", module);
|
|
18951
19162
|
const makeModuleCommand = new MakeModuleCommand;
|
|
18952
19163
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
18953
19164
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -18982,26 +19193,26 @@ class MakeResourceTaskCommand {
|
|
|
18982
19193
|
for (const controller of controllers) {
|
|
18983
19194
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
18984
19195
|
}
|
|
18985
|
-
const controllersDir =
|
|
18986
|
-
await Bun.write(
|
|
18987
|
-
await Bun.write(
|
|
18988
|
-
await Bun.write(
|
|
18989
|
-
await Bun.write(
|
|
18990
|
-
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);
|
|
18991
19202
|
const makeServiceCommand = new MakeServiceCommand;
|
|
18992
19203
|
const services = ["CreateTask", "GetTask", "ListTasks", "UpdateTask", "DeleteTask"];
|
|
18993
19204
|
for (const name of services) {
|
|
18994
19205
|
await makeServiceCommand.run({ name, module });
|
|
18995
19206
|
}
|
|
18996
|
-
const servicesDir =
|
|
18997
|
-
await Bun.write(
|
|
18998
|
-
await Bun.write(
|
|
18999
|
-
await Bun.write(
|
|
19000
|
-
await Bun.write(
|
|
19001
|
-
await Bun.write(
|
|
19002
|
-
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");
|
|
19003
19214
|
await Bun.write(entityPath, TaskEntity_default);
|
|
19004
|
-
const migrationsDir =
|
|
19215
|
+
const migrationsDir = join40(process.cwd(), base, "src", "migrations");
|
|
19005
19216
|
const glob = new Glob11("Migration*.ts");
|
|
19006
19217
|
for await (const file of glob.scan(migrationsDir)) {
|
|
19007
19218
|
if (file === "migrations.ts")
|
|
@@ -19009,18 +19220,18 @@ class MakeResourceTaskCommand {
|
|
|
19009
19220
|
const name = file.replace(/\.ts$/, "");
|
|
19010
19221
|
const version = name.replace("Migration", "");
|
|
19011
19222
|
const content = TaskMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
19012
|
-
await Bun.write(
|
|
19223
|
+
await Bun.write(join40(migrationsDir, file), content);
|
|
19013
19224
|
}
|
|
19014
|
-
const repositoryPath =
|
|
19225
|
+
const repositoryPath = join40(process.cwd(), base, "src", "repositories", "TaskRepository.ts");
|
|
19015
19226
|
await Bun.write(repositoryPath, TaskRepository_default);
|
|
19016
19227
|
}
|
|
19017
19228
|
}
|
|
19018
19229
|
MakeResourceTaskCommand = __legacyDecorateClassTS([
|
|
19019
|
-
|
|
19230
|
+
decorator40.command()
|
|
19020
19231
|
], MakeResourceTaskCommand);
|
|
19021
19232
|
// src/commands/MakeResourceTopicCommand.ts
|
|
19022
|
-
import { join as
|
|
19023
|
-
import { decorator as
|
|
19233
|
+
import { join as join41 } from "path";
|
|
19234
|
+
import { decorator as decorator41 } from "@ooneex/command";
|
|
19024
19235
|
var {Glob: Glob12 } = globalThis.Bun;
|
|
19025
19236
|
|
|
19026
19237
|
// src/templates/resources/topic/controllers/CreateTopicController.txt
|
|
@@ -19611,7 +19822,7 @@ class MakeResourceTopicCommand {
|
|
|
19611
19822
|
}
|
|
19612
19823
|
async run() {
|
|
19613
19824
|
const module = "topic";
|
|
19614
|
-
const base =
|
|
19825
|
+
const base = join41("modules", module);
|
|
19615
19826
|
const makeModuleCommand = new MakeModuleCommand;
|
|
19616
19827
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
19617
19828
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -19646,26 +19857,26 @@ class MakeResourceTopicCommand {
|
|
|
19646
19857
|
for (const controller of controllers) {
|
|
19647
19858
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
19648
19859
|
}
|
|
19649
|
-
const controllersDir =
|
|
19650
|
-
await Bun.write(
|
|
19651
|
-
await Bun.write(
|
|
19652
|
-
await Bun.write(
|
|
19653
|
-
await Bun.write(
|
|
19654
|
-
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);
|
|
19655
19866
|
const makeServiceCommand = new MakeServiceCommand;
|
|
19656
19867
|
const services = ["CreateTopic", "GetTopic", "ListTopics", "UpdateTopic", "DeleteTopic"];
|
|
19657
19868
|
for (const name of services) {
|
|
19658
19869
|
await makeServiceCommand.run({ name, module });
|
|
19659
19870
|
}
|
|
19660
|
-
const servicesDir =
|
|
19661
|
-
await Bun.write(
|
|
19662
|
-
await Bun.write(
|
|
19663
|
-
await Bun.write(
|
|
19664
|
-
await Bun.write(
|
|
19665
|
-
await Bun.write(
|
|
19666
|
-
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");
|
|
19667
19878
|
await Bun.write(entityPath, TopicEntity_default);
|
|
19668
|
-
const migrationsDir =
|
|
19879
|
+
const migrationsDir = join41(process.cwd(), base, "src", "migrations");
|
|
19669
19880
|
const glob = new Glob12("Migration*.ts");
|
|
19670
19881
|
for await (const file of glob.scan(migrationsDir)) {
|
|
19671
19882
|
if (file === "migrations.ts")
|
|
@@ -19673,18 +19884,18 @@ class MakeResourceTopicCommand {
|
|
|
19673
19884
|
const name = file.replace(/\.ts$/, "");
|
|
19674
19885
|
const version = name.replace("Migration", "");
|
|
19675
19886
|
const content = TopicMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
19676
|
-
await Bun.write(
|
|
19887
|
+
await Bun.write(join41(migrationsDir, file), content);
|
|
19677
19888
|
}
|
|
19678
|
-
const repositoryPath =
|
|
19889
|
+
const repositoryPath = join41(process.cwd(), base, "src", "repositories", "TopicRepository.ts");
|
|
19679
19890
|
await Bun.write(repositoryPath, TopicRepository_default);
|
|
19680
19891
|
}
|
|
19681
19892
|
}
|
|
19682
19893
|
MakeResourceTopicCommand = __legacyDecorateClassTS([
|
|
19683
|
-
|
|
19894
|
+
decorator41.command()
|
|
19684
19895
|
], MakeResourceTopicCommand);
|
|
19685
19896
|
// src/commands/MakeResourceUserCommand.ts
|
|
19686
|
-
import { join as
|
|
19687
|
-
import { decorator as
|
|
19897
|
+
import { join as join42 } from "path";
|
|
19898
|
+
import { decorator as decorator42 } from "@ooneex/command";
|
|
19688
19899
|
var {Glob: Glob13 } = globalThis.Bun;
|
|
19689
19900
|
|
|
19690
19901
|
// src/templates/resources/user/controllers/BanUserController.txt
|
|
@@ -20505,7 +20716,7 @@ class MakeResourceUserCommand {
|
|
|
20505
20716
|
}
|
|
20506
20717
|
async run() {
|
|
20507
20718
|
const module = "user";
|
|
20508
|
-
const base =
|
|
20719
|
+
const base = join42("modules", module);
|
|
20509
20720
|
const makeModuleCommand = new MakeModuleCommand;
|
|
20510
20721
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
20511
20722
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -20556,14 +20767,14 @@ class MakeResourceUserCommand {
|
|
|
20556
20767
|
for (const controller of controllers) {
|
|
20557
20768
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
20558
20769
|
}
|
|
20559
|
-
const controllersDir =
|
|
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
|
-
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);
|
|
20567
20778
|
const makeServiceCommand = new MakeServiceCommand;
|
|
20568
20779
|
const services = [
|
|
20569
20780
|
"BanUser",
|
|
@@ -20577,17 +20788,17 @@ class MakeResourceUserCommand {
|
|
|
20577
20788
|
for (const name of services) {
|
|
20578
20789
|
await makeServiceCommand.run({ name, module });
|
|
20579
20790
|
}
|
|
20580
|
-
const servicesDir =
|
|
20581
|
-
await Bun.write(
|
|
20582
|
-
await Bun.write(
|
|
20583
|
-
await Bun.write(
|
|
20584
|
-
await Bun.write(
|
|
20585
|
-
await Bun.write(
|
|
20586
|
-
await Bun.write(
|
|
20587
|
-
await Bun.write(
|
|
20588
|
-
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");
|
|
20589
20800
|
await Bun.write(entityPath, UserEntity_default);
|
|
20590
|
-
const migrationsDir =
|
|
20801
|
+
const migrationsDir = join42(process.cwd(), base, "src", "migrations");
|
|
20591
20802
|
const glob = new Glob13("Migration*.ts");
|
|
20592
20803
|
for await (const file of glob.scan(migrationsDir)) {
|
|
20593
20804
|
if (file === "migrations.ts")
|
|
@@ -20595,18 +20806,18 @@ class MakeResourceUserCommand {
|
|
|
20595
20806
|
const name = file.replace(/\.ts$/, "");
|
|
20596
20807
|
const version = name.replace("Migration", "");
|
|
20597
20808
|
const content = UserMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
20598
|
-
await Bun.write(
|
|
20809
|
+
await Bun.write(join42(migrationsDir, file), content);
|
|
20599
20810
|
}
|
|
20600
|
-
const repositoryPath =
|
|
20811
|
+
const repositoryPath = join42(process.cwd(), base, "src", "repositories", "UserRepository.ts");
|
|
20601
20812
|
await Bun.write(repositoryPath, UserRepository_default);
|
|
20602
20813
|
}
|
|
20603
20814
|
}
|
|
20604
20815
|
MakeResourceUserCommand = __legacyDecorateClassTS([
|
|
20605
|
-
|
|
20816
|
+
decorator42.command()
|
|
20606
20817
|
], MakeResourceUserCommand);
|
|
20607
20818
|
// src/commands/MakeResourceVideoCommand.ts
|
|
20608
|
-
import { join as
|
|
20609
|
-
import { decorator as
|
|
20819
|
+
import { join as join43 } from "path";
|
|
20820
|
+
import { decorator as decorator43 } from "@ooneex/command";
|
|
20610
20821
|
var {Glob: Glob14 } = globalThis.Bun;
|
|
20611
20822
|
|
|
20612
20823
|
// src/templates/resources/video/controllers/CreateVideoController.txt
|
|
@@ -21285,7 +21496,7 @@ class MakeResourceVideoCommand {
|
|
|
21285
21496
|
}
|
|
21286
21497
|
async run() {
|
|
21287
21498
|
const module = "video";
|
|
21288
|
-
const base =
|
|
21499
|
+
const base = join43("modules", module);
|
|
21289
21500
|
const makeModuleCommand = new MakeModuleCommand;
|
|
21290
21501
|
await makeModuleCommand.run({ name: module, silent: true });
|
|
21291
21502
|
const makeEntityCommand = new MakeEntityCommand;
|
|
@@ -21320,26 +21531,26 @@ class MakeResourceVideoCommand {
|
|
|
21320
21531
|
for (const controller of controllers) {
|
|
21321
21532
|
await makeControllerCommand.run({ ...controller, module, isSocket: false });
|
|
21322
21533
|
}
|
|
21323
|
-
const controllersDir =
|
|
21324
|
-
await Bun.write(
|
|
21325
|
-
await Bun.write(
|
|
21326
|
-
await Bun.write(
|
|
21327
|
-
await Bun.write(
|
|
21328
|
-
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);
|
|
21329
21540
|
const makeServiceCommand = new MakeServiceCommand;
|
|
21330
21541
|
const services = ["CreateVideo", "GetVideo", "ListVideos", "UpdateVideo", "DeleteVideo"];
|
|
21331
21542
|
for (const name of services) {
|
|
21332
21543
|
await makeServiceCommand.run({ name, module });
|
|
21333
21544
|
}
|
|
21334
|
-
const servicesDir =
|
|
21335
|
-
await Bun.write(
|
|
21336
|
-
await Bun.write(
|
|
21337
|
-
await Bun.write(
|
|
21338
|
-
await Bun.write(
|
|
21339
|
-
await Bun.write(
|
|
21340
|
-
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");
|
|
21341
21552
|
await Bun.write(entityPath, VideoEntity_default);
|
|
21342
|
-
const migrationsDir =
|
|
21553
|
+
const migrationsDir = join43(process.cwd(), base, "src", "migrations");
|
|
21343
21554
|
const glob = new Glob14("Migration*.ts");
|
|
21344
21555
|
for await (const file of glob.scan(migrationsDir)) {
|
|
21345
21556
|
if (file === "migrations.ts")
|
|
@@ -21347,19 +21558,19 @@ class MakeResourceVideoCommand {
|
|
|
21347
21558
|
const name = file.replace(/\.ts$/, "");
|
|
21348
21559
|
const version = name.replace("Migration", "");
|
|
21349
21560
|
const content = VideoMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
|
|
21350
|
-
await Bun.write(
|
|
21561
|
+
await Bun.write(join43(migrationsDir, file), content);
|
|
21351
21562
|
}
|
|
21352
|
-
const repositoryPath =
|
|
21563
|
+
const repositoryPath = join43(process.cwd(), base, "src", "repositories", "VideoRepository.ts");
|
|
21353
21564
|
await Bun.write(repositoryPath, VideoRepository_default);
|
|
21354
21565
|
}
|
|
21355
21566
|
}
|
|
21356
21567
|
MakeResourceVideoCommand = __legacyDecorateClassTS([
|
|
21357
|
-
|
|
21568
|
+
decorator43.command()
|
|
21358
21569
|
], MakeResourceVideoCommand);
|
|
21359
21570
|
// src/commands/MakeStorageCommand.ts
|
|
21360
|
-
import { join as
|
|
21361
|
-
import { decorator as
|
|
21362
|
-
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";
|
|
21363
21574
|
import { toPascalCase as toPascalCase16, toSnakeCase as toSnakeCase3 } from "@ooneex/utils";
|
|
21364
21575
|
|
|
21365
21576
|
// src/templates/storage.test.txt
|
|
@@ -21459,28 +21670,28 @@ class MakeStorageCommand {
|
|
|
21459
21670
|
if (module) {
|
|
21460
21671
|
await ensureModule(module);
|
|
21461
21672
|
}
|
|
21462
|
-
const base = module ?
|
|
21463
|
-
const storageLocalDir =
|
|
21464
|
-
const storageDir =
|
|
21465
|
-
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`);
|
|
21466
21677
|
await Bun.write(filePath, content);
|
|
21467
21678
|
const testContent = storage_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
21468
|
-
const testsLocalDir =
|
|
21469
|
-
const testsDir =
|
|
21470
|
-
const testFilePath =
|
|
21679
|
+
const testsLocalDir = join44(base, "tests", "storage");
|
|
21680
|
+
const testsDir = join44(process.cwd(), testsLocalDir);
|
|
21681
|
+
const testFilePath = join44(testsDir, `${name}Storage.spec.ts`);
|
|
21471
21682
|
await Bun.write(testFilePath, testContent);
|
|
21472
|
-
const logger = new
|
|
21473
|
-
logger.success(`${
|
|
21683
|
+
const logger = new TerminalLogger29;
|
|
21684
|
+
logger.success(`${join44(storageLocalDir, name)}Storage.ts created successfully`, undefined, {
|
|
21474
21685
|
showTimestamp: false,
|
|
21475
21686
|
showArrow: false,
|
|
21476
21687
|
useSymbol: true
|
|
21477
21688
|
});
|
|
21478
|
-
logger.success(`${
|
|
21689
|
+
logger.success(`${join44(testsLocalDir, name)}Storage.spec.ts created successfully`, undefined, {
|
|
21479
21690
|
showTimestamp: false,
|
|
21480
21691
|
showArrow: false,
|
|
21481
21692
|
useSymbol: true
|
|
21482
21693
|
});
|
|
21483
|
-
const packageJsonPath =
|
|
21694
|
+
const packageJsonPath = join44(process.cwd(), "package.json");
|
|
21484
21695
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
21485
21696
|
const deps = packageJson.dependencies ?? {};
|
|
21486
21697
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -21495,12 +21706,12 @@ class MakeStorageCommand {
|
|
|
21495
21706
|
}
|
|
21496
21707
|
}
|
|
21497
21708
|
MakeStorageCommand = __legacyDecorateClassTS([
|
|
21498
|
-
|
|
21709
|
+
decorator44.command()
|
|
21499
21710
|
], MakeStorageCommand);
|
|
21500
21711
|
// src/commands/MakeVectorDatabaseCommand.ts
|
|
21501
|
-
import { join as
|
|
21502
|
-
import { decorator as
|
|
21503
|
-
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";
|
|
21504
21715
|
import { toPascalCase as toPascalCase17 } from "@ooneex/utils";
|
|
21505
21716
|
|
|
21506
21717
|
// src/templates/vector-database.test.txt
|
|
@@ -21574,28 +21785,28 @@ class MakeVectorDatabaseCommand {
|
|
|
21574
21785
|
if (module) {
|
|
21575
21786
|
await ensureModule(module);
|
|
21576
21787
|
}
|
|
21577
|
-
const base = module ?
|
|
21578
|
-
const vectorDatabaseLocalDir =
|
|
21579
|
-
const vectorDatabaseDir =
|
|
21580
|
-
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`);
|
|
21581
21792
|
await Bun.write(filePath, content);
|
|
21582
21793
|
const testContent = vector_database_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
21583
|
-
const testsLocalDir =
|
|
21584
|
-
const testsDir =
|
|
21585
|
-
const testFilePath =
|
|
21794
|
+
const testsLocalDir = join45(base, "tests", "databases");
|
|
21795
|
+
const testsDir = join45(process.cwd(), testsLocalDir);
|
|
21796
|
+
const testFilePath = join45(testsDir, `${name}VectorDatabase.spec.ts`);
|
|
21586
21797
|
await Bun.write(testFilePath, testContent);
|
|
21587
|
-
const logger = new
|
|
21588
|
-
logger.success(`${
|
|
21798
|
+
const logger = new TerminalLogger30;
|
|
21799
|
+
logger.success(`${join45(vectorDatabaseLocalDir, name)}VectorDatabase.ts created successfully`, undefined, {
|
|
21589
21800
|
showTimestamp: false,
|
|
21590
21801
|
showArrow: false,
|
|
21591
21802
|
useSymbol: true
|
|
21592
21803
|
});
|
|
21593
|
-
logger.success(`${
|
|
21804
|
+
logger.success(`${join45(testsLocalDir, name)}VectorDatabase.spec.ts created successfully`, undefined, {
|
|
21594
21805
|
showTimestamp: false,
|
|
21595
21806
|
showArrow: false,
|
|
21596
21807
|
useSymbol: true
|
|
21597
21808
|
});
|
|
21598
|
-
const packageJsonPath =
|
|
21809
|
+
const packageJsonPath = join45(process.cwd(), "package.json");
|
|
21599
21810
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
21600
21811
|
const deps = packageJson.dependencies ?? {};
|
|
21601
21812
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -21610,13 +21821,13 @@ class MakeVectorDatabaseCommand {
|
|
|
21610
21821
|
}
|
|
21611
21822
|
}
|
|
21612
21823
|
MakeVectorDatabaseCommand = __legacyDecorateClassTS([
|
|
21613
|
-
|
|
21824
|
+
decorator45.command()
|
|
21614
21825
|
], MakeVectorDatabaseCommand);
|
|
21615
21826
|
// src/commands/MigrationUpCommand.ts
|
|
21616
21827
|
import { existsSync as existsSync2 } from "fs";
|
|
21617
|
-
import { join as
|
|
21618
|
-
import { decorator as
|
|
21619
|
-
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";
|
|
21620
21831
|
class MigrationUpCommand {
|
|
21621
21832
|
getName() {
|
|
21622
21833
|
return "migration:up";
|
|
@@ -21625,8 +21836,8 @@ class MigrationUpCommand {
|
|
|
21625
21836
|
return "Run migrations for all modules";
|
|
21626
21837
|
}
|
|
21627
21838
|
async run(options) {
|
|
21628
|
-
const logger = new
|
|
21629
|
-
const modulesDir =
|
|
21839
|
+
const logger = new TerminalLogger31;
|
|
21840
|
+
const modulesDir = join46(process.cwd(), "modules");
|
|
21630
21841
|
if (!existsSync2(modulesDir)) {
|
|
21631
21842
|
logger.warn("No modules with migrations found", undefined, {
|
|
21632
21843
|
showTimestamp: false,
|
|
@@ -21639,10 +21850,10 @@ class MigrationUpCommand {
|
|
|
21639
21850
|
const modules = [];
|
|
21640
21851
|
for await (const match of glob.scan({ cwd: modulesDir, onlyFiles: true })) {
|
|
21641
21852
|
const entry = match.replace("/package.json", "");
|
|
21642
|
-
const moduleDir =
|
|
21643
|
-
const migrationUpFile = Bun.file(
|
|
21853
|
+
const moduleDir = join46(modulesDir, entry);
|
|
21854
|
+
const migrationUpFile = Bun.file(join46(moduleDir, "bin", "migration", "up.ts"));
|
|
21644
21855
|
if (await migrationUpFile.exists()) {
|
|
21645
|
-
const packageJson = await Bun.file(
|
|
21856
|
+
const packageJson = await Bun.file(join46(modulesDir, match)).json();
|
|
21646
21857
|
modules.push({ name: packageJson.name ?? entry, dir: moduleDir });
|
|
21647
21858
|
}
|
|
21648
21859
|
}
|
|
@@ -21655,7 +21866,7 @@ class MigrationUpCommand {
|
|
|
21655
21866
|
return;
|
|
21656
21867
|
}
|
|
21657
21868
|
for (const { name, dir } of modules) {
|
|
21658
|
-
const migrationUpPath =
|
|
21869
|
+
const migrationUpPath = join46(dir, "bin", "migration", "up.ts");
|
|
21659
21870
|
logger.info(`Running migrations for ${name}...`, undefined, {
|
|
21660
21871
|
showTimestamp: false,
|
|
21661
21872
|
showArrow: false,
|
|
@@ -21688,13 +21899,13 @@ class MigrationUpCommand {
|
|
|
21688
21899
|
}
|
|
21689
21900
|
}
|
|
21690
21901
|
MigrationUpCommand = __legacyDecorateClassTS([
|
|
21691
|
-
|
|
21902
|
+
decorator46.command()
|
|
21692
21903
|
], MigrationUpCommand);
|
|
21693
21904
|
// src/commands/RemoveModuleCommand.ts
|
|
21694
21905
|
import { rmdir } from "fs/promises";
|
|
21695
|
-
import { join as
|
|
21696
|
-
import { decorator as
|
|
21697
|
-
import { TerminalLogger as
|
|
21906
|
+
import { join as join47 } from "path";
|
|
21907
|
+
import { decorator as decorator47 } from "@ooneex/command";
|
|
21908
|
+
import { TerminalLogger as TerminalLogger32 } from "@ooneex/logger";
|
|
21698
21909
|
import { toKebabCase as toKebabCase5, toPascalCase as toPascalCase18 } from "@ooneex/utils";
|
|
21699
21910
|
class RemoveModuleCommand {
|
|
21700
21911
|
getName() {
|
|
@@ -21765,7 +21976,7 @@ class RemoveModuleCommand {
|
|
|
21765
21976
|
const kebabName = toKebabCase5(pascalName);
|
|
21766
21977
|
if (kebabName === "app" || kebabName === "shared") {
|
|
21767
21978
|
if (!silent) {
|
|
21768
|
-
const logger = new
|
|
21979
|
+
const logger = new TerminalLogger32;
|
|
21769
21980
|
logger.error(`Cannot remove the "${kebabName}" module`, undefined, {
|
|
21770
21981
|
showTimestamp: false,
|
|
21771
21982
|
showArrow: false,
|
|
@@ -21774,11 +21985,11 @@ class RemoveModuleCommand {
|
|
|
21774
21985
|
}
|
|
21775
21986
|
return;
|
|
21776
21987
|
}
|
|
21777
|
-
const moduleDir =
|
|
21778
|
-
const moduleDirExists = await Bun.file(
|
|
21988
|
+
const moduleDir = join47(cwd, "modules", kebabName);
|
|
21989
|
+
const moduleDirExists = await Bun.file(join47(moduleDir, "package.json")).exists();
|
|
21779
21990
|
if (!moduleDirExists) {
|
|
21780
21991
|
if (!silent) {
|
|
21781
|
-
const logger = new
|
|
21992
|
+
const logger = new TerminalLogger32;
|
|
21782
21993
|
logger.error(`Module "${kebabName}" does not exist`, undefined, {
|
|
21783
21994
|
showTimestamp: false,
|
|
21784
21995
|
showArrow: false,
|
|
@@ -21795,17 +22006,17 @@ class RemoveModuleCommand {
|
|
|
21795
22006
|
if (!confirmed)
|
|
21796
22007
|
return;
|
|
21797
22008
|
}
|
|
21798
|
-
const appModulePath =
|
|
22009
|
+
const appModulePath = join47(cwd, "modules", "app", "src", "AppModule.ts");
|
|
21799
22010
|
await this.removeFromAppModule(appModulePath, pascalName, kebabName);
|
|
21800
|
-
const sharedModulePath =
|
|
22011
|
+
const sharedModulePath = join47(cwd, "modules", "shared", "src", "SharedModule.ts");
|
|
21801
22012
|
await this.removeFromSharedModule(sharedModulePath, pascalName, kebabName);
|
|
21802
|
-
const appTsconfigPath =
|
|
22013
|
+
const appTsconfigPath = join47(cwd, "tsconfig.json");
|
|
21803
22014
|
await this.removePathAlias(appTsconfigPath, kebabName);
|
|
21804
|
-
const commitlintPath =
|
|
22015
|
+
const commitlintPath = join47(cwd, ".commitlintrc.ts");
|
|
21805
22016
|
await this.removeModuleScope(commitlintPath, kebabName);
|
|
21806
22017
|
await rmdir(moduleDir, { recursive: true });
|
|
21807
22018
|
if (!silent) {
|
|
21808
|
-
const logger = new
|
|
22019
|
+
const logger = new TerminalLogger32;
|
|
21809
22020
|
logger.success(`modules/${kebabName} removed successfully`, undefined, {
|
|
21810
22021
|
showTimestamp: false,
|
|
21811
22022
|
showArrow: false,
|
|
@@ -21815,13 +22026,13 @@ class RemoveModuleCommand {
|
|
|
21815
22026
|
}
|
|
21816
22027
|
}
|
|
21817
22028
|
RemoveModuleCommand = __legacyDecorateClassTS([
|
|
21818
|
-
|
|
22029
|
+
decorator47.command()
|
|
21819
22030
|
], RemoveModuleCommand);
|
|
21820
22031
|
// src/commands/SeedRunCommand.ts
|
|
21821
22032
|
import { existsSync as existsSync3 } from "fs";
|
|
21822
|
-
import { join as
|
|
21823
|
-
import { decorator as
|
|
21824
|
-
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";
|
|
21825
22036
|
class SeedRunCommand {
|
|
21826
22037
|
getName() {
|
|
21827
22038
|
return "seed:run";
|
|
@@ -21830,8 +22041,8 @@ class SeedRunCommand {
|
|
|
21830
22041
|
return "Run seeds for all modules";
|
|
21831
22042
|
}
|
|
21832
22043
|
async run(options) {
|
|
21833
|
-
const logger = new
|
|
21834
|
-
const modulesDir =
|
|
22044
|
+
const logger = new TerminalLogger33;
|
|
22045
|
+
const modulesDir = join48(process.cwd(), "modules");
|
|
21835
22046
|
if (!existsSync3(modulesDir)) {
|
|
21836
22047
|
logger.warn("No modules with seeds found", undefined, {
|
|
21837
22048
|
showTimestamp: false,
|
|
@@ -21844,10 +22055,10 @@ class SeedRunCommand {
|
|
|
21844
22055
|
const modules = [];
|
|
21845
22056
|
for await (const match of glob.scan({ cwd: modulesDir, onlyFiles: true })) {
|
|
21846
22057
|
const entry = match.replace("/package.json", "");
|
|
21847
|
-
const moduleDir =
|
|
21848
|
-
const seedRunFile = Bun.file(
|
|
22058
|
+
const moduleDir = join48(modulesDir, entry);
|
|
22059
|
+
const seedRunFile = Bun.file(join48(moduleDir, "bin", "seed", "run.ts"));
|
|
21849
22060
|
if (await seedRunFile.exists()) {
|
|
21850
|
-
const packageJson = await Bun.file(
|
|
22061
|
+
const packageJson = await Bun.file(join48(modulesDir, match)).json();
|
|
21851
22062
|
modules.push({ name: packageJson.name ?? entry, dir: moduleDir });
|
|
21852
22063
|
}
|
|
21853
22064
|
}
|
|
@@ -21860,7 +22071,7 @@ class SeedRunCommand {
|
|
|
21860
22071
|
return;
|
|
21861
22072
|
}
|
|
21862
22073
|
for (const { name, dir } of modules) {
|
|
21863
|
-
const seedRunPath =
|
|
22074
|
+
const seedRunPath = join48(dir, "bin", "seed", "run.ts");
|
|
21864
22075
|
logger.info(`Running seeds for ${name}...`, undefined, {
|
|
21865
22076
|
showTimestamp: false,
|
|
21866
22077
|
showArrow: false,
|
|
@@ -21893,9 +22104,9 @@ class SeedRunCommand {
|
|
|
21893
22104
|
}
|
|
21894
22105
|
}
|
|
21895
22106
|
SeedRunCommand = __legacyDecorateClassTS([
|
|
21896
|
-
|
|
22107
|
+
decorator48.command()
|
|
21897
22108
|
], SeedRunCommand);
|
|
21898
22109
|
// src/index.ts
|
|
21899
22110
|
await run();
|
|
21900
22111
|
|
|
21901
|
-
//# debugId=
|
|
22112
|
+
//# debugId=D640C7F1FE3A516464756E2164756E21
|