add specific check for @deprecated tag in router files

Signed-off-by: patroswastik <swastik12345@hotmail.com>
This commit is contained in:
patroswastik
2025-02-27 16:19:31 -06:00
parent 40d2fa1e02
commit d1887280d9
@@ -46,10 +46,15 @@ function verifyIndex(pkg: string, packageJson?: BackstagePackageJson) {
console.log(`Verifying ${pkg}`);
const tsPath = path.join(pkg, 'src/index.ts');
const sourceFile = project.getSourceFile(tsPath);
const tsRouterPath = path.join(pkg, 'src/service/router.ts');
const routerFile = project.getSourceFile(tsRouterPath);
if (!sourceFile) {
console.log(`Could not find ${tsPath}`);
process.exit(1);
}
const symbols = sourceFile?.getExportSymbols();
const exportCount = symbols?.length || 0;
@@ -75,9 +80,23 @@ function verifyIndex(pkg: string, packageJson?: BackstagePackageJson) {
.find(tag => tag.getName() === 'deprecated');
}
let routerCreateRouterDeprecated = undefined;
if (routerFile) {
const routerSymbols = routerFile?.getExportSymbols();
const routerCreateRouterExport = routerSymbols?.find(
symbol => symbol.getName() === 'createRouter',
);
if (routerCreateRouterExport) {
routerCreateRouterDeprecated = routerCreateRouterExport
.getJsDocTags()
.find(tag => tag.getName() === 'deprecated');
}
}
if (createRouterExport) {
console.log(' ❌ createRouter is exported');
if (!createRouterDeprecated)
if (!createRouterDeprecated && !routerCreateRouterDeprecated)
console.log(' ❌ createRouter is NOT deprecated');
}