ci: 集成: 🎡 添加docker;添加开发环境等

This commit is contained in:
bunny 2024-02-27 15:14:49 +08:00
parent 28f0cd9227
commit b7cad430bc
8 changed files with 41 additions and 4 deletions

3
.env Normal file
View File

@ -0,0 +1,3 @@
# 请求api地址process.env.VUE_APP_URL
VUE_APP_URL=http://localhost:8088/xxx
VUE_APP_FLAG = 'prod'

3
.env.development Normal file
View File

@ -0,0 +1,3 @@
# 请求api地址process.env.VUE_APP_URL
VUE_APP_URL=http://localhost:8088/xxx
VUE_APP_FLAG = 'dev'

4
.env.test Normal file
View File

@ -0,0 +1,4 @@
NODE_ENV = 'production'
# 请求api地址process.env.VUE_APP_URL
VUE_APP_URL=http://localhost:8088/xxx
VUE_APP_FLAG = 'test'

View File

@ -5,6 +5,7 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"testbuild": "vue-cli-service build --mode test",
"lint": "vue-cli-service lint",
"lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
"lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!-- <meta name="viewport" content="width=device-width,initial-scale=1.0"> -->
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>

View File

@ -1,4 +1,4 @@
import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from 'vue-router';
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
const routes: Array<RouteRecordRaw> = [
{
@ -13,7 +13,8 @@ const routes: Array<RouteRecordRaw> = [
* createWebHistory
*/
const router = createRouter({
history: createWebHashHistory(process.env.BASE_URL),
history:
process.env.NODE_ENV === 'production' ? createWebHashHistory(process.env.BASE_URL) : createWebHashHistory(process.env.BASE_URL),
routes,
});

View File

@ -1,5 +1,5 @@
<template>
成功
<h1>成功</h1>
<div class="box"></div>
<div class="charts">
<ECharts :option="option" autoresize theme="dark" />

View File

@ -2,6 +2,31 @@ const { defineConfig } = require('@vue/cli-service');
const WebpackBar = require('webpackbar');
module.exports = defineConfig({
transpileDependencies: true,
productionSourceMap: false, // 不生成map文件-优化打包
// 生产环境开启js\css压缩--- 打包优化
chainWebpack: config => {
if (process.env.NODE_ENV === 'production') {
config.plugin('compressionPlugin').use(
new CompressionPlugin({
test: /\.(js|css|less|map)$/, // 匹配文件名
threshold: 1024, // 对超过10k的数据压缩
minRatio: 0.8,
}),
);
}
},
// 代理设置
devServer: {
port: 6366,
open: true,
https: false,
proxy: {
'/api': {
target: process.env.VUE_APP_URL,
changeOrigin: true,
},
},
},
configureWebpack: {
plugins: [
// 设置进度条颜色