#!/usr/bin/env node import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); // 读取文件 const filePath = path.join(__dirname, 'src/mocks/resumeInterviewMock.js'); const content = fs.readFileSync(filePath, 'utf-8'); // 需要检查的岗位列表 const positionsToCheck = [ '民宿管家', '民宿客房管家', '民宿运营专员', '露营地运营专员', '新媒体运营专员', '文创产品设计师', '文创产品策划师', '文创产品设计师助理', '品牌策划运营专员', '品牌公关', '品牌推广专员', 'ip运营', 'IP运营总监助理', '品牌公关管培生' ]; console.log('检查岗位数据完整性...'); console.log('=' * 50); // 提取industries数据 const industriesMatch = content.match(/const industries = \[([\s\S]*?)\];/); if (!industriesMatch) { console.log('未找到industries数据'); process.exit(1); } // 提取resumeTemplates数据 const templatesMatch = content.match(/const resumeTemplates = \{([\s\S]*?)\n\};/); if (!templatesMatch) { console.log('未找到resumeTemplates数据'); process.exit(1); } // 分析每个岗位 const results = []; for (const position of positionsToCheck) { // 在industries中查找 const industryRegex = new RegExp(`title: "${position}"`, 'g'); const industryMatches = [...content.matchAll(industryRegex)]; // 在resumeTemplates中查找 const templateRegex = new RegExp(`position: "${position}"[\\s\\S]*?studentInfo:`, 'g'); const templateMatches = [...content.matchAll(templateRegex)]; // 检查是否有studentInfo let hasStudentInfo = false; for (const match of templateMatches) { const afterMatch = content.substring(match.index, match.index + 1000); if (afterMatch.includes('studentInfo: {')) { // 检查studentInfo是否包含必要字段 const studentInfoEnd = afterMatch.indexOf('},') + match.index; const studentInfoContent = content.substring(match.index, studentInfoEnd); hasStudentInfo = studentInfoContent.includes('project_experience:') && studentInfoContent.includes('core_skills:') && studentInfoContent.includes('personal_summary:'); } } results.push({ position, inIndustries: industryMatches.length > 0, inTemplates: templateMatches.length > 0, hasStudentInfo }); } // 输出结果 console.log('\n检查结果:\n'); console.log('岗位名称 | 在industries中 | 在templates中 | 有studentInfo'); console.log('-'.repeat(60)); let missingCount = 0; for (const result of results) { const status = result.hasStudentInfo ? '✅' : '❌'; console.log(`${result.position.padEnd(20)} | ${result.inIndustries ? '是' : '否'} | ${result.inTemplates ? '是' : '否'} | ${status}`); if (!result.hasStudentInfo) { missingCount++; } } console.log('\n' + '='.repeat(50)); console.log(`总计:${results.length}个岗位,${missingCount}个缺少studentInfo数据`);