ci: 优化 GitHub Actions 工作流并添加单元测试
This commit is contained in:
2
.env
2
.env
@@ -1,2 +1,4 @@
|
|||||||
|
VITE_BASE=/
|
||||||
|
VITE_BUILD_SOURCE_MAP=true
|
||||||
VITE_BUILD_COMMIT=
|
VITE_BUILD_COMMIT=
|
||||||
VITE_BUILD_TIME=
|
VITE_BUILD_TIME=
|
||||||
|
3
.github/workflows/ci-cd.yaml
vendored
3
.github/workflows/ci-cd.yaml
vendored
@@ -28,6 +28,9 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
VITE_BUILD_COMMIT: ${{ github.sha }}
|
VITE_BUILD_COMMIT: ${{ github.sha }}
|
||||||
|
|
||||||
|
- name: 🧪 单元测试
|
||||||
|
run: pnpm run test:unit
|
||||||
|
|
||||||
- name: 📊 计算构建大小
|
- name: 📊 计算构建大小
|
||||||
run: |
|
run: |
|
||||||
echo "📊 构建大小统计:"
|
echo "📊 构建大小统计:"
|
||||||
|
@@ -1,18 +1,19 @@
|
|||||||
import { fileURLToPath, URL } from 'node:url'
|
import { fileURLToPath, URL } from 'node:url'
|
||||||
import { createViteProxy } from 'utils4u/vite'
|
import { createViteProxy } from 'utils4u/vite'
|
||||||
import { defineConfig, type DepOptimizationOptions } from 'vite'
|
import { defineConfig, loadEnv, type DepOptimizationOptions } from 'vite'
|
||||||
|
|
||||||
import { Plugins } from './vite.config.plugins'
|
import { Plugins } from './vite.config.plugins'
|
||||||
// import { createRolldownSplitChunks } from './vite.config.rolldown.split-chunks'
|
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig(({ command /* mode */ }) => {
|
export default defineConfig(({ command, mode }) => {
|
||||||
const isBuild = command === 'build'
|
const isBuild = command === 'build'
|
||||||
// const env = loadEnv(mode, process.cwd())
|
const env = loadEnv(mode, process.cwd())
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// build: createRolldownSplitChunks(),
|
base: env.VITE_BASE,
|
||||||
// base: env.VITE_BASE,
|
build: {
|
||||||
|
sourcemap: env.VITE_BUILD_SOURCE_MAP === 'true',
|
||||||
|
},
|
||||||
plugins: Plugins(),
|
plugins: Plugins(),
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
Reference in New Issue
Block a user