You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
const routeMappingPlugin = require('../plugins/route-mapping-plugin.js')
|
|
|
|
const { existsSync } = require('fs')
|
|
|
|
const { resolve } = require('path')
|
|
|
|
|
|
|
|
// 检查命令行参数
|
|
|
|
const isCheckOnly = process.argv.includes('--check-only')
|
|
|
|
const isSilent = process.argv.includes('--silent')
|
|
|
|
|
|
|
|
// 设置静默模式环境变量
|
|
|
|
if (isSilent) {
|
|
|
|
process.env.ROUTE_MAPPING_SILENT = 'true'
|
|
|
|
}
|
|
|
|
|
|
|
|
// 独立运行路由映射生成
|
|
|
|
if (isCheckOnly) {
|
|
|
|
const outputPath = resolve(__dirname, '../src/renderer/modules/route-sync/direct-route-mappings.js')
|
|
|
|
|
|
|
|
if (existsSync(outputPath)) {
|
|
|
|
process.exit(0)
|
|
|
|
} else {
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
const plugin = routeMappingPlugin()
|
|
|
|
plugin.collectDirectMappings()
|
|
|
|
} catch (error) {
|
|
|
|
console.error('路由映射文件生成失败:', error)
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
|