修改版本号展示方式
This commit is contained in:
parent
bf301af857
commit
c60a907d81
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "lolosia-web",
|
||||
"version": "2.0.2",
|
||||
"version": "0.0.1-alpha",
|
||||
"license": "MIT",
|
||||
"author": "一七年夏",
|
||||
"packageManager": "pnpm@9.0.6",
|
||||
|
|
|
@ -60,10 +60,14 @@ import { ElMessage } from 'element-plus'
|
|||
|
||||
const buildEnv = (() => {
|
||||
const time = import.meta.env.VITE_BUILD_TIMESTAMP
|
||||
if (!time) return null
|
||||
const version = import.meta.env.PROJECT_VERSION
|
||||
if (time) {
|
||||
const build = import.meta.env.VITE_BUILD_DISPLAY_NAME
|
||||
const hash = (import.meta.env.VITE_GIT_COMMIT || '').slice(0, 8)
|
||||
return `构建 ${build} ${hash} ${time}`
|
||||
return `当前版本 ${version}-${hash} 构建 ${build} 于 ${time}`
|
||||
} else {
|
||||
return `版本 ${version}-dev`
|
||||
}
|
||||
})()
|
||||
|
||||
/* listen router change and set the query */
|
||||
|
|
1
typings/env.d.ts
vendored
1
typings/env.d.ts
vendored
|
@ -7,6 +7,7 @@ declare global {
|
|||
readonly VITE_BUILD_TIMESTAMP: string
|
||||
readonly VITE_BUILD_DISPLAY_NAME: string
|
||||
readonly VITE_GIT_COMMIT: string
|
||||
readonly PROJECT_VERSION: string
|
||||
// 更多环境变量...
|
||||
}
|
||||
interface ImportMeta {
|
||||
|
|
|
@ -14,6 +14,7 @@ import ReactivityTransform from '@vue-macros/reactivity-transform/vite'
|
|||
// const prodMock = setting.openProdMock
|
||||
import vitePluginSetupExtend from './src/plugins/vite-plugin-setup-extend'
|
||||
import vitePluginVueSetupExtend from 'vite-plugin-vue-setup-extend'
|
||||
import packageJson from './package.json'
|
||||
// import { visualizer } from 'rollup-plugin-visualizer'
|
||||
const pathSrc = resolve(__dirname, 'src')
|
||||
export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => {
|
||||
|
@ -23,7 +24,8 @@ export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => {
|
|||
define: {
|
||||
//define global var
|
||||
GLOBAL_STRING: JSON.stringify('i am global var from vite.config.js define'),
|
||||
GLOBAL_VAR: { test: 'i am global var from vite.config.js define' }
|
||||
GLOBAL_VAR: { test: 'i am global var from vite.config.js define' },
|
||||
'import.meta.env.PROJECT_VERSION': JSON.stringify(packageJson.version)
|
||||
},
|
||||
clearScreen: false, //设为 false 可以避免 Vite 清屏而错过在终端中打印某些关键信息
|
||||
server: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user