Merge pull request #23334 from IlyaSavich/fix-knip-fail

Send failed process status if knip fails
This commit is contained in:
Fredrik Adelöw
2024-03-01 11:05:17 +01:00
committed by GitHub
3 changed files with 16 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/repo-tools': minor
---
Fix knip-report command to send 1 exit status in case of fail
@@ -178,5 +178,7 @@ export async function runKnipReports({
const fullDir = cliPaths.resolveTargetRoot(packageDir);
cleanKnipConfig({ packageDir: fullDir });
});
throw e;
}
}
@@ -46,9 +46,14 @@ export const buildKnipReports = async (paths: string[] = [], opts: Options) => {
if (selectedPackageDirs.length > 0) {
console.log('# Generating package knip reports');
await runKnipReports({
packageDirs: selectedPackageDirs,
isLocalBuild: !isCiBuild,
});
try {
await runKnipReports({
packageDirs: selectedPackageDirs,
isLocalBuild: !isCiBuild,
});
} catch (e) {
process.exit(1);
}
}
};