alo7: 前端 web-assets 单桶/多环境项目搭建

单桶项目,单环境一般是指一些区分beta/production 环境的项目

01 初始化bcl项目 vite-react-ts

利用模板,初始化项目,并替换好基本的信息

bcl -> vite/vite-react-ts

02 初始化环境变量

初始化 web-assets + yarn registry

glab4f ~/.aliyun/.env.web-alo7-com
glab4f ~/.aliyun/.env.yarn-alo7

03 添加 gitlab-ci

建议文件 .gitlab-ci.yml

touch .gitlab-ci.yml

内容如下

include:
  - project: aric.zheng/frontend-ci
    ref: 1.0.152
    file: dist/templates/react-aliyun-oss/main-single.yml

variables:
#  MODE: multiple
  NODE_VERSION: 20
  IMAGE_REGISTRY: hub.dproxy.saybot.net/
  LIBRARY_IMAGE_REGISTRY: ${IMAGE_REGISTRY}library/
  BUCKET_CONTEXT: web-alo7-com/app/captcha-shield
  FRONTEND_PATH_BUILD: dist
  REFRESH_URL_production: https://web-assets.alo7.com/app/production/captcha-shield/index.html

替换项目内容

app/captcha-shield

04 添加 gtc 基本配置

创建配置文件

{
  "autoVersion": false,
  "strictCommit": false,
  "commands": [
    { "label": "🍏 发布到 beta 环境", "value": "beta" },
    { "label": "🍎 发布到 production 环境", "value": "production" },
    { "label": "🍞 仅更新 cache 的 node_modules", "value": "cache" }
  ]
}
alo7