Add route lint harness
TaxBaik CI/CD / build-and-deploy (push) Successful in 3m5s

This commit is contained in:
2026-07-08 01:25:21 +09:00
parent 1f8ca7c8bb
commit f2f4769460
2 changed files with 61 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
import fs from 'node:fs';
import path from 'node:path';
const root = process.cwd();
const files = [
'src/TaxBaik.Web/Program.cs',
'src/TaxBaik.Web.Client/Components/Admin/App.razor',
'src/TaxBaik.Web.Client/Components/Admin/Routes.razor',
'src/TaxBaik.Web.Client/Components/Admin/RedirectToLogin.razor',
'tests/e2e/public-smoke.spec.ts',
'tests/e2e/admin-smoke.spec.ts',
'tests/e2e/route-isolation.spec.ts'
];
const required = [
{
file: 'src/TaxBaik.Web/Program.cs',
pattern: 'MapGroup("/taxbaik/admin")',
message: '관리자 Razor Components는 /taxbaik/admin 그룹에만 매핑되어야 합니다.'
},
{
file: 'tests/e2e/route-isolation.spec.ts',
pattern: 'public home does not boot the admin app',
message: '공용/관리자 분리 하네스가 필요합니다.'
},
{
file: 'tests/e2e/route-isolation.spec.ts',
pattern: 'admin login boots the admin app under the admin base path',
message: '관리자 base path 하네스가 필요합니다.'
}
];
let failed = false;
for (const entry of required) {
const fullPath = path.join(root, entry.file);
const text = fs.readFileSync(fullPath, 'utf8');
if (!text.includes(entry.pattern)) {
console.error(`[route-lint] FAIL ${entry.file}: missing "${entry.pattern}"`);
console.error(` ${entry.message}`);
failed = true;
}
}
const adminFiles = files
.filter(file => file.includes('/Admin/') || file.includes('admin-smoke') || file.includes('route-isolation'));
for (const file of adminFiles) {
const fullPath = path.join(root, file);
const text = fs.readFileSync(fullPath, 'utf8');
if (file === 'src/TaxBaik.Web/Program.cs') continue;
if (text.includes('ToBaseRelativePath(Navigation.Uri)')) {
console.error(`[route-lint] FAIL ${file}: unsafe ToBaseRelativePath(Navigation.Uri) usage detected.`);
failed = true;
}
}
if (failed) process.exit(1);
console.log('[route-lint] OK');