Files
Review-procedure/scripts/fix-app-json.js
2026-02-07 16:07:10 +08:00

34 lines
1000 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const fs = require('fs')
const path = require('path')
// 修复 dist/app.json确保 tabBar.list 存在
const appJsonPath = path.join(__dirname, '../dist/app.json')
if (fs.existsSync(appJsonPath)) {
const appJson = JSON.parse(fs.readFileSync(appJsonPath, 'utf8'))
// 如果 tabBar 存在但没有 list添加 list
if (appJson.tabBar && !appJson.tabBar.list) {
appJson.tabBar.list = [
{
pagePath: 'pages/home/index',
text: '首页',
iconPath: 'assets/tabbar/home.png',
selectedIconPath: 'assets/tabbar/home-active.png'
},
{
pagePath: 'pages/check/index',
text: '质检',
iconPath: 'assets/tabbar/check.png',
selectedIconPath: 'assets/tabbar/check-active.png'
}
]
fs.writeFileSync(appJsonPath, JSON.stringify(appJson, null, 2), 'utf8')
console.log('✅ 已修复 dist/app.json 中的 tabBar.list')
}
} else {
console.log('⚠️ dist/app.json 不存在,跳过修复')
}