背景:
mp-harmony 项目的 5 个 ascf shared HAR 子包 (components_diy / pages_goods /
pages_order / pages_promotion / pages_tool) 在 ascf_build 目录下, 关键
元数据 (oh-package.json5 / module.json5 / build-profile.json5 /
Index.ets / hvigorfile.ts / obfuscation-rules.txt) 之前被 .gitignore
整体忽略, 从未被 git 跟踪, 导致 "module.name 被清空" 等回归无法被
git diff / blame 追踪。
改动:
1. .gitignore 改造
- 不再整体 ignore ascf_build
- 精确 ignore 已知产物路径 (rawfile/**/*.pack.js / rawfile/**/*.html
/ rawfile/**/*.json / build/ / oh_modules/ / .preview/ / .cxx/
/ .test/ / node_modules/)
- ! 取反保留 HAR 必需文件 (placeholder/index.*, rawfile/index.js,
base/element/*.json)
- 补充 entry / hvigor / 鸿蒙签名材料 / IDE 临时文件 ignore 规则
2. 首次将 5 个 HAR 包的元数据纳入 git (40 个文件)
3. 新增 scripts/fix-subpackage-module-names.js: 任何入口 require
vue.config.js 时自动修复 oh-package.json5.name + module.json5.module.name
双重覆盖, 防止 DevEco ohpm 报 "00604007 Field IS Empty Error" 或
hvigor 报 "Schema validate failed"
4. vue.config.js 顶层 IIFE 触发修复 (任何 require 立即生效, 不依赖
webpack 钩子)
5. entry/scripts/check-har-deps.js 扩展: 校验 ascf_build 子包
module.json5.module.name 字段 (兜底校验)
6. entry/har-deps-required.json5 扩展: 新增 subpackageModuleJson5
路径映射 + ohModulesRoots 校验资源齐备性
7. entry/README-HAR-DEPS.md 更新: 故障速查表新增 module.name 相关
报错条目
预期效果:
- HBuilderX 触发 vue-cli-service build → vue.config.js 自动修复子包
name → DevEco ohpm install / hvigor schema 校验通过
- check-har-deps.js 兜底, 任何回归立即被检测并报错
- 团队成员 git pull 后能立即看到 ascf_build 元数据, 可用 git diff
跟踪 module.name 等关键字段变更
79 lines
3.7 KiB
Plaintext
79 lines
3.7 KiB
Plaintext
/unpackage
|
|
/.idea
|
|
/.logs
|
|
/node_modules
|
|
/iconfont-preview.html
|
|
|
|
.codebuddy
|
|
.vscode
|
|
.trae
|
|
# 本地调试配置 (含 uniacid / 域名, 每人不同, 不应入仓)
|
|
# 注意: 如果 .local.config.js 已经被之前的 commit 入仓,
|
|
# 需要手动 `git rm --cached .local.config.js` 并用 filter-branch
|
|
# 清理历史 (仅限团队协商后操作)
|
|
.local.config.js
|
|
|
|
# 鸿蒙元服务构建产物 (被 .gitignore 的只是产物, HAR 元数据需要 git 管理)
|
|
# 重要: ascf_build 根目录的元数据 (oh-package.json5 / Index.ets / build-profile.json5 / ...)
|
|
# 必须被 git 管理, 否则无法追踪 "module.name 被清空" 等回归。
|
|
# 这些元数据通过下方的 ! 取反规则显式纳入 git。
|
|
stub-app-projects/mp-harmony/ascf/ascf_src
|
|
stub-app-projects/mp-harmony/entry/src/main/resources/rawfile
|
|
|
|
# ascf_build/<pkg>/ 是 HAR 包定义 (有源文件 + uniapp 编译产物)
|
|
# 策略: 不整体 ignore, 只精确 ignore 已知的产物路径
|
|
# - rawfile/<root>/diy-*.pack.js / *.html: uniapp 编译产物, vue.config.js 拷过来
|
|
# - rawfile/index.js: 也是产物 (HAR 入口脚本, 每次构建覆盖)
|
|
# - build/: hvigor 中间产物
|
|
# - oh_modules/: ohpm 同步产物
|
|
# - .preview/, .cxx/, .test/: 预览 / native 中间产物
|
|
|
|
# 关键产物 (每次构建覆盖, 不应入仓)
|
|
stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/*.pack.js
|
|
stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/*.html
|
|
stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/*.json
|
|
stub-app-projects/mp-harmony/ascf/ascf_build/**/build
|
|
stub-app-projects/mp-harmony/ascf/ascf_build/**/oh_modules
|
|
stub-app-projects/mp-harmony/ascf/ascf_build/**/.preview
|
|
stub-app-projects/mp-harmony/ascf/ascf_build/**/.cxx
|
|
stub-app-projects/mp-harmony/ascf/ascf_build/**/.test
|
|
stub-app-projects/mp-harmony/ascf/ascf_build/**/node_modules
|
|
|
|
# 但 placeholder/ 下的 index.pack.js / index.html 是 HAR 必需, 保留
|
|
!stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/placeholder/index.pack.js
|
|
!stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/placeholder/index.html
|
|
!stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/placeholder/index.json
|
|
|
|
# 但根 rawfile/ 下的 index.js 是 HAR 入口, 保留
|
|
!stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/index.js
|
|
|
|
# base/element/string.json 是 HAR i18n, 保留
|
|
!stub-app-projects/mp-harmony/ascf/ascf_build/**/rawfile/**/base/element/*.json
|
|
# 但 rawfile/ 是 ignore **/*.json 的子目录, 上面那条也针对 rawfile/base/element 取消 ignore
|
|
# base/ 在 rawfile/ 之外, 单独处理
|
|
!stub-app-projects/mp-harmony/ascf/ascf_build/**/base/element/*.json
|
|
|
|
# entry 下的产物
|
|
stub-app-projects/mp-harmony/entry/build
|
|
stub-app-projects/mp-harmony/entry/oh_modules
|
|
stub-app-projects/mp-harmony/entry/.preview
|
|
stub-app-projects/mp-harmony/entry/.cxx
|
|
stub-app-projects/mp-harmony/entry/.test
|
|
stub-app-projects/mp-harmony/entry/node_modules
|
|
# 鸿蒙工程顶层产物 (.hvigor / hvigor / .idea 已在根 .gitignore 范围或更精准的鸿蒙子 .gitignore)
|
|
stub-app-projects/mp-harmony/oh_modules
|
|
stub-app-projects/mp-harmony/.hvigor
|
|
stub-app-projects/mp-harmony/.idea
|
|
# 鸿蒙 hvigor 自身依赖
|
|
stub-app-projects/mp-harmony/hvigor
|
|
# Trae/IDE 临时文件
|
|
.hvigor/outputs
|
|
.trae_permission_check_*
|
|
# 鸿蒙签名材料 (敏感, 绝不能提交到公共 git)
|
|
# 仓库有 origin (github.com/Zajd/jsysq-uniapp) 是公开仓库, 签名材料必须 gitignore
|
|
stub-app-projects/mp-harmony/**/cert-profile
|
|
stub-app-projects/mp-harmony/**/.p12
|
|
stub-app-projects/mp-harmony/**/.p7b
|
|
stub-app-projects/mp-harmony/**/.cer
|
|
stub-app-projects/mp-harmony/**/.csr
|
|
stub-app-projects/mp-harmony/**/material |