technical-debt-radar 1.2.0 → 1.2.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 +33 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10797,7 +10797,7 @@ var require_volume_estimator = __commonJS({
|
|
|
10797
10797
|
};
|
|
10798
10798
|
})();
|
|
10799
10799
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10800
|
-
exports2.estimateVolumes =
|
|
10800
|
+
exports2.estimateVolumes = estimateVolumes3;
|
|
10801
10801
|
exports2.parseTypeORMEntities = parseTypeORMEntities;
|
|
10802
10802
|
exports2.parsePrismaModels = parsePrismaModels;
|
|
10803
10803
|
exports2.parseDrizzleTables = parseDrizzleTables;
|
|
@@ -10828,7 +10828,7 @@ var require_volume_estimator = __commonJS({
|
|
|
10828
10828
|
size: "S"
|
|
10829
10829
|
}
|
|
10830
10830
|
];
|
|
10831
|
-
async function
|
|
10831
|
+
async function estimateVolumes3(projectPath) {
|
|
10832
10832
|
const prismaVolumes = await estimatePrismaVolumes(projectPath);
|
|
10833
10833
|
if (Object.keys(prismaVolumes).length > 0)
|
|
10834
10834
|
return prismaVolumes;
|
|
@@ -19326,6 +19326,30 @@ function buildTopHotspots(violations) {
|
|
|
19326
19326
|
}
|
|
19327
19327
|
return Array.from(byFile.entries()).map(([file, data]) => ({ file, ...data })).sort((a, b) => b.debtPoints - a.debtPoints).slice(0, 10);
|
|
19328
19328
|
}
|
|
19329
|
+
async function detectDataVolumes(projectRoot, filePaths, existingVolumes) {
|
|
19330
|
+
let estimated = {};
|
|
19331
|
+
try {
|
|
19332
|
+
estimated = await (0, import_policy_engine.estimateVolumes)(projectRoot);
|
|
19333
|
+
} catch {
|
|
19334
|
+
}
|
|
19335
|
+
const volumes = { ...existingVolumes };
|
|
19336
|
+
for (const [entity, size] of Object.entries(estimated)) {
|
|
19337
|
+
if (!volumes[entity]) {
|
|
19338
|
+
volumes[entity] = size;
|
|
19339
|
+
}
|
|
19340
|
+
}
|
|
19341
|
+
const entityPattern = /\.(?:schema|entity|model)\.(ts|js)$/;
|
|
19342
|
+
for (const fp of filePaths) {
|
|
19343
|
+
if (!entityPattern.test(fp)) continue;
|
|
19344
|
+
const basename2 = path2.basename(fp);
|
|
19345
|
+
const entityName = basename2.replace(/\.(schema|entity|model)\.(ts|js)$/, "");
|
|
19346
|
+
if (!entityName || entityName === "index") continue;
|
|
19347
|
+
if (!volumes[entityName]) {
|
|
19348
|
+
volumes[entityName] = volumes["default"] ?? "S";
|
|
19349
|
+
}
|
|
19350
|
+
}
|
|
19351
|
+
return volumes;
|
|
19352
|
+
}
|
|
19329
19353
|
var ANON_SCAN_DIR = path2.join(os2.homedir(), ".radar");
|
|
19330
19354
|
var ANON_SCAN_FILE = path2.join(ANON_SCAN_DIR, ".anonymous-scan");
|
|
19331
19355
|
function checkAnonymousScanAllowed() {
|
|
@@ -19540,11 +19564,17 @@ async function scanCommand(targetPath, options) {
|
|
|
19540
19564
|
};
|
|
19541
19565
|
try {
|
|
19542
19566
|
await client.reportScan(reportData);
|
|
19567
|
+
const enrichedConfig = { ...loaded.parsedConfig };
|
|
19568
|
+
enrichedConfig.data_volumes = await detectDataVolumes(
|
|
19569
|
+
path2.resolve(targetPath),
|
|
19570
|
+
files,
|
|
19571
|
+
enrichedConfig.data_volumes ?? {}
|
|
19572
|
+
);
|
|
19543
19573
|
await client.pushPolicyConfig({
|
|
19544
19574
|
repoName: path2.basename(path2.resolve(targetPath)),
|
|
19545
19575
|
radarYaml: loaded.radarYaml,
|
|
19546
19576
|
rulesYaml: loaded.rulesYaml,
|
|
19547
|
-
parsedConfig:
|
|
19577
|
+
parsedConfig: enrichedConfig
|
|
19548
19578
|
}).catch(() => {
|
|
19549
19579
|
});
|
|
19550
19580
|
console.log(import_chalk.default.green(" \u2713 Results synced to dashboard: https://www.technicaldebtradar.com/dashboard"));
|