🐎 ci(版本号):
构建版本号/分支信息
This commit is contained in:
parent
1dfce28a75
commit
a59d608f09
@ -17,6 +17,9 @@ module.exports = {
|
|||||||
args: [{
|
args: [{
|
||||||
terserOptions: {
|
terserOptions: {
|
||||||
compress: true, // 默认使用terser压缩
|
compress: true, // 默认使用terser压缩
|
||||||
|
// compress: {
|
||||||
|
// drop_console: true, // 去掉打印
|
||||||
|
// }, // 默认使用terser压缩
|
||||||
// mangle: false,
|
// mangle: false,
|
||||||
keep_classnames: true, // 不改变class名称
|
keep_classnames: true, // 不改变class名称
|
||||||
keep_fnames: true // 不改变函数名称
|
keep_fnames: true // 不改变函数名称
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
const path = require('path')
|
||||||
|
const childProcess = require('child_process');
|
||||||
|
const versions = childProcess.execSync('git rev-parse --abbrev-ref HEAD', { 'encoding': 'utf8' }) != "HEAD\n" ? childProcess.execSync('git rev-parse --abbrev-ref HEAD', { 'encoding': 'utf8' }) : childProcess.execSync('git describe --tags --abbrev=0', { 'encoding': 'utf8' })
|
||||||
|
const CURRENT_GITHASH = childProcess.execSync('git rev-parse --short HEAD', { 'encoding': 'utf8' })
|
||||||
|
const CURRENT_VERSION = `Version: ${JSON.stringify(process.env.CODE_BRANCH || versions)} ${CURRENT_GITHASH} ${new Date().toLocaleString()}`.replace(/\"|\\n/g, '');
|
||||||
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
projectName: 'EShop',
|
projectName: 'EShop',
|
||||||
date: '2022-4-6',
|
date: '2022-4-6',
|
||||||
@ -11,6 +18,8 @@ const config = {
|
|||||||
outputRoot: 'dist',
|
outputRoot: 'dist',
|
||||||
plugins: [],
|
plugins: [],
|
||||||
defineConstants: {
|
defineConstants: {
|
||||||
|
CURRENT_VERSION: JSON.stringify(CURRENT_VERSION),
|
||||||
|
CURRENT_GITHASH: JSON.stringify(CURRENT_GITHASH),
|
||||||
CURRENT_ENV: JSON.stringify(process.env.NODE_ENV)
|
CURRENT_ENV: JSON.stringify(process.env.NODE_ENV)
|
||||||
},
|
},
|
||||||
copy: {
|
copy: {
|
||||||
|
@ -5,7 +5,32 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
defineConstants: {
|
defineConstants: {
|
||||||
},
|
},
|
||||||
mini: {},
|
mini: {
|
||||||
|
optimizeMainPackage: {
|
||||||
|
enable: true
|
||||||
|
},
|
||||||
|
webpackChain: (chain, webpack) => {
|
||||||
|
chain.merge({
|
||||||
|
plugin: {
|
||||||
|
install: {
|
||||||
|
plugin: require('terser-webpack-plugin'),
|
||||||
|
args: [{
|
||||||
|
terserOptions: {
|
||||||
|
// compress: true, // 默认使用terser压缩
|
||||||
|
compress: {
|
||||||
|
drop_console: true, // 去掉打印
|
||||||
|
}, // 默认使用terser压缩
|
||||||
|
// mangle: false,
|
||||||
|
keep_classnames: true, // 不改变class名称
|
||||||
|
keep_fnames: true // 不改变函数名称
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
h5: {
|
h5: {
|
||||||
/**
|
/**
|
||||||
* 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。
|
* 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。
|
||||||
|
@ -18,6 +18,11 @@ export default () => {
|
|||||||
// 用户信息
|
// 用户信息
|
||||||
const { getSelfUserInfo, getAdminUserInfo } = useLogin();
|
const { getSelfUserInfo, getAdminUserInfo } = useLogin();
|
||||||
const { adminUserInfo } = useSelector(state => state.userInfo);
|
const { adminUserInfo } = useSelector(state => state.userInfo);
|
||||||
|
|
||||||
|
const [current_version,setCurrent_version] = useState(CURRENT_VERSION)
|
||||||
|
const [current_githash,setCurrent_githash] = useState(CURRENT_GITHASH)
|
||||||
|
const [current_env,setCurrent_env] = useState(CURRENT_ENV)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// getSelfUserInfo().then().catch(() => {
|
// getSelfUserInfo().then().catch(() => {
|
||||||
// alert.none("授权失败,请授权后再使用");
|
// alert.none("授权失败,请授权后再使用");
|
||||||
@ -65,7 +70,8 @@ export default () => {
|
|||||||
<Main />
|
<Main />
|
||||||
{/* {(adminUserInfo as any)?.authentication_status==1&&<Modal data={adminUserInfo}/>} */}
|
{/* {(adminUserInfo as any)?.authentication_status==1&&<Modal data={adminUserInfo}/>} */}
|
||||||
{/* 测试暂时添加 */}
|
{/* 测试暂时添加 */}
|
||||||
<View style={{ fontSize: '26rpx', textAlign: 'center' }}>{BASE_URL}</View>
|
<View style={{ fontSize: '26rpx',color:'#707070', textAlign: 'center' }}>{current_version}</View>
|
||||||
|
{current_env === 'development' &&<View style={{ fontSize: '26rpx',color:'#707070', textAlign: 'center' }}>{BASE_URL}</View>}
|
||||||
{!adminUserInfo?.is_authorize_name && <View onClick={handleAuth} className={styles["auth-suspension"]}></View>}
|
{!adminUserInfo?.is_authorize_name && <View onClick={handleAuth} className={styles["auth-suspension"]}></View>}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user