Files
iotlcm/app/scripts/validate-message-page.mjs
T
MiFaZhan 2ed5dfa6a1 chore: 初始开源发布
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 在源仓同一提交上同样失败,属既有缺陷。
2026-10-26 14:01:25 +08:00

46 lines
1.4 KiB
JavaScript

import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import process from 'node:process'
const root = process.cwd()
const dataPath = resolve(root, 'src/pages/message/data.ts')
const indexPath = resolve(root, 'src/pages/message/index.vue')
const source = readFileSync(dataPath, 'utf8')
const indexSource = readFileSync(indexPath, 'utf8')
const forbiddenWords = ['代理', '未来', '敬请期待', 'agent', 'future']
const forbiddenRoutePatterns = [
/url\s*:/,
/path\s*:/,
/route\s*:/,
/navigateTo/,
/switchTab/,
/redirectTo/,
/reLaunch/,
]
for (const word of forbiddenWords) {
if (source.includes(word) || indexSource.includes(word)) {
throw new Error(`消息页默认内容包含禁用词:${word}`)
}
}
for (const pattern of forbiddenRoutePatterns) {
if (source.match(pattern) || indexSource.match(pattern)) {
throw new Error(`消息页一级页面不应包含跳转配置或跳转调用:${pattern}`)
}
}
const groupCount = (source.match(/^\s{4}key:\s*'(system|card)',/gm) || []).length
if (groupCount !== 2) {
throw new Error(`消息页应只保留 2 个用户侧消息分类,当前为 ${groupCount} 个`)
}
for (const required of ['系统消息', '卡片消息', '端午假期服务时间调整通知', '尾号 8821 流量不足']) {
if (!source.includes(required)) {
throw new Error(`消息页缺少来自暂存设计的用户侧内容:${required}`)
}
}
console.log('message page scope checked')