@doccov/cli 0.34.0 → 0.34.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.
Files changed (2) hide show
  1. package/dist/drift.js +74 -23
  2. package/package.json +1 -1
package/dist/drift.js CHANGED
@@ -175382,12 +175382,38 @@ function findPackageJson2(entryFile) {
175382
175382
  function hashString(s) {
175383
175383
  return createHash("sha256").update(s).digest("hex").slice(0, 16);
175384
175384
  }
175385
+ function getSourceMaxMtime(entryFile) {
175386
+ const pkgJson = findPackageJson2(entryFile);
175387
+ if (!pkgJson)
175388
+ return 0;
175389
+ const pkgDir = path12.dirname(pkgJson);
175390
+ const srcDir = path12.join(pkgDir, "src");
175391
+ return walkMaxMtime(existsSync9(srcDir) ? srcDir : pkgDir);
175392
+ }
175393
+ function walkMaxMtime(dir) {
175394
+ let max = 0;
175395
+ try {
175396
+ for (const entry of readdirSync2(dir, { withFileTypes: true })) {
175397
+ if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules" && entry.name !== "dist") {
175398
+ const sub = walkMaxMtime(path12.join(dir, entry.name));
175399
+ if (sub > max)
175400
+ max = sub;
175401
+ } else if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".tsx"))) {
175402
+ const mt = getMtime(path12.join(dir, entry.name));
175403
+ if (mt > max)
175404
+ max = mt;
175405
+ }
175406
+ }
175407
+ } catch {}
175408
+ return max;
175409
+ }
175385
175410
  function buildCacheKey(input) {
175386
175411
  const absEntry = path12.resolve(input.entryFile);
175387
175412
  const entryMtime = getMtime(absEntry);
175388
175413
  const pkgJson = findPackageJson2(absEntry);
175389
175414
  const pkgMtime = pkgJson ? getMtime(pkgJson) : 0;
175390
- const parts = [absEntry, String(entryMtime), String(pkgMtime)];
175415
+ const srcMtime = getSourceMaxMtime(absEntry);
175416
+ const parts = [absEntry, String(entryMtime), String(pkgMtime), String(srcMtime)];
175391
175417
  if (input.configHash)
175392
175418
  parts.push(input.configHash);
175393
175419
  return hashString(parts.join("|"));
@@ -175568,6 +175594,9 @@ function renderBatchCoverage(data) {
175568
175594
  }
175569
175595
  lines.push("");
175570
175596
  lines.push(indent(`${c.bold("Total")}: ${data.aggregate.score}% (${data.aggregate.documented}/${data.aggregate.total})`));
175597
+ if (data.skipped && data.skipped.length > 0) {
175598
+ lines.push(indent(`${c.gray(`Skipped ${data.skipped.length} private: ${data.skipped.join(", ")}`)}`));
175599
+ }
175571
175600
  lines.push("");
175572
175601
  return lines.join(`
175573
175602
  `);
@@ -175583,6 +175612,9 @@ function renderBatchLint(data) {
175583
175612
  }
175584
175613
  lines.push("");
175585
175614
  lines.push(indent(`${c.bold("Total")}: ${data.aggregate.count} issue${data.aggregate.count === 1 ? "" : "s"}`));
175615
+ if (data.skipped && data.skipped.length > 0) {
175616
+ lines.push(indent(`${c.gray(`Skipped ${data.skipped.length} private: ${data.skipped.join(", ")}`)}`));
175617
+ }
175586
175618
  lines.push("");
175587
175619
  return lines.join(`
175588
175620
  `);
@@ -175937,10 +175969,14 @@ function registerHealthCommand(program) {
175937
175969
  const version = getVersion();
175938
175970
  try {
175939
175971
  if (options.all) {
175940
- let packages = discoverPackages(process.cwd());
175941
- if (packages && !options.private)
175942
- packages = filterPublic(packages);
175943
- if (!packages || packages.length === 0) {
175972
+ const allPackages = discoverPackages(process.cwd());
175973
+ if (!allPackages || allPackages.length === 0) {
175974
+ formatError("health", "No workspace packages found", startTime, version);
175975
+ return;
175976
+ }
175977
+ const skipped = options.private ? [] : allPackages.filter((p) => p.private).map((p) => p.name);
175978
+ const packages = options.private ? allPackages : filterPublic(allPackages);
175979
+ if (packages.length === 0) {
175944
175980
  formatError("health", "No workspace packages found", startTime, version);
175945
175981
  return;
175946
175982
  }
@@ -175961,7 +175997,7 @@ function registerHealthCommand(program) {
175961
175997
  totalAll += exps.length;
175962
175998
  }
175963
175999
  const aggScore = totalAll > 0 ? Math.round(totalDoc / totalAll * 100) : 100;
175964
- const data2 = { packages: rows, aggregate: { score: aggScore, documented: totalDoc, total: totalAll } };
176000
+ const data2 = { packages: rows, aggregate: { score: aggScore, documented: totalDoc, total: totalAll }, ...skipped.length > 0 ? { skipped } : {} };
175965
176001
  formatOutput("health", data2, startTime, version, renderBatchCoverage);
175966
176002
  return;
175967
176003
  }
@@ -176620,6 +176656,7 @@ function registerCiCommand(program) {
176620
176656
  packageDirs = allDirs;
176621
176657
  const minThreshold = config.coverage?.min ?? 0;
176622
176658
  const results = [];
176659
+ const skipped = [];
176623
176660
  const commit = gh.sha?.slice(0, 7) ?? getCommitSha();
176624
176661
  for (const dir of packageDirs) {
176625
176662
  const absDir = dir === "." ? cwd : path23.join(cwd, dir);
@@ -176637,8 +176674,10 @@ function registerCiCommand(program) {
176637
176674
  isPrivate = true;
176638
176675
  } catch {}
176639
176676
  }
176640
- if (isPrivate && !options.private)
176677
+ if (isPrivate && !options.private) {
176678
+ skipped.push(name);
176641
176679
  continue;
176680
+ }
176642
176681
  try {
176643
176682
  const entryFile = detectEntry(absDir);
176644
176683
  const { spec } = await cachedExtract(entryFile);
@@ -176698,7 +176737,7 @@ function registerCiCommand(program) {
176698
176737
  } catch {}
176699
176738
  }
176700
176739
  }
176701
- const data = { results, pass: allPass, min: minThreshold };
176740
+ const data = { results, pass: allPass, min: minThreshold, ...skipped.length > 0 ? { skipped } : {} };
176702
176741
  formatOutput("ci", data, startTime, version, renderCi);
176703
176742
  if (!allPass)
176704
176743
  process.exitCode = 1;
@@ -176753,10 +176792,14 @@ function registerCoverageCommand(program) {
176753
176792
  const version = getVersion6();
176754
176793
  try {
176755
176794
  if (options.all) {
176756
- let packages = discoverPackages(process.cwd());
176757
- if (packages && !options.private)
176758
- packages = filterPublic(packages);
176759
- if (!packages || packages.length === 0) {
176795
+ const allPackages = discoverPackages(process.cwd());
176796
+ if (!allPackages || allPackages.length === 0) {
176797
+ formatError("coverage", "No workspace packages found", startTime, version);
176798
+ return;
176799
+ }
176800
+ const skipped = options.private ? [] : allPackages.filter((p) => p.private).map((p) => p.name);
176801
+ const packages = options.private ? allPackages : filterPublic(allPackages);
176802
+ if (packages.length === 0) {
176760
176803
  formatError("coverage", "No workspace packages found", startTime, version);
176761
176804
  return;
176762
176805
  }
@@ -176777,7 +176820,7 @@ function registerCoverageCommand(program) {
176777
176820
  totalAll += exps.length;
176778
176821
  }
176779
176822
  const aggScore = totalAll > 0 ? Math.round(totalDoc / totalAll * 100) : 100;
176780
- const data2 = { packages: rows, aggregate: { score: aggScore, documented: totalDoc, total: totalAll } };
176823
+ const data2 = { packages: rows, aggregate: { score: aggScore, documented: totalDoc, total: totalAll }, ...skipped.length > 0 ? { skipped } : {} };
176781
176824
  formatOutput("coverage", data2, startTime, version, renderBatchCoverage);
176782
176825
  const minT = options.min ? parseInt(options.min, 10) : undefined;
176783
176826
  if (minT !== undefined && aggScore < minT)
@@ -176966,10 +177009,14 @@ function registerExtractCommand(program) {
176966
177009
  const version = getVersion8();
176967
177010
  try {
176968
177011
  if (options.all) {
176969
- let packages = discoverPackages(process.cwd());
176970
- if (packages && !options.private)
176971
- packages = filterPublic(packages);
176972
- if (!packages || packages.length === 0) {
177012
+ const allPackages = discoverPackages(process.cwd());
177013
+ if (!allPackages || allPackages.length === 0) {
177014
+ formatError("extract", "No workspace packages found", startTime, version);
177015
+ return;
177016
+ }
177017
+ const skipped = options.private ? [] : allPackages.filter((p) => p.private).map((p) => p.name);
177018
+ const packages = options.private ? allPackages : filterPublic(allPackages);
177019
+ if (packages.length === 0) {
176973
177020
  formatError("extract", "No workspace packages found", startTime, version);
176974
177021
  return;
176975
177022
  }
@@ -176978,7 +177025,7 @@ function registerExtractCommand(program) {
176978
177025
  const { spec: spec2 } = await cachedExtract(pkg.entry);
176979
177026
  specs.push({ name: pkg.name, spec: spec2 });
176980
177027
  }
176981
- formatOutput("extract", { packages: specs }, startTime, version);
177028
+ formatOutput("extract", { packages: specs, ...skipped.length > 0 ? { skipped } : {} }, startTime, version);
176982
177029
  return;
176983
177030
  }
176984
177031
  const entryFile = entry ? path26.resolve(process.cwd(), entry) : detectEntry();
@@ -177490,10 +177537,14 @@ function registerLintCommand(program) {
177490
177537
  const version = getVersion12();
177491
177538
  try {
177492
177539
  if (options.all) {
177493
- let packages = discoverPackages(process.cwd());
177494
- if (packages && !options.private)
177495
- packages = filterPublic(packages);
177496
- if (!packages || packages.length === 0) {
177540
+ const allPackages = discoverPackages(process.cwd());
177541
+ if (!allPackages || allPackages.length === 0) {
177542
+ formatError("lint", "No workspace packages found", startTime, version);
177543
+ return;
177544
+ }
177545
+ const skipped = options.private ? [] : allPackages.filter((p) => p.private).map((p) => p.name);
177546
+ const packages = options.private ? allPackages : filterPublic(allPackages);
177547
+ if (packages.length === 0) {
177497
177548
  formatError("lint", "No workspace packages found", startTime, version);
177498
177549
  return;
177499
177550
  }
@@ -177508,7 +177559,7 @@ function registerLintCommand(program) {
177508
177559
  rows.push({ name: pkg.name, exports: (spec2.exports ?? []).length, issues: issues2 });
177509
177560
  totalIssues += issues2;
177510
177561
  }
177511
- const data2 = { packages: rows, aggregate: { count: totalIssues } };
177562
+ const data2 = { packages: rows, aggregate: { count: totalIssues }, ...skipped.length > 0 ? { skipped } : {} };
177512
177563
  formatOutput("lint", data2, startTime, version, renderBatchLint);
177513
177564
  if (totalIssues > 0)
177514
177565
  process.exitCode = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doccov/cli",
3
- "version": "0.34.0",
3
+ "version": "0.34.2",
4
4
  "description": "DocCov CLI - Documentation coverage and drift detection for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",