5 Commits

Author SHA1 Message Date
湛兮 4de5f42dc8 chore: move Jenkins pipeline config out of repo 2026-06-05 15:08:12 +08:00
湛兮 94dbaeddc3 ci: harden production tag selection 2026-06-05 14:45:44 +08:00
湛兮 218eada88d ci: add production tag pipeline 2026-06-05 14:38:27 +08:00
湛兮 cd0609418d chore: approve admin pnpm build scripts 2026-06-05 12:40:59 +08:00
湛兮 644c729ff0 chore: split dev and production deployment env 2026-06-05 12:32:23 +08:00
7 changed files with 73 additions and 2 deletions
+2
View File
@@ -1,4 +1,6 @@
# 线上环境平台打包路径
VITE_APP_ENV_LABEL = "生产环境"
VITE_PUBLIC_PATH = /
# 线上环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数"
+16
View File
@@ -0,0 +1,16 @@
# 测试环境构建配置
VITE_APP_ENV_LABEL = "测试环境"
VITE_PUBLIC_PATH = /
# 测试环境路由历史模式
VITE_ROUTER_HISTORY = "hash"
# 测试环境不使用 CDN,避免外部依赖影响验收
VITE_CDN = false
# 测试环境默认不生成压缩产物
VITE_COMPRESSION = "none"
# 本地调试 test mode 时的后端代理目标;线上测试环境由 Nginx 将 /api 代理到测试后端。
VITE_API_PROXY_TARGET = "http://localhost:3501"
+7
View File
@@ -86,6 +86,8 @@ http://localhost:8848/
| `pnpm dev` | 启动 Vite 开发服务,默认端口来自 `.env.development``VITE_PORT=8848` | 本地开发 |
| `pnpm serve` | `pnpm dev` 的别名 | 兼容习惯命令 |
| `pnpm build` | 清理 `dist` 后执行生产构建,内存上限设为 8192MB | 发布前打包 |
| `pnpm build:test` | 使用 `test` mode 构建测试环境静态产物 | 测试环境构建 |
| `pnpm build:prod` | `pnpm build` 的生产构建别名 | 生产环境构建 |
| `pnpm build:staging` | 使用 `staging` mode 构建 | 预发布环境验证 |
| `pnpm report` | 构建并打开 Rollup 可视化分析报告 | 分析包体积 |
| `pnpm preview` | 预览已有 `dist` 构建产物 | 构建后本地验收 |
@@ -177,10 +179,15 @@ http://localhost:8848/
- `.env`: 全局默认配置,目前包含端口和是否隐藏首页。
- `.env.development`: 开发环境端口、路由模式、API 代理目标。
- `.env.test`: 测试环境构建配置;线上测试站点的 `/api` 应由 Nginx 代理到测试后端。
- `.env.staging`: 预发布构建配置,可开启 CDN。
- `.env.production`: 生产构建配置。
- `public/platform-config.json`: pure-admin 运行时平台配置,例如标题、布局、主题、标签页和菜单搜索历史。
## 环境构建约定
仓库只维护项目自身的构建脚本和环境变量文件,不维护流水线文件。测试、生产的触发规则和部署路径由外部 CI/CD 平台配置;测试、生产站点的 `/api` 必须分别代理到对应的 `access-manage`,避免环境串线。
## 协作与文档同步
- 文件结构、入口文件、业务模块、脚本或关键配置发生变化时,必须同步更新本 README 的「目录说明」「重要脚本」或对应说明段落。
+2
View File
@@ -7,6 +7,8 @@
"dev": "NODE_OPTIONS=--max-old-space-size=4096 vite",
"serve": "pnpm dev",
"build": "rimraf dist && NODE_OPTIONS=--max-old-space-size=8192 vite build",
"build:test": "rimraf dist && vite build --mode test",
"build:prod": "pnpm build",
"build:staging": "rimraf dist && vite build --mode staging",
"report": "rimraf dist && vite build",
"preview": "vite preview",
+24
View File
@@ -0,0 +1,24 @@
allowedDeprecatedVersions:
are-we-there-yet: "*"
sourcemap-codec: "*"
lodash.isequal: "*"
domexception: "*"
w3c-hr-time: "*"
inflight: "*"
npmlog: "*"
rimraf: "*"
stable: "*"
gauge: "*"
abab: "*"
glob: "*"
onlyBuiltDependencies:
- "@parcel/watcher"
- core-js
- es5-ext
- esbuild
- typeit
- vue-demi
ignoredBuiltDependencies:
- "@tailwindcss/oxide"
@@ -9,6 +9,8 @@ import LaySidebarTopCollapse from "../lay-sidebar/components/SidebarTopCollapse.
import LogoutCircleRLine from "~icons/ri/logout-circle-r-line";
import Setting from "~icons/ri/settings-3-line";
const appEnvLabel = import.meta.env.VITE_APP_ENV_LABEL || "生产环境";
const {
layout,
device,
@@ -39,6 +41,9 @@ const {
<LayNavMix v-if="layout === 'mix'" />
<div v-if="layout === 'vertical'" class="vertical-header-right">
<span class="environment-badge" :title="`当前环境:${appEnvLabel}`">
{{ appEnvLabel }}
</span>
<!-- 菜单搜索 -->
<LaySearch id="header-search" />
<!-- 全屏 -->
@@ -93,6 +98,20 @@ const {
height: 48px;
color: #000000d9;
.environment-badge {
padding: 5px 9px;
margin-right: 8px;
font-size: 12px;
font-weight: 700;
line-height: 1;
color: #ffffff;
letter-spacing: 0;
white-space: nowrap;
background: rgb(24 24 27 / 86%);
border-radius: 999px;
box-shadow: 0 8px 20px rgb(0 0 0 / 14%);
}
.el-dropdown-link {
display: flex;
align-items: center;
+1
View File
@@ -70,6 +70,7 @@ declare global {
VITE_CDN: boolean;
VITE_HIDE_HOME: string;
VITE_COMPRESSION: ViteCompression;
VITE_APP_ENV_LABEL?: string;
VITE_API_PROXY_TARGET?: string;
}