@doccov/cli 0.33.1 → 0.34.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/drift.js +63 -19
- package/package.json +1 -1
package/dist/drift.js
CHANGED
|
@@ -175568,6 +175568,9 @@ function renderBatchCoverage(data) {
|
|
|
175568
175568
|
}
|
|
175569
175569
|
lines.push("");
|
|
175570
175570
|
lines.push(indent(`${c.bold("Total")}: ${data.aggregate.score}% (${data.aggregate.documented}/${data.aggregate.total})`));
|
|
175571
|
+
if (data.skipped && data.skipped.length > 0) {
|
|
175572
|
+
lines.push(indent(`${c.gray(`Skipped ${data.skipped.length} private: ${data.skipped.join(", ")}`)}`));
|
|
175573
|
+
}
|
|
175571
175574
|
lines.push("");
|
|
175572
175575
|
return lines.join(`
|
|
175573
175576
|
`);
|
|
@@ -175583,6 +175586,9 @@ function renderBatchLint(data) {
|
|
|
175583
175586
|
}
|
|
175584
175587
|
lines.push("");
|
|
175585
175588
|
lines.push(indent(`${c.bold("Total")}: ${data.aggregate.count} issue${data.aggregate.count === 1 ? "" : "s"}`));
|
|
175589
|
+
if (data.skipped && data.skipped.length > 0) {
|
|
175590
|
+
lines.push(indent(`${c.gray(`Skipped ${data.skipped.length} private: ${data.skipped.join(", ")}`)}`));
|
|
175591
|
+
}
|
|
175586
175592
|
lines.push("");
|
|
175587
175593
|
return lines.join(`
|
|
175588
175594
|
`);
|
|
@@ -175700,21 +175706,27 @@ function discoverPackages(cwd) {
|
|
|
175700
175706
|
if (!existsSync10(absDir))
|
|
175701
175707
|
continue;
|
|
175702
175708
|
let name = dir;
|
|
175709
|
+
let isPrivate = false;
|
|
175703
175710
|
const pkgPath = path13.join(absDir, "package.json");
|
|
175704
175711
|
if (existsSync10(pkgPath)) {
|
|
175705
175712
|
try {
|
|
175706
175713
|
const pkg = JSON.parse(readFileSync9(pkgPath, "utf-8"));
|
|
175707
175714
|
if (pkg.name)
|
|
175708
175715
|
name = pkg.name;
|
|
175716
|
+
if (pkg.private === true)
|
|
175717
|
+
isPrivate = true;
|
|
175709
175718
|
} catch {}
|
|
175710
175719
|
}
|
|
175711
175720
|
try {
|
|
175712
175721
|
const entry = detectEntry(absDir);
|
|
175713
|
-
packages.push({ name, dir, entry });
|
|
175722
|
+
packages.push({ name, dir, entry, ...isPrivate ? { private: true } : {} });
|
|
175714
175723
|
} catch {}
|
|
175715
175724
|
}
|
|
175716
175725
|
return packages;
|
|
175717
175726
|
}
|
|
175727
|
+
function filterPublic(packages) {
|
|
175728
|
+
return packages.filter((p) => !p.private);
|
|
175729
|
+
}
|
|
175718
175730
|
|
|
175719
175731
|
// src/utils/detect-entry.ts
|
|
175720
175732
|
function detectEntry(cwd = process.cwd()) {
|
|
@@ -175926,13 +175938,19 @@ function getPackageInfo(cwd) {
|
|
|
175926
175938
|
}
|
|
175927
175939
|
}
|
|
175928
175940
|
function registerHealthCommand(program) {
|
|
175929
|
-
program.command("health [entry]", { isDefault: true }).description("Show documentation health score (default command)").option("--min <n>", "Minimum health threshold (exit 1 if below)").option("--all", "Run across all workspace packages").action(async (entry, options) => {
|
|
175941
|
+
program.command("health [entry]", { isDefault: true }).description("Show documentation health score (default command)").option("--min <n>", "Minimum health threshold (exit 1 if below)").option("--all", "Run across all workspace packages").option("--private", "Include private packages in --all mode").action(async (entry, options) => {
|
|
175930
175942
|
const startTime = Date.now();
|
|
175931
175943
|
const version = getVersion();
|
|
175932
175944
|
try {
|
|
175933
175945
|
if (options.all) {
|
|
175934
|
-
const
|
|
175935
|
-
if (!
|
|
175946
|
+
const allPackages = discoverPackages(process.cwd());
|
|
175947
|
+
if (!allPackages || allPackages.length === 0) {
|
|
175948
|
+
formatError("health", "No workspace packages found", startTime, version);
|
|
175949
|
+
return;
|
|
175950
|
+
}
|
|
175951
|
+
const skipped = options.private ? [] : allPackages.filter((p) => p.private).map((p) => p.name);
|
|
175952
|
+
const packages = options.private ? allPackages : filterPublic(allPackages);
|
|
175953
|
+
if (packages.length === 0) {
|
|
175936
175954
|
formatError("health", "No workspace packages found", startTime, version);
|
|
175937
175955
|
return;
|
|
175938
175956
|
}
|
|
@@ -175953,7 +175971,7 @@ function registerHealthCommand(program) {
|
|
|
175953
175971
|
totalAll += exps.length;
|
|
175954
175972
|
}
|
|
175955
175973
|
const aggScore = totalAll > 0 ? Math.round(totalDoc / totalAll * 100) : 100;
|
|
175956
|
-
const data2 = { packages: rows, aggregate: { score: aggScore, documented: totalDoc, total: totalAll } };
|
|
175974
|
+
const data2 = { packages: rows, aggregate: { score: aggScore, documented: totalDoc, total: totalAll }, ...skipped.length > 0 ? { skipped } : {} };
|
|
175957
175975
|
formatOutput("health", data2, startTime, version, renderBatchCoverage);
|
|
175958
175976
|
return;
|
|
175959
175977
|
}
|
|
@@ -176593,7 +176611,7 @@ function buildMarkdownTable(results, pass) {
|
|
|
176593
176611
|
`);
|
|
176594
176612
|
}
|
|
176595
176613
|
function registerCiCommand(program) {
|
|
176596
|
-
program.command("ci").description("Run CI checks on changed packages").option("--all", "Check all packages, not just changed ones").action(async (options) => {
|
|
176614
|
+
program.command("ci").description("Run CI checks on changed packages").option("--all", "Check all packages, not just changed ones").option("--private", "Include private packages").action(async (options) => {
|
|
176597
176615
|
const startTime = Date.now();
|
|
176598
176616
|
const version = getVersion5();
|
|
176599
176617
|
const cwd = process.cwd();
|
|
@@ -176612,20 +176630,28 @@ function registerCiCommand(program) {
|
|
|
176612
176630
|
packageDirs = allDirs;
|
|
176613
176631
|
const minThreshold = config.coverage?.min ?? 0;
|
|
176614
176632
|
const results = [];
|
|
176633
|
+
const skipped = [];
|
|
176615
176634
|
const commit = gh.sha?.slice(0, 7) ?? getCommitSha();
|
|
176616
176635
|
for (const dir of packageDirs) {
|
|
176617
176636
|
const absDir = dir === "." ? cwd : path23.join(cwd, dir);
|
|
176618
176637
|
if (!existsSync17(absDir))
|
|
176619
176638
|
continue;
|
|
176620
176639
|
let name = dir;
|
|
176640
|
+
let isPrivate = false;
|
|
176621
176641
|
const pkgPath = path23.join(absDir, "package.json");
|
|
176622
176642
|
if (existsSync17(pkgPath)) {
|
|
176623
176643
|
try {
|
|
176624
176644
|
const pkg = JSON.parse(readFileSync20(pkgPath, "utf-8"));
|
|
176625
176645
|
if (pkg.name)
|
|
176626
176646
|
name = pkg.name;
|
|
176647
|
+
if (pkg.private === true)
|
|
176648
|
+
isPrivate = true;
|
|
176627
176649
|
} catch {}
|
|
176628
176650
|
}
|
|
176651
|
+
if (isPrivate && !options.private) {
|
|
176652
|
+
skipped.push(name);
|
|
176653
|
+
continue;
|
|
176654
|
+
}
|
|
176629
176655
|
try {
|
|
176630
176656
|
const entryFile = detectEntry(absDir);
|
|
176631
176657
|
const { spec } = await cachedExtract(entryFile);
|
|
@@ -176685,7 +176711,7 @@ function registerCiCommand(program) {
|
|
|
176685
176711
|
} catch {}
|
|
176686
176712
|
}
|
|
176687
176713
|
}
|
|
176688
|
-
const data = { results, pass: allPass, min: minThreshold };
|
|
176714
|
+
const data = { results, pass: allPass, min: minThreshold, ...skipped.length > 0 ? { skipped } : {} };
|
|
176689
176715
|
formatOutput("ci", data, startTime, version, renderCi);
|
|
176690
176716
|
if (!allPass)
|
|
176691
176717
|
process.exitCode = 1;
|
|
@@ -176735,13 +176761,19 @@ function getVersion6() {
|
|
|
176735
176761
|
}
|
|
176736
176762
|
}
|
|
176737
176763
|
function registerCoverageCommand(program) {
|
|
176738
|
-
program.command("coverage [entry]").description("Measure documentation coverage for a TypeScript entry file").option("--min <n>", "Minimum coverage threshold (exit 1 if below)").option("--all", "Run across all workspace packages").action(async (entry, options) => {
|
|
176764
|
+
program.command("coverage [entry]").description("Measure documentation coverage for a TypeScript entry file").option("--min <n>", "Minimum coverage threshold (exit 1 if below)").option("--all", "Run across all workspace packages").option("--private", "Include private packages in --all mode").action(async (entry, options) => {
|
|
176739
176765
|
const startTime = Date.now();
|
|
176740
176766
|
const version = getVersion6();
|
|
176741
176767
|
try {
|
|
176742
176768
|
if (options.all) {
|
|
176743
|
-
const
|
|
176744
|
-
if (!
|
|
176769
|
+
const allPackages = discoverPackages(process.cwd());
|
|
176770
|
+
if (!allPackages || allPackages.length === 0) {
|
|
176771
|
+
formatError("coverage", "No workspace packages found", startTime, version);
|
|
176772
|
+
return;
|
|
176773
|
+
}
|
|
176774
|
+
const skipped = options.private ? [] : allPackages.filter((p) => p.private).map((p) => p.name);
|
|
176775
|
+
const packages = options.private ? allPackages : filterPublic(allPackages);
|
|
176776
|
+
if (packages.length === 0) {
|
|
176745
176777
|
formatError("coverage", "No workspace packages found", startTime, version);
|
|
176746
176778
|
return;
|
|
176747
176779
|
}
|
|
@@ -176762,7 +176794,7 @@ function registerCoverageCommand(program) {
|
|
|
176762
176794
|
totalAll += exps.length;
|
|
176763
176795
|
}
|
|
176764
176796
|
const aggScore = totalAll > 0 ? Math.round(totalDoc / totalAll * 100) : 100;
|
|
176765
|
-
const data2 = { packages: rows, aggregate: { score: aggScore, documented: totalDoc, total: totalAll } };
|
|
176797
|
+
const data2 = { packages: rows, aggregate: { score: aggScore, documented: totalDoc, total: totalAll }, ...skipped.length > 0 ? { skipped } : {} };
|
|
176766
176798
|
formatOutput("coverage", data2, startTime, version, renderBatchCoverage);
|
|
176767
176799
|
const minT = options.min ? parseInt(options.min, 10) : undefined;
|
|
176768
176800
|
if (minT !== undefined && aggScore < minT)
|
|
@@ -176946,13 +176978,19 @@ function getVersion8() {
|
|
|
176946
176978
|
}
|
|
176947
176979
|
}
|
|
176948
176980
|
function registerExtractCommand(program) {
|
|
176949
|
-
program.command("extract [entry]").description("Extract OpenPkg spec from TypeScript entry file").option("-o, --output <file>", "Write JSON to file instead of stdout").option("--only <patterns>", "Include exports matching glob (comma-separated)").option("--ignore <patterns>", "Exclude exports matching glob (comma-separated)").option("--max-depth <n>", "Max type resolution depth", "10").option("--all", "Extract from all workspace packages").action(async (entry, options) => {
|
|
176981
|
+
program.command("extract [entry]").description("Extract OpenPkg spec from TypeScript entry file").option("-o, --output <file>", "Write JSON to file instead of stdout").option("--only <patterns>", "Include exports matching glob (comma-separated)").option("--ignore <patterns>", "Exclude exports matching glob (comma-separated)").option("--max-depth <n>", "Max type resolution depth", "10").option("--all", "Extract from all workspace packages").option("--private", "Include private packages in --all mode").action(async (entry, options) => {
|
|
176950
176982
|
const startTime = Date.now();
|
|
176951
176983
|
const version = getVersion8();
|
|
176952
176984
|
try {
|
|
176953
176985
|
if (options.all) {
|
|
176954
|
-
const
|
|
176955
|
-
if (!
|
|
176986
|
+
const allPackages = discoverPackages(process.cwd());
|
|
176987
|
+
if (!allPackages || allPackages.length === 0) {
|
|
176988
|
+
formatError("extract", "No workspace packages found", startTime, version);
|
|
176989
|
+
return;
|
|
176990
|
+
}
|
|
176991
|
+
const skipped = options.private ? [] : allPackages.filter((p) => p.private).map((p) => p.name);
|
|
176992
|
+
const packages = options.private ? allPackages : filterPublic(allPackages);
|
|
176993
|
+
if (packages.length === 0) {
|
|
176956
176994
|
formatError("extract", "No workspace packages found", startTime, version);
|
|
176957
176995
|
return;
|
|
176958
176996
|
}
|
|
@@ -176961,7 +176999,7 @@ function registerExtractCommand(program) {
|
|
|
176961
176999
|
const { spec: spec2 } = await cachedExtract(pkg.entry);
|
|
176962
177000
|
specs.push({ name: pkg.name, spec: spec2 });
|
|
176963
177001
|
}
|
|
176964
|
-
formatOutput("extract", { packages: specs }, startTime, version);
|
|
177002
|
+
formatOutput("extract", { packages: specs, ...skipped.length > 0 ? { skipped } : {} }, startTime, version);
|
|
176965
177003
|
return;
|
|
176966
177004
|
}
|
|
176967
177005
|
const entryFile = entry ? path26.resolve(process.cwd(), entry) : detectEntry();
|
|
@@ -177468,13 +177506,19 @@ function getVersion12() {
|
|
|
177468
177506
|
}
|
|
177469
177507
|
}
|
|
177470
177508
|
function registerLintCommand(program) {
|
|
177471
|
-
program.command("lint [entry]").description("Cross-reference JSDoc against code for accuracy issues").option("--all", "Run across all workspace packages").action(async (entry, options) => {
|
|
177509
|
+
program.command("lint [entry]").description("Cross-reference JSDoc against code for accuracy issues").option("--all", "Run across all workspace packages").option("--private", "Include private packages in --all mode").action(async (entry, options) => {
|
|
177472
177510
|
const startTime = Date.now();
|
|
177473
177511
|
const version = getVersion12();
|
|
177474
177512
|
try {
|
|
177475
177513
|
if (options.all) {
|
|
177476
|
-
const
|
|
177477
|
-
if (!
|
|
177514
|
+
const allPackages = discoverPackages(process.cwd());
|
|
177515
|
+
if (!allPackages || allPackages.length === 0) {
|
|
177516
|
+
formatError("lint", "No workspace packages found", startTime, version);
|
|
177517
|
+
return;
|
|
177518
|
+
}
|
|
177519
|
+
const skipped = options.private ? [] : allPackages.filter((p) => p.private).map((p) => p.name);
|
|
177520
|
+
const packages = options.private ? allPackages : filterPublic(allPackages);
|
|
177521
|
+
if (packages.length === 0) {
|
|
177478
177522
|
formatError("lint", "No workspace packages found", startTime, version);
|
|
177479
177523
|
return;
|
|
177480
177524
|
}
|
|
@@ -177489,7 +177533,7 @@ function registerLintCommand(program) {
|
|
|
177489
177533
|
rows.push({ name: pkg.name, exports: (spec2.exports ?? []).length, issues: issues2 });
|
|
177490
177534
|
totalIssues += issues2;
|
|
177491
177535
|
}
|
|
177492
|
-
const data2 = { packages: rows, aggregate: { count: totalIssues } };
|
|
177536
|
+
const data2 = { packages: rows, aggregate: { count: totalIssues }, ...skipped.length > 0 ? { skipped } : {} };
|
|
177493
177537
|
formatOutput("lint", data2, startTime, version, renderBatchLint);
|
|
177494
177538
|
if (totalIssues > 0)
|
|
177495
177539
|
process.exitCode = 1;
|