@ooneex/cli 1.26.2 → 1.26.3
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 +167 -155
- package/dist/index.js.map +7 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -33790,18 +33790,30 @@ function getPerformanceGrade(avgLatency, p99Latency, errorRate, reqPerSec) {
|
|
|
33790
33790
|
if (reqPerSec > 1e4)
|
|
33791
33791
|
score = Math.min(100, score + 5);
|
|
33792
33792
|
if (score >= 90) {
|
|
33793
|
-
return {
|
|
33793
|
+
return {
|
|
33794
|
+
label: "A Excellent",
|
|
33795
|
+
message: " Server handles load with low latency and high reliability",
|
|
33796
|
+
color: green
|
|
33797
|
+
};
|
|
33794
33798
|
}
|
|
33795
33799
|
if (score >= 75) {
|
|
33796
33800
|
return { label: "B Good", message: " Server performs well under load with acceptable latency", color: green };
|
|
33797
33801
|
}
|
|
33798
33802
|
if (score >= 60) {
|
|
33799
|
-
return {
|
|
33803
|
+
return {
|
|
33804
|
+
label: "C Fair",
|
|
33805
|
+
message: " Server shows moderate latency or occasional errors under load",
|
|
33806
|
+
color: yellow
|
|
33807
|
+
};
|
|
33800
33808
|
}
|
|
33801
33809
|
if (score >= 40) {
|
|
33802
33810
|
return { label: "D Poor", message: " Server struggles with high latency or significant errors", color: red };
|
|
33803
33811
|
}
|
|
33804
|
-
return {
|
|
33812
|
+
return {
|
|
33813
|
+
label: "F Critical",
|
|
33814
|
+
message: " Server cannot handle the load \u2014 consider scaling or optimization",
|
|
33815
|
+
color: red
|
|
33816
|
+
};
|
|
33805
33817
|
}
|
|
33806
33818
|
|
|
33807
33819
|
class BenchmarkRunCommand {
|
|
@@ -34554,124 +34566,10 @@ class MakeAiCommand {
|
|
|
34554
34566
|
MakeAiCommand = __legacyDecorateClassTS([
|
|
34555
34567
|
decorator9.command()
|
|
34556
34568
|
], MakeAiCommand);
|
|
34557
|
-
// src/commands/
|
|
34569
|
+
// src/commands/MakeAnalyticsCommand.ts
|
|
34558
34570
|
import { join as join10 } from "path";
|
|
34559
34571
|
import { decorator as decorator10 } from "@ooneex/command";
|
|
34560
34572
|
import { TerminalLogger as TerminalLogger9 } from "@ooneex/logger";
|
|
34561
|
-
class MakeBenchmarkCommand {
|
|
34562
|
-
getName() {
|
|
34563
|
-
return "make:benchmark";
|
|
34564
|
-
}
|
|
34565
|
-
getDescription() {
|
|
34566
|
-
return "Generate a new benchmark file";
|
|
34567
|
-
}
|
|
34568
|
-
parseController(content) {
|
|
34569
|
-
const methodMatch = content.match(/@Route\.(get|post|patch|put|delete|options|head)\(/);
|
|
34570
|
-
const method = methodMatch?.[1]?.toUpperCase() ?? "GET";
|
|
34571
|
-
const pathMatch = content.match(/@Route\.\w+\("([^"]+)"/);
|
|
34572
|
-
const path = pathMatch?.[1] ?? "/";
|
|
34573
|
-
const nameMatch = content.match(/name:\s*"([^"]+)"/);
|
|
34574
|
-
const name = nameMatch?.[1] ?? "";
|
|
34575
|
-
const descriptionMatch = content.match(/description:\s*"([^"]+)"/);
|
|
34576
|
-
const description = descriptionMatch?.[1] ?? "";
|
|
34577
|
-
const params = this.parseParams(content);
|
|
34578
|
-
const queries = this.parseAssertBlock(content, "queries");
|
|
34579
|
-
const payload = this.parseAssertBlock(content, "payload");
|
|
34580
|
-
return { name, path, method, description, params, queries, payload };
|
|
34581
|
-
}
|
|
34582
|
-
parseParams(content) {
|
|
34583
|
-
const params = {};
|
|
34584
|
-
const paramsMatch = content.match(/params:\s*\{([^}]*Assert[^}]+)\}/);
|
|
34585
|
-
if (paramsMatch?.[1]) {
|
|
34586
|
-
const keys = paramsMatch[1].matchAll(/(\w+):\s*Assert\(/g);
|
|
34587
|
-
for (const match of keys) {
|
|
34588
|
-
if (match[1]) {
|
|
34589
|
-
params[match[1]] = "";
|
|
34590
|
-
}
|
|
34591
|
-
}
|
|
34592
|
-
}
|
|
34593
|
-
return params;
|
|
34594
|
-
}
|
|
34595
|
-
parseAssertBlock(content, block) {
|
|
34596
|
-
const result = {};
|
|
34597
|
-
const regex = new RegExp(`${block}:\\s*Assert\\(\\{([^}]+)\\}\\)`);
|
|
34598
|
-
const match = content.match(regex);
|
|
34599
|
-
if (match?.[1]) {
|
|
34600
|
-
const fields = match[1].matchAll(/(\w+):\s*"(\w+\??(?:\[\])?)"/g);
|
|
34601
|
-
for (const field of fields) {
|
|
34602
|
-
if (field[1] && field[2]) {
|
|
34603
|
-
const type = field[2].replace("?", "").replace("[]", "");
|
|
34604
|
-
result[field[1]] = type === "number" ? 0 : "";
|
|
34605
|
-
}
|
|
34606
|
-
}
|
|
34607
|
-
}
|
|
34608
|
-
return result;
|
|
34609
|
-
}
|
|
34610
|
-
async run(options) {
|
|
34611
|
-
let { name, module, target } = options;
|
|
34612
|
-
if (!name) {
|
|
34613
|
-
name = await askName({ message: "Enter benchmark name" });
|
|
34614
|
-
}
|
|
34615
|
-
if (!target) {
|
|
34616
|
-
target = await askName({ message: "Enter target controller name (e.g., UpdateStatusController)" });
|
|
34617
|
-
}
|
|
34618
|
-
const targetName = target.replace(/Controller$/, "");
|
|
34619
|
-
if (module) {
|
|
34620
|
-
await ensureModule(module);
|
|
34621
|
-
}
|
|
34622
|
-
const base = module ? join10("modules", module) : ".";
|
|
34623
|
-
const controllersLocalDir = join10(base, "src", "controllers");
|
|
34624
|
-
const controllersDir = join10(process.cwd(), controllersLocalDir);
|
|
34625
|
-
const controllerFilePath = join10(controllersDir, `${targetName}Controller.ts`);
|
|
34626
|
-
const controllerFile = Bun.file(controllerFilePath);
|
|
34627
|
-
if (!await controllerFile.exists()) {
|
|
34628
|
-
const logger2 = new TerminalLogger9;
|
|
34629
|
-
logger2.error(`Controller not found: ${controllerFilePath}`, undefined, {
|
|
34630
|
-
showTimestamp: false,
|
|
34631
|
-
showArrow: false,
|
|
34632
|
-
useSymbol: true
|
|
34633
|
-
});
|
|
34634
|
-
return;
|
|
34635
|
-
}
|
|
34636
|
-
const controllerContent = await controllerFile.text();
|
|
34637
|
-
const routeInfo = this.parseController(controllerContent);
|
|
34638
|
-
const benchmark = {
|
|
34639
|
-
name: routeInfo.name,
|
|
34640
|
-
path: routeInfo.path,
|
|
34641
|
-
method: routeInfo.method,
|
|
34642
|
-
description: routeInfo.description
|
|
34643
|
-
};
|
|
34644
|
-
if (Object.keys(routeInfo.params).length > 0) {
|
|
34645
|
-
benchmark.params = routeInfo.params;
|
|
34646
|
-
}
|
|
34647
|
-
if (Object.keys(routeInfo.queries).length > 0) {
|
|
34648
|
-
benchmark.queries = routeInfo.queries;
|
|
34649
|
-
}
|
|
34650
|
-
if (Object.keys(routeInfo.payload).length > 0) {
|
|
34651
|
-
benchmark.payload = routeInfo.payload;
|
|
34652
|
-
}
|
|
34653
|
-
benchmark.connections = 10;
|
|
34654
|
-
benchmark.duration = 10;
|
|
34655
|
-
const jsonContent = JSON.stringify(benchmark, null, 2);
|
|
34656
|
-
const benchmarkFileName = `${name}.bench.json`;
|
|
34657
|
-
const filePath = join10(controllersDir, benchmarkFileName);
|
|
34658
|
-
await Bun.write(filePath, `${jsonContent}
|
|
34659
|
-
`);
|
|
34660
|
-
const logger = new TerminalLogger9;
|
|
34661
|
-
logger.success(`${join10(controllersLocalDir, benchmarkFileName)} created successfully`, undefined, {
|
|
34662
|
-
showTimestamp: false,
|
|
34663
|
-
showArrow: false,
|
|
34664
|
-
useSymbol: true
|
|
34665
|
-
});
|
|
34666
|
-
}
|
|
34667
|
-
}
|
|
34668
|
-
MakeBenchmarkCommand = __legacyDecorateClassTS([
|
|
34669
|
-
decorator10.command()
|
|
34670
|
-
], MakeBenchmarkCommand);
|
|
34671
|
-
// src/commands/MakeAnalyticsCommand.ts
|
|
34672
|
-
import { join as join11 } from "path";
|
|
34673
|
-
import { decorator as decorator11 } from "@ooneex/command";
|
|
34674
|
-
import { TerminalLogger as TerminalLogger10 } from "@ooneex/logger";
|
|
34675
34573
|
import { toPascalCase as toPascalCase3 } from "@ooneex/utils";
|
|
34676
34574
|
|
|
34677
34575
|
// src/templates/analytics.test.txt
|
|
@@ -34722,28 +34620,28 @@ class MakeAnalyticsCommand {
|
|
|
34722
34620
|
if (module) {
|
|
34723
34621
|
await ensureModule(module);
|
|
34724
34622
|
}
|
|
34725
|
-
const base = module ?
|
|
34726
|
-
const analyticsLocalDir =
|
|
34727
|
-
const analyticsDir =
|
|
34728
|
-
const filePath =
|
|
34623
|
+
const base = module ? join10("modules", module) : ".";
|
|
34624
|
+
const analyticsLocalDir = join10(base, "src", "analytics");
|
|
34625
|
+
const analyticsDir = join10(process.cwd(), analyticsLocalDir);
|
|
34626
|
+
const filePath = join10(analyticsDir, `${name}Analytics.ts`);
|
|
34729
34627
|
await Bun.write(filePath, content);
|
|
34730
34628
|
const testContent = analytics_test_default.replace(/{{NAME}}/g, name).replace(/{{MODULE}}/g, module ?? "");
|
|
34731
|
-
const testsLocalDir =
|
|
34732
|
-
const testsDir =
|
|
34733
|
-
const testFilePath =
|
|
34629
|
+
const testsLocalDir = join10(base, "tests", "analytics");
|
|
34630
|
+
const testsDir = join10(process.cwd(), testsLocalDir);
|
|
34631
|
+
const testFilePath = join10(testsDir, `${name}Analytics.spec.ts`);
|
|
34734
34632
|
await Bun.write(testFilePath, testContent);
|
|
34735
|
-
const logger = new
|
|
34736
|
-
logger.success(`${
|
|
34633
|
+
const logger = new TerminalLogger9;
|
|
34634
|
+
logger.success(`${join10(analyticsLocalDir, name)}Analytics.ts created successfully`, undefined, {
|
|
34737
34635
|
showTimestamp: false,
|
|
34738
34636
|
showArrow: false,
|
|
34739
34637
|
useSymbol: true
|
|
34740
34638
|
});
|
|
34741
|
-
logger.success(`${
|
|
34639
|
+
logger.success(`${join10(testsLocalDir, name)}Analytics.spec.ts created successfully`, undefined, {
|
|
34742
34640
|
showTimestamp: false,
|
|
34743
34641
|
showArrow: false,
|
|
34744
34642
|
useSymbol: true
|
|
34745
34643
|
});
|
|
34746
|
-
const packageJsonPath =
|
|
34644
|
+
const packageJsonPath = join10(process.cwd(), "package.json");
|
|
34747
34645
|
const packageJson = await Bun.file(packageJsonPath).json();
|
|
34748
34646
|
const deps = packageJson.dependencies ?? {};
|
|
34749
34647
|
const devDeps = packageJson.devDependencies ?? {};
|
|
@@ -34758,12 +34656,12 @@ class MakeAnalyticsCommand {
|
|
|
34758
34656
|
}
|
|
34759
34657
|
}
|
|
34760
34658
|
MakeAnalyticsCommand = __legacyDecorateClassTS([
|
|
34761
|
-
|
|
34659
|
+
decorator10.command()
|
|
34762
34660
|
], MakeAnalyticsCommand);
|
|
34763
34661
|
// src/commands/MakeAppCommand.ts
|
|
34764
|
-
import { join as
|
|
34765
|
-
import { decorator as
|
|
34766
|
-
import { TerminalLogger as
|
|
34662
|
+
import { join as join11 } from "path";
|
|
34663
|
+
import { decorator as decorator11 } from "@ooneex/command";
|
|
34664
|
+
import { TerminalLogger as TerminalLogger10 } from "@ooneex/logger";
|
|
34767
34665
|
import { toKebabCase as toKebabCase2, toSnakeCase } from "@ooneex/utils";
|
|
34768
34666
|
|
|
34769
34667
|
// src/prompts/askDestination.ts
|
|
@@ -35916,40 +35814,40 @@ class MakeAppCommand {
|
|
|
35916
35814
|
destination = await askDestination({ message: "Enter destination path", initial: kebabName });
|
|
35917
35815
|
}
|
|
35918
35816
|
const packageContent = package_json_default.replace(/{{NAME}}/g, kebabName);
|
|
35919
|
-
await Bun.write(
|
|
35920
|
-
await Bun.write(
|
|
35921
|
-
await Bun.write(
|
|
35922
|
-
await Bun.write(
|
|
35923
|
-
await Bun.write(
|
|
35924
|
-
await Bun.write(
|
|
35925
|
-
await Bun.write(
|
|
35926
|
-
await Bun.write(
|
|
35927
|
-
await Bun.write(
|
|
35817
|
+
await Bun.write(join11(destination, ".commitlintrc.ts"), _commitlintrc_ts_default);
|
|
35818
|
+
await Bun.write(join11(destination, ".gitignore"), _gitignore_default);
|
|
35819
|
+
await Bun.write(join11(destination, "biome.jsonc"), biome_jsonc_default);
|
|
35820
|
+
await Bun.write(join11(destination, "bunfig.toml"), bunfig_toml_default);
|
|
35821
|
+
await Bun.write(join11(destination, "nx.json"), nx_json_default);
|
|
35822
|
+
await Bun.write(join11(destination, "package.json"), packageContent);
|
|
35823
|
+
await Bun.write(join11(destination, "README.md"), README_md_default.replace(/{{NAME}}/g, kebabName));
|
|
35824
|
+
await Bun.write(join11(destination, "tsconfig.json"), tsconfig_json_default);
|
|
35825
|
+
await Bun.write(join11(destination, ".zed", "settings.json"), zed_settings_json_default);
|
|
35928
35826
|
const makeModuleCommand = new MakeModuleCommand;
|
|
35929
35827
|
await makeModuleCommand.run({
|
|
35930
35828
|
name: "app",
|
|
35931
35829
|
cwd: destination,
|
|
35932
35830
|
silent: true
|
|
35933
35831
|
});
|
|
35934
|
-
const appModulePackagePath =
|
|
35832
|
+
const appModulePackagePath = join11(destination, "modules", "app", "package.json");
|
|
35935
35833
|
const appModulePackageJson = await Bun.file(appModulePackagePath).json();
|
|
35936
35834
|
await Bun.write(appModulePackagePath, JSON.stringify(appModulePackageJson, null, 2));
|
|
35937
35835
|
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"');
|
|
35938
|
-
await Bun.write(
|
|
35939
|
-
await Bun.write(
|
|
35940
|
-
await Bun.write(
|
|
35836
|
+
await Bun.write(join11(destination, "modules", "app", ".env"), envContent);
|
|
35837
|
+
await Bun.write(join11(destination, "modules", "app", ".env.example"), env_default);
|
|
35838
|
+
await Bun.write(join11(destination, "modules", "app", "src", "index.ts"), index_ts_default);
|
|
35941
35839
|
await makeModuleCommand.run({
|
|
35942
35840
|
name: "shared",
|
|
35943
35841
|
cwd: destination,
|
|
35944
35842
|
silent: true
|
|
35945
35843
|
});
|
|
35946
|
-
await Bun.write(
|
|
35844
|
+
await Bun.write(join11(destination, "modules", "shared", "src", "databases", "SharedDatabase.ts"), app_database_default);
|
|
35947
35845
|
const snakeName = toSnakeCase(name);
|
|
35948
35846
|
const dockerComposeContent = docker_compose_yml_default.replace(/{{NAME}}/g, snakeName);
|
|
35949
|
-
await Bun.write(
|
|
35847
|
+
await Bun.write(join11(destination, "modules", "app", "docker-compose.yml"), dockerComposeContent);
|
|
35950
35848
|
const dockerfileContent = Dockerfile_default.replace(/{{NAME}}/g, snakeName);
|
|
35951
|
-
await Bun.write(
|
|
35952
|
-
await Bun.write(
|
|
35849
|
+
await Bun.write(join11(destination, "modules", "app", "Dockerfile"), dockerfileContent);
|
|
35850
|
+
await Bun.write(join11(destination, "modules", "app", "var", ".gitkeep"), "");
|
|
35953
35851
|
const gitInit = Bun.spawn(["git", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
35954
35852
|
await gitInit.exited;
|
|
35955
35853
|
const addDeps = Bun.spawn([
|
|
@@ -36011,9 +35909,9 @@ class MakeAppCommand {
|
|
|
36011
35909
|
await addDevDeps.exited;
|
|
36012
35910
|
const huskyInit = Bun.spawn(["bunx", "husky", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
|
|
36013
35911
|
await huskyInit.exited;
|
|
36014
|
-
await Bun.write(
|
|
36015
|
-
await Bun.write(
|
|
36016
|
-
const logger = new
|
|
35912
|
+
await Bun.write(join11(destination, ".husky", "pre-commit"), "lint-staged");
|
|
35913
|
+
await Bun.write(join11(destination, ".husky", "commit-msg"), `bunx commitlint --edit "$1"`);
|
|
35914
|
+
const logger = new TerminalLogger10;
|
|
36017
35915
|
logger.success(`${kebabName} created successfully at ${destination}`, undefined, {
|
|
36018
35916
|
showTimestamp: false,
|
|
36019
35917
|
showArrow: false,
|
|
@@ -36022,8 +35920,122 @@ class MakeAppCommand {
|
|
|
36022
35920
|
}
|
|
36023
35921
|
}
|
|
36024
35922
|
MakeAppCommand = __legacyDecorateClassTS([
|
|
36025
|
-
|
|
35923
|
+
decorator11.command()
|
|
36026
35924
|
], MakeAppCommand);
|
|
35925
|
+
// src/commands/MakeBenchmarkCommand.ts
|
|
35926
|
+
import { join as join12 } from "path";
|
|
35927
|
+
import { decorator as decorator12 } from "@ooneex/command";
|
|
35928
|
+
import { TerminalLogger as TerminalLogger11 } from "@ooneex/logger";
|
|
35929
|
+
class MakeBenchmarkCommand {
|
|
35930
|
+
getName() {
|
|
35931
|
+
return "make:benchmark";
|
|
35932
|
+
}
|
|
35933
|
+
getDescription() {
|
|
35934
|
+
return "Generate a new benchmark file";
|
|
35935
|
+
}
|
|
35936
|
+
parseController(content) {
|
|
35937
|
+
const methodMatch = content.match(/@Route\.(get|post|patch|put|delete|options|head)\(/);
|
|
35938
|
+
const method = methodMatch?.[1]?.toUpperCase() ?? "GET";
|
|
35939
|
+
const pathMatch = content.match(/@Route\.\w+\("([^"]+)"/);
|
|
35940
|
+
const path = pathMatch?.[1] ?? "/";
|
|
35941
|
+
const nameMatch = content.match(/name:\s*"([^"]+)"/);
|
|
35942
|
+
const name = nameMatch?.[1] ?? "";
|
|
35943
|
+
const descriptionMatch = content.match(/description:\s*"([^"]+)"/);
|
|
35944
|
+
const description = descriptionMatch?.[1] ?? "";
|
|
35945
|
+
const params = this.parseParams(content);
|
|
35946
|
+
const queries = this.parseAssertBlock(content, "queries");
|
|
35947
|
+
const payload = this.parseAssertBlock(content, "payload");
|
|
35948
|
+
return { name, path, method, description, params, queries, payload };
|
|
35949
|
+
}
|
|
35950
|
+
parseParams(content) {
|
|
35951
|
+
const params = {};
|
|
35952
|
+
const paramsMatch = content.match(/params:\s*\{([^}]*Assert[^}]+)\}/);
|
|
35953
|
+
if (paramsMatch?.[1]) {
|
|
35954
|
+
const keys = paramsMatch[1].matchAll(/(\w+):\s*Assert\(/g);
|
|
35955
|
+
for (const match of keys) {
|
|
35956
|
+
if (match[1]) {
|
|
35957
|
+
params[match[1]] = "";
|
|
35958
|
+
}
|
|
35959
|
+
}
|
|
35960
|
+
}
|
|
35961
|
+
return params;
|
|
35962
|
+
}
|
|
35963
|
+
parseAssertBlock(content, block) {
|
|
35964
|
+
const result = {};
|
|
35965
|
+
const regex = new RegExp(`${block}:\\s*Assert\\(\\{([^}]+)\\}\\)`);
|
|
35966
|
+
const match = content.match(regex);
|
|
35967
|
+
if (match?.[1]) {
|
|
35968
|
+
const fields = match[1].matchAll(/(\w+):\s*"(\w+\??(?:\[\])?)"/g);
|
|
35969
|
+
for (const field of fields) {
|
|
35970
|
+
if (field[1] && field[2]) {
|
|
35971
|
+
const type = field[2].replace("?", "").replace("[]", "");
|
|
35972
|
+
result[field[1]] = type === "number" ? 0 : "";
|
|
35973
|
+
}
|
|
35974
|
+
}
|
|
35975
|
+
}
|
|
35976
|
+
return result;
|
|
35977
|
+
}
|
|
35978
|
+
async run(options) {
|
|
35979
|
+
let { name, module, target } = options;
|
|
35980
|
+
if (!name) {
|
|
35981
|
+
name = await askName({ message: "Enter benchmark name" });
|
|
35982
|
+
}
|
|
35983
|
+
if (!target) {
|
|
35984
|
+
target = await askName({ message: "Enter target controller name (e.g., UpdateStatusController)" });
|
|
35985
|
+
}
|
|
35986
|
+
const targetName = target.replace(/Controller$/, "");
|
|
35987
|
+
if (module) {
|
|
35988
|
+
await ensureModule(module);
|
|
35989
|
+
}
|
|
35990
|
+
const base = module ? join12("modules", module) : ".";
|
|
35991
|
+
const controllersLocalDir = join12(base, "src", "controllers");
|
|
35992
|
+
const controllersDir = join12(process.cwd(), controllersLocalDir);
|
|
35993
|
+
const controllerFilePath = join12(controllersDir, `${targetName}Controller.ts`);
|
|
35994
|
+
const controllerFile = Bun.file(controllerFilePath);
|
|
35995
|
+
if (!await controllerFile.exists()) {
|
|
35996
|
+
const logger2 = new TerminalLogger11;
|
|
35997
|
+
logger2.error(`Controller not found: ${controllerFilePath}`, undefined, {
|
|
35998
|
+
showTimestamp: false,
|
|
35999
|
+
showArrow: false,
|
|
36000
|
+
useSymbol: true
|
|
36001
|
+
});
|
|
36002
|
+
return;
|
|
36003
|
+
}
|
|
36004
|
+
const controllerContent = await controllerFile.text();
|
|
36005
|
+
const routeInfo = this.parseController(controllerContent);
|
|
36006
|
+
const benchmark = {
|
|
36007
|
+
name: routeInfo.name,
|
|
36008
|
+
path: routeInfo.path,
|
|
36009
|
+
method: routeInfo.method,
|
|
36010
|
+
description: routeInfo.description
|
|
36011
|
+
};
|
|
36012
|
+
if (Object.keys(routeInfo.params).length > 0) {
|
|
36013
|
+
benchmark.params = routeInfo.params;
|
|
36014
|
+
}
|
|
36015
|
+
if (Object.keys(routeInfo.queries).length > 0) {
|
|
36016
|
+
benchmark.queries = routeInfo.queries;
|
|
36017
|
+
}
|
|
36018
|
+
if (Object.keys(routeInfo.payload).length > 0) {
|
|
36019
|
+
benchmark.payload = routeInfo.payload;
|
|
36020
|
+
}
|
|
36021
|
+
benchmark.connections = 10;
|
|
36022
|
+
benchmark.duration = 10;
|
|
36023
|
+
const jsonContent = JSON.stringify(benchmark, null, 2);
|
|
36024
|
+
const benchmarkFileName = `${name}.bench.json`;
|
|
36025
|
+
const filePath = join12(controllersDir, benchmarkFileName);
|
|
36026
|
+
await Bun.write(filePath, `${jsonContent}
|
|
36027
|
+
`);
|
|
36028
|
+
const logger = new TerminalLogger11;
|
|
36029
|
+
logger.success(`${join12(controllersLocalDir, benchmarkFileName)} created successfully`, undefined, {
|
|
36030
|
+
showTimestamp: false,
|
|
36031
|
+
showArrow: false,
|
|
36032
|
+
useSymbol: true
|
|
36033
|
+
});
|
|
36034
|
+
}
|
|
36035
|
+
}
|
|
36036
|
+
MakeBenchmarkCommand = __legacyDecorateClassTS([
|
|
36037
|
+
decorator12.command()
|
|
36038
|
+
], MakeBenchmarkCommand);
|
|
36027
36039
|
// src/commands/MakeCacheCommand.ts
|
|
36028
36040
|
import { join as join13 } from "path";
|
|
36029
36041
|
import { decorator as decorator13 } from "@ooneex/command";
|
|
@@ -50707,4 +50719,4 @@ SeedRunCommand = __legacyDecorateClassTS([
|
|
|
50707
50719
|
// src/index.ts
|
|
50708
50720
|
await run();
|
|
50709
50721
|
|
|
50710
|
-
//# debugId=
|
|
50722
|
+
//# debugId=7BBBEE66B30126ED64756E2164756E21
|