Files
pengcheng-exam-stu/verify-process-name.js

81 lines
2.6 KiB
JavaScript

#!/usr/bin/env node
/**
* 验证进程名称配置
* 检查生成的可执行文件名称是否符合要求
*/
const fs = require('fs')
const path = require('path')
console.log('🔍 验证进程名称配置...')
// 检查Cargo.toml配置
const cargoTomlPath = path.join(__dirname, 'src-tauri', 'Cargo.toml')
if (fs.existsSync(cargoTomlPath)) {
const cargoContent = fs.readFileSync(cargoTomlPath, 'utf8')
console.log('📋 Cargo.toml配置:')
// 检查包名
const nameMatch = cargoContent.match(/^name\s*=\s*"([^"]+)"/m)
if (nameMatch) {
console.log(` 包名: ${nameMatch[1]}`)
}
// 检查二进制文件配置
if (cargoContent.includes('[[bin]]')) {
console.log(' ✅ 二进制文件配置已设置')
const binNameMatch = cargoContent.match(/\[\[bin\]\]\s*\n\s*name\s*=\s*"([^"]+)"/m)
if (binNameMatch) {
console.log(` 二进制文件名: ${binNameMatch[1]}`)
}
} else {
console.log(' ❌ 未找到二进制文件配置')
}
}
// 检查tauri.conf.json配置
const tauriConfigPath = path.join(__dirname, 'src-tauri', 'tauri.conf.json')
if (fs.existsSync(tauriConfigPath)) {
const tauriConfig = JSON.parse(fs.readFileSync(tauriConfigPath, 'utf8'))
console.log('📋 Tauri配置:')
console.log(` 产品名称: ${tauriConfig.productName}`)
console.log(` 窗口标题: ${tauriConfig.app.windows[0].title}`)
}
// 检查生成的可执行文件
const targetPath = path.join(__dirname, 'src-tauri', 'target')
if (fs.existsSync(targetPath)) {
console.log('📋 生成的文件:')
// 检查debug目录
const debugPath = path.join(targetPath, 'debug')
if (fs.existsSync(debugPath)) {
const debugFiles = fs.readdirSync(debugPath).filter((f) => f.endsWith('.exe'))
if (debugFiles.length > 0) {
console.log(' Debug版本:')
debugFiles.forEach((file) => {
console.log(` - ${file}`)
})
}
}
// 检查release目录
const releasePath = path.join(targetPath, 'release')
if (fs.existsSync(releasePath)) {
const releaseFiles = fs.readdirSync(releasePath).filter((f) => f.endsWith('.exe'))
if (releaseFiles.length > 0) {
console.log(' Release版本:')
releaseFiles.forEach((file) => {
console.log(` - ${file}`)
})
}
}
}
console.log('\n💡 说明:')
console.log('- 任务管理器显示: 可执行文件名 (如: ExamStudent.exe)')
console.log('- 安装包显示: 产品名称 (如: 信息技术课程考试平台)')
console.log('- 窗口标题显示: 窗口标题 (如: 信息技术课程考试平台)')
console.log('\n✅ 配置验证完成!')