From 74e1fc1e7d76b676bad44086259dd0fdd56c9969 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 20 Oct 2021 18:46:55 +0200 Subject: [PATCH] scripts/api-extractor: show instructions both before and after file contents Signed-off-by: Patrik Oldsberg --- scripts/api-extractor.ts | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/scripts/api-extractor.ts b/scripts/api-extractor.ts index 3d74882b6c..c8f35508fa 100644 --- a/scripts/api-extractor.ts +++ b/scripts/api-extractor.ts @@ -134,6 +134,23 @@ async function findPackageDirs() { return packageDirs; } +function logApiReportInstructions() { + console.log(''); + console.log( + '*************************************************************************************', + ); + console.log( + '* You have uncommitted changes to the public API of a package. *', + ); + console.log( + '* To solve this, run `yarn build:api-reports` and commit all api-report.md changes. *', + ); + console.log( + '*************************************************************************************', + ); + console.log(''); +} + interface ApiExtractionOptions { packageDirs: string[]; outputDir: string; @@ -267,20 +284,7 @@ async function runApiExtraction({ if (!extractorResult.succeeded) { if (shouldLogInstructions) { - console.log(''); - console.log( - '*************************************************************************************', - ); - console.log( - '* You have uncommitted changes to the public API of a package. *', - ); - console.log( - '* To solve this, run `yarn build:api-reports` and commit all api-report.md changes. *', - ); - console.log( - '*************************************************************************************', - ); - console.log(''); + logApiReportInstructions(); if (conflictingFile) { console.log(''); @@ -294,7 +298,8 @@ async function runApiExtraction({ const content = await fs.readFile(conflictingFile, 'utf8'); console.log(content); - console.log(''); + + logApiReportInstructions(); } }