From 9129ca8cabbab7066ec5079c71cf3e6c85d05f3c Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Tue, 21 Mar 2023 13:43:47 +0100 Subject: [PATCH] repo-tools: Improve error message when API report is missing Signed-off-by: Johan Haals --- .changeset/witty-berries-love.md | 5 +++++ .../repo-tools/src/commands/api-reports/api-extractor.ts | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .changeset/witty-berries-love.md diff --git a/.changeset/witty-berries-love.md b/.changeset/witty-berries-love.md new file mode 100644 index 0000000000..00fa230dc8 --- /dev/null +++ b/.changeset/witty-berries-love.md @@ -0,0 +1,5 @@ +--- +'@backstage/repo-tools': patch +--- + +Log API report instructions when api-report is missing. diff --git a/packages/repo-tools/src/commands/api-reports/api-extractor.ts b/packages/repo-tools/src/commands/api-reports/api-extractor.ts index 1fe7602617..8194ede7a4 100644 --- a/packages/repo-tools/src/commands/api-reports/api-extractor.ts +++ b/packages/repo-tools/src/commands/api-reports/api-extractor.ts @@ -487,6 +487,9 @@ export async function runApiExtraction({ showVerboseMessages: false, showDiagnostics: false, messageCallback(message) { + if (message.text.includes('The API report file is missing')) { + shouldLogInstructions = true; + } if ( message.text.includes( 'You have changed the public API signature for this project.', @@ -506,7 +509,11 @@ export async function runApiExtraction({ // This release tag validation makes sure that the release tag of known entry points match expectations. // The root index entrypoint is only allowed @public exports, while /alpha and /beta only allow @alpha and @beta. - if (validateReleaseTags && !usesExperimentalTypeBuild) { + if ( + validateReleaseTags && + !usesExperimentalTypeBuild && + fs.pathExistsSync(extractorConfig.reportFilePath) + ) { if (['index', 'alpha', 'beta'].includes(name)) { const report = await fs.readFile( extractorConfig.reportFilePath,