From 47a4e2b510756b804cad4eb7838a6a98b2dd714a Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Tue, 12 Sep 2023 10:02:02 -0400 Subject: [PATCH 1/2] chore(docs): round up to the nearest integear for smaller docs changes --- scripts/doc-report/docReport.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/doc-report/docReport.ts b/scripts/doc-report/docReport.ts index 08b558e6893..3b56383d3e4 100644 --- a/scripts/doc-report/docReport.ts +++ b/scripts/doc-report/docReport.ts @@ -82,7 +82,7 @@ combineLatest([ package: br.package, documentedChange: Number.isNaN(documentedPercentDiff) ? 0 - : Math.floor(documentedPercentDiff * 100), + : Math.ceil(documentedPercentDiff * 100), prodDocumented: prod.documented, prodNotDocumented: prod.notDocumented, branchDocumented: br.documented, From c62f8dedff9f65bb032d7d480341fba76edbe731 Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Tue, 12 Sep 2023 10:27:00 -0400 Subject: [PATCH 2/2] chore(docs): fix formatting for docs report --- scripts/doc-report/docReport.ts | 62 +++++++++++++++++---------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/scripts/doc-report/docReport.ts b/scripts/doc-report/docReport.ts index 3b56383d3e4..427963b5e0d 100644 --- a/scripts/doc-report/docReport.ts +++ b/scripts/doc-report/docReport.ts @@ -2,6 +2,7 @@ import fs from 'fs/promises' import path from 'path' import {groupBy} from 'lodash' import {combineLatest, map} from 'rxjs' +import prettier from 'prettier' import {startTimer} from '../utils/startTimer' import {createDocClient} from './docClient' import {readEnv} from './envVars' @@ -100,9 +101,9 @@ combineLatest([ report = 'No changes to documentation' } else { // convert the result to a markdown table with heading - report = ` - | Package | Documentation Change | - | ------- | ----------------- | + report = await prettier.format( + `| Package | Documentation Change | +| ------- | ----------------- | ${res .sort((a, b) => b.documentedChange - a.documentedChange) .filter((r) => r.documentedChange !== 0) @@ -114,34 +115,35 @@ combineLatest([ ) .join('\n')} -
- Full Report - ${res - .sort((a, b) => b.documentedChange - a.documentedChange) - .map( - (r) => - `
- ${r.package} - - - - - - - - - - - - - -
This branchNext branch
${r.branchDocumented} documented${r.prodDocumented} documented
${r.branchNotDocumented} not documented${r.prodNotDocumented} not documented
-
+
+ Full Report + ${res + .sort((a, b) => b.documentedChange - a.documentedChange) + .map( + (r) => + `
+ ${r.package} + + + + + + + + + + + + + +
This branchNext branch
${r.branchDocumented} documented${r.prodDocumented} documented
${r.branchNotDocumented} not documented${r.prodNotDocumented} not documented
+
`, + ) + .join('\n')} +
`, - ) - .join('\n')} -
- ` + {parser: 'markdown'}, + ) } // save it to a file