Send failed process status if knip fails

Signed-off-by: Ilya Savich <isavich@box.com>
This commit is contained in:
Ilya Savich
2024-02-29 15:10:32 +01:00
parent ce0adea1d6
commit 8bfcc502f5
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);
}
}
};