generated from kgod/ai-review-template
自内部仓库剥离深度优化与 RAG 知识库后的交付版本: - Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强) - 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护 - 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏 - PostgreSQL 运行时 + Alembic 迁移链 Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
const fs = require('node:fs')
|
|
const path = require('node:path')
|
|
const ts = require('typescript')
|
|
|
|
const sourceRoot = path.resolve(__dirname, '..', 'src')
|
|
let checked = 0
|
|
let errors = 0
|
|
|
|
function visit(directory) {
|
|
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
const filename = path.join(directory, entry.name)
|
|
if (entry.isDirectory()) {
|
|
visit(filename)
|
|
continue
|
|
}
|
|
if ((!filename.endsWith('.ts') && !filename.endsWith('.vue')) || filename.endsWith('.d.ts')) {
|
|
continue
|
|
}
|
|
|
|
let source = fs.readFileSync(filename, 'utf8')
|
|
if (filename.endsWith('.vue')) {
|
|
const match = source.match(/<script setup lang="ts">([\s\S]*?)<\/script>/)
|
|
if (!match) continue
|
|
source = match[1]
|
|
}
|
|
const result = ts.transpileModule(source, {
|
|
compilerOptions: {
|
|
module: ts.ModuleKind.ESNext,
|
|
target: ts.ScriptTarget.ES2022,
|
|
},
|
|
fileName: filename,
|
|
reportDiagnostics: true,
|
|
})
|
|
const diagnostics = (result.diagnostics || []).filter(
|
|
(item) => item.category === ts.DiagnosticCategory.Error,
|
|
)
|
|
checked += 1
|
|
if (!diagnostics.length) continue
|
|
errors += diagnostics.length
|
|
process.stderr.write(`${filename}\n`)
|
|
for (const diagnostic of diagnostics) {
|
|
process.stderr.write(` ${ts.flattenDiagnosticMessageText(diagnostic.messageText, ' ')}\n`)
|
|
}
|
|
}
|
|
}
|
|
|
|
visit(sourceRoot)
|
|
process.stdout.write(`checked=${checked} syntax_errors=${errors}\n`)
|
|
process.exitCode = errors ? 1 : 0
|