前端工程的相关管理 git、branch、build

发布于:2025-05-20 ⋅ 阅读:(14) ⋅ 点赞:(0)

环境配置

标准环境打包
测试版:npm run build-test
预生产:npm run build-preview
正式版:npm run build

建议本地建里一个
.env.development.local 方便和后端联调时修改配置相关信息。
和 src 同级有一下区分环境的文件:
.env.development
.env.test(测试环境)
.env.uat(预生产环境)
.env.preview(正式环境)

打包时命令行根据环境不同,见文件: src/hostMap.js

import { decrypt } from '../../utils'
const testOnline = 'xYMEaU*******JgvB6SzaPQLeasSIyz4vM4lcP11I='
const preOnline = 'Xn2wyp*******7BruSomIWNhWQrPnlybrl4ZbT/qng='
const prodOnline = 'vMHPK*******JwyJcnCHSfZFq9VRWOzYwh9BkZB0vnE='

const xc = { // 信创版
  'test-xc': {
    'subApp1': `${decrypt(preOnline)}/online/` // *******测试环境
  },
  'preview-xc': {
    'subApp1': `${decrypt(preOnline)}/online/` // wujie-app1 *******预生产环境
  }
}
const normal = { // 标准版  wujie-app1
  test: {
    'subApp1': `${decrypt(testOnline)}/online/` // wujie-app1
  },
  preview: {
    'subApp1': 'https://*******org/online/' // 预生产
  },
  production: {
    'subApp1': 'https://*******org:99/online/' // 生产
  }
}
export default function hostMap(app) {
  const VUE_APP_ENV = process.env.VUE_APP_ENV // env
  console.log('-------------VUE_APP_SUB_1----------------', VUE_APP_ENV, process.env.VUE_APP_SUB_1)
  if (VUE_APP_ENV.includes('xc')) return xc[VUE_APP_ENV][app]
  if (VUE_APP_ENV === 'development') return process.env.VUE_APP_SUB_1
  return normal[VUE_APP_ENV][app]
}

GIT管理

【禁止test、pre、master互相合并!!!】
【禁止test、pre、合并到业务分支!!!】
开发阶段: 基于master新建自己的本地分支(一般情况),其他情况咨询主要开发者
转测阶段: 本地分支merge至分支:test
提测预生产: 本地分支merge至分支:pre
正式版: 本地分支merge至分支: master

branch 分类标准

主要格式:type(scope)-name

示例: feat(组建)-优化

commit 分类标准

主要格式:type(scope):message

示例: feat(组建):新增功能项

TYPE集合
feat:新功能(feature)
fix:修补
docs:文档(documentation)
style: 格式(不影响代码运行的变动)
refactor:重构(即不是新增功能,也不是修改bug的代码变动)
perf:性能优化
test:增加测试
revert:撤销上一次
chore:构建过程或辅助工具的变动
log: 加日志、注释、调试打印

网站公告

今日签到

点亮在社区的每一天
去签到