ortoni-report 4.0.2-beta.1 → 4.0.2
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/changelog.md +22 -0
- package/dist/{chunk-INS3E7E6.mjs → chunk-4RZ5C7KY.mjs} +402 -296
- package/dist/{cli/cli.js → cli.js} +405 -190
- package/dist/cli.mjs +208 -0
- package/dist/index.html +2 -2
- package/dist/ortoni-report.d.mts +8 -1
- package/dist/ortoni-report.d.ts +8 -1
- package/dist/ortoni-report.js +210 -95
- package/dist/ortoni-report.mjs +24 -21
- package/package.json +11 -4
- package/readme.md +60 -75
- package/dist/chunk-45EJSEX2.mjs +0 -632
- package/dist/chunk-75EAJL2U.mjs +0 -632
- package/dist/chunk-A6HCKATU.mjs +0 -76
- package/dist/chunk-FGIYOFIC.mjs +0 -632
- package/dist/chunk-FHKWBHU6.mjs +0 -633
- package/dist/chunk-GLICR3VS.mjs +0 -637
- package/dist/chunk-HFO6XSKC.mjs +0 -633
- package/dist/chunk-HOZD6YIV.mjs +0 -634
- package/dist/chunk-IJO2YIFE.mjs +0 -637
- package/dist/chunk-JEIWNUQY.mjs +0 -632
- package/dist/chunk-JPLAGYR7.mjs +0 -632
- package/dist/chunk-NM6ULN2O.mjs +0 -632
- package/dist/chunk-OZS6QIJS.mjs +0 -638
- package/dist/chunk-P57227VN.mjs +0 -633
- package/dist/chunk-QMTRYN5N.js +0 -635
- package/dist/chunk-TI33PMMQ.mjs +0 -639
- package/dist/chunk-Z5NBP5TS.mjs +0 -635
- package/dist/cli/cli.cjs +0 -678
- package/dist/cli/cli.d.cts +0 -1
- package/dist/cli/cli.mjs +0 -103
- package/dist/ortoni-report.cjs +0 -2134
- package/dist/ortoni-report.d.cts +0 -111
- /package/dist/{cli/cli.d.mts → cli.d.mts} +0 -0
- /package/dist/{cli/cli.d.ts → cli.d.ts} +0 -0
package/dist/cli/cli.mjs
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
DatabaseManager,
|
|
4
|
-
FileManager,
|
|
5
|
-
HTMLGenerator,
|
|
6
|
-
startReportServer
|
|
7
|
-
} from "../chunk-JEIWNUQY.mjs";
|
|
8
|
-
|
|
9
|
-
// src/cli/cli.ts
|
|
10
|
-
import { program } from "commander";
|
|
11
|
-
import * as fs2 from "fs";
|
|
12
|
-
import * as path2 from "path";
|
|
13
|
-
|
|
14
|
-
// src/cli/mergeData.ts
|
|
15
|
-
import * as fs from "fs";
|
|
16
|
-
import * as path from "path";
|
|
17
|
-
async function mergerData(options) {
|
|
18
|
-
const projectRoot = process.cwd();
|
|
19
|
-
const folderPath = path.resolve(projectRoot, options.dir);
|
|
20
|
-
console.info(`Ortoni Report: Merging shard files in folder: ${folderPath}`);
|
|
21
|
-
const shardFiles = fs.readdirSync(folderPath).filter((f) => f.startsWith("ortoni-shard-") && f.endsWith(".json"));
|
|
22
|
-
if (shardFiles.length === 0) {
|
|
23
|
-
console.error("Ortoni Report: \u274C No shard files found to merge.");
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
let allResults = [];
|
|
27
|
-
let projectSet = /* @__PURE__ */ new Set();
|
|
28
|
-
let totalDuration = 0;
|
|
29
|
-
let mergedUserConfig = null;
|
|
30
|
-
let mergedUserMeta = null;
|
|
31
|
-
for (const file of shardFiles) {
|
|
32
|
-
const shardData = JSON.parse(
|
|
33
|
-
fs.readFileSync(path.join(folderPath, file), "utf-8")
|
|
34
|
-
);
|
|
35
|
-
allResults.push(...shardData.results);
|
|
36
|
-
shardData.projectSet.forEach((p) => projectSet.add(p));
|
|
37
|
-
totalDuration += shardData.duration;
|
|
38
|
-
if (!mergedUserConfig && shardData.userConfig)
|
|
39
|
-
mergedUserConfig = shardData.userConfig;
|
|
40
|
-
if (!mergedUserMeta && shardData.userMeta)
|
|
41
|
-
mergedUserMeta = shardData.userMeta;
|
|
42
|
-
}
|
|
43
|
-
const dbManager = new DatabaseManager();
|
|
44
|
-
await dbManager.initialize(
|
|
45
|
-
path.join(folderPath, "ortoni-data-history.sqlite")
|
|
46
|
-
);
|
|
47
|
-
const runId = await dbManager.saveTestRun();
|
|
48
|
-
if (typeof runId === "number") {
|
|
49
|
-
await dbManager.saveTestResults(runId, allResults);
|
|
50
|
-
} else {
|
|
51
|
-
console.error("Ortoni Report: \u274C Failed to save test run to database.");
|
|
52
|
-
}
|
|
53
|
-
const htmlGenerator = new HTMLGenerator(
|
|
54
|
-
{ ...mergedUserConfig, meta: mergedUserMeta?.meta },
|
|
55
|
-
dbManager
|
|
56
|
-
);
|
|
57
|
-
const finalReportData = await htmlGenerator.generateFinalReport(
|
|
58
|
-
allResults.filter((r) => r.status !== "skipped"),
|
|
59
|
-
totalDuration,
|
|
60
|
-
allResults,
|
|
61
|
-
projectSet
|
|
62
|
-
);
|
|
63
|
-
const fileManager = new FileManager(folderPath);
|
|
64
|
-
const outputFileName = options.file || "ortoni-report.html";
|
|
65
|
-
const outputFilenamePath = path.join(folderPath, outputFileName);
|
|
66
|
-
const outputPath = fileManager.writeReportFile(
|
|
67
|
-
outputFilenamePath,
|
|
68
|
-
finalReportData
|
|
69
|
-
);
|
|
70
|
-
console.log(`\u2705 Final merged report generated at ${outputPath}`);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/cli/cli.ts
|
|
74
|
-
program.version("4.0.1").description("Ortoni Report - CLI");
|
|
75
|
-
program.command("show-report").description("Open Ortoni Report").option(
|
|
76
|
-
"-d, --dir <path>",
|
|
77
|
-
"Path to the folder containing the report",
|
|
78
|
-
"ortoni-report"
|
|
79
|
-
).option(
|
|
80
|
-
"-f, --file <filename>",
|
|
81
|
-
"Name of the report file",
|
|
82
|
-
"ortoni-report.html"
|
|
83
|
-
).option("-p, --port <port>", "Port to run the server", "2004").action((options) => {
|
|
84
|
-
const projectRoot = process.cwd();
|
|
85
|
-
const folderPath = path2.resolve(projectRoot, options.dir);
|
|
86
|
-
const filePath = path2.resolve(folderPath, options.file);
|
|
87
|
-
const port = parseInt(options.port) || 2004;
|
|
88
|
-
if (!fs2.existsSync(filePath)) {
|
|
89
|
-
console.error(
|
|
90
|
-
`\u274C Error: The file "${filePath}" does not exist in "${folderPath}".`
|
|
91
|
-
);
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
startReportServer(folderPath, path2.basename(filePath), port, "always");
|
|
95
|
-
});
|
|
96
|
-
program.command("merge-report").description("Merge sharded reports into one final report").option(
|
|
97
|
-
"-d, --dir <path>",
|
|
98
|
-
"Path to the folder containing shard files",
|
|
99
|
-
"ortoni-report"
|
|
100
|
-
).option("-f, --file <filename>", "Output report file", "ortoni-report.html").action(async (options) => {
|
|
101
|
-
await mergerData(options);
|
|
102
|
-
});
|
|
103
|
-
program.parse(process.argv);
|