2ed5dfa6a1
iotlcm-app:小程序端 + 用户端服务。 - app/:uni-app 小程序前端(基于 unibest,MIT) - 微信 AppID → YOUR_WX_APPID,uni-app AppID → __UNI__YOURAPPID - 内网后端地址 → admin.iotlcm.example.com - 应用标题与 unibest 模板 README 重写(保留上游致谢与 MIT 声明) - server/:GoFrame 用户端服务(基于 XiuAdmin,Apache-2.0) - module xiuadmin → git.5iot.com/iotlcm-public/iotlcm-app(360 文件) - 支付回调地址 → app.iotlcm.example.com,商户名与应用名泛化 - 真实手机号 → 合法 11 位编造号(保留号段前 3 位 + 后 4 位) - 依赖号码尾部的断言同步更新 - 补 server/LICENSE(Apache-2.0) - 移除内部资产:CI 触发器 - 补根 README,LF 行尾 + .gitattributes 已知:TestSysDept_RefreshDeptAncestors 在源仓同一提交上同样失败,属既有缺陷。
69 lines
2.0 KiB
TypeScript
69 lines
2.0 KiB
TypeScript
import type { Plugin } from 'vite'
|
|
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
import process from 'node:process'
|
|
|
|
interface ManifestType {
|
|
'plus'?: {
|
|
distribute?: {
|
|
plugins?: Record<string, any>
|
|
}
|
|
}
|
|
'app-plus'?: {
|
|
distribute?: {
|
|
plugins?: Record<string, any>
|
|
}
|
|
}
|
|
}
|
|
|
|
export default function syncManifestPlugin(): Plugin {
|
|
return {
|
|
name: 'sync-manifest',
|
|
apply: 'build',
|
|
enforce: 'post',
|
|
writeBundle: {
|
|
order: 'post',
|
|
handler() {
|
|
const srcManifestPath = path.resolve(process.cwd(), './src/manifest.json')
|
|
const distAppPath = path.resolve(process.cwd(), './dist/dev/app/manifest.json')
|
|
|
|
try {
|
|
// 读取源文件
|
|
const srcManifest = JSON.parse(fs.readFileSync(srcManifestPath, 'utf8')) as ManifestType
|
|
|
|
// 确保目标目录存在
|
|
const distAppDir = path.dirname(distAppPath)
|
|
if (!fs.existsSync(distAppDir)) {
|
|
fs.mkdirSync(distAppDir, { recursive: true })
|
|
}
|
|
|
|
// 读取目标文件(如果存在)
|
|
let distManifest: ManifestType = {}
|
|
if (fs.existsSync(distAppPath)) {
|
|
distManifest = JSON.parse(fs.readFileSync(distAppPath, 'utf8'))
|
|
}
|
|
|
|
// 如果源文件存在 plugins
|
|
if (srcManifest['app-plus']?.distribute?.plugins) {
|
|
// 确保目标文件中有必要的对象结构
|
|
if (!distManifest.plus)
|
|
distManifest.plus = {}
|
|
if (!distManifest.plus.distribute)
|
|
distManifest.plus.distribute = {}
|
|
|
|
// 复制 plugins 内容
|
|
distManifest.plus.distribute.plugins = srcManifest['app-plus'].distribute.plugins
|
|
|
|
// 写入更新后的内容
|
|
fs.writeFileSync(distAppPath, JSON.stringify(distManifest, null, 2))
|
|
console.log('✅ Manifest plugins 同步成功')
|
|
}
|
|
}
|
|
catch (error) {
|
|
console.error('❌ 同步 manifest plugins 失败:', error)
|
|
}
|
|
},
|
|
},
|
|
}
|
|
}
|