add specific check for @deprecated tag in router files
Signed-off-by: patroswastik <swastik12345@hotmail.com>
This commit is contained in:
+20
-1
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user