Merge pull request #16992 from backstage/jhaals/report-improvement

repo-tools: Improve error message when API report is missing
This commit is contained in:
Johan Haals
2023-03-21 14:03:16 +01:00
committed by GitHub
2 changed files with 13 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/repo-tools': patch
---
Log API report instructions when api-report is missing.
@@ -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,