补充更新
This commit is contained in:
parent
7329231c61
commit
254d0e5958
@ -1,8 +1,8 @@
|
||||
# 环境
|
||||
NODE_ENV=development
|
||||
VITE_NODE_ENV=development
|
||||
|
||||
# 接口前缀
|
||||
VITE_API_BASE_PATH=dev
|
||||
# 接口前缀,没用到
|
||||
# VITE_API_BASE_PATH=/api
|
||||
|
||||
# 打包路径
|
||||
VITE_BASE_PATH=/
|
||||
@ -21,3 +21,15 @@ VITE_OUT_DIR=dist-dev
|
||||
|
||||
# 标题
|
||||
VITE_APP_TITLE=后台系统-开发
|
||||
|
||||
# 是否切割css
|
||||
VITE_USE_CSS_SPLIT=true
|
||||
|
||||
# 是否使用在线图标
|
||||
VITE_USE_ONLINE_ICON=true
|
||||
|
||||
# 是否包分析
|
||||
VITE_USE_BUNDLE_ANALYZER=true
|
||||
|
||||
# 是否全量引入element-plus样式
|
||||
VITE_USE_ALL_ELEMENT_PLUS_STYLE=true
|
||||
|
@ -1,8 +1,8 @@
|
||||
# 环境
|
||||
NODE_ENV=production
|
||||
VITE_NODE_ENV=production
|
||||
|
||||
# 接口前缀
|
||||
VITE_API_BASE_PATH=pro
|
||||
# 接口前缀,没用到
|
||||
# VITE_API_BASE_PATH=/api
|
||||
|
||||
# 打包路径
|
||||
VITE_BASE_PATH=/
|
||||
@ -21,3 +21,15 @@ VITE_OUT_DIR=dist-pro
|
||||
|
||||
# 标题
|
||||
VITE_APP_TITLE=后台系统
|
||||
|
||||
# 是否切割css
|
||||
VITE_USE_CSS_SPLIT=true
|
||||
|
||||
# 是否使用在线图标
|
||||
VITE_USE_ONLINE_ICON=true
|
||||
|
||||
# 是否包分析
|
||||
VITE_USE_BUNDLE_ANALYZER=true
|
||||
|
||||
# 是否全量引入element-plus样式
|
||||
VITE_USE_ALL_ELEMENT_PLUS_STYLE=false
|
||||
|
@ -65,6 +65,7 @@ module.exports = defineConfig({
|
||||
}
|
||||
],
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'vue/no-v-html': 'off'
|
||||
'vue/no-v-html': 'off',
|
||||
'vue/require-toggle-inside-transition': 'off'
|
||||
}
|
||||
})
|
||||
|
2
kinit-admin/.gitignore
vendored
2
kinit-admin/.gitignore
vendored
@ -1,7 +1,7 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
*-lock.*
|
||||
pnpm-debug
|
||||
stats.html
|
||||
|
@ -3,7 +3,6 @@
|
||||
/dist*
|
||||
/public/*
|
||||
/docs/*
|
||||
/vite.config.ts
|
||||
/src/types/env.d.ts
|
||||
/docs/**/*
|
||||
/plop/**/*
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,12 +20,8 @@ module.exports = {
|
||||
'function-no-unknown': null,
|
||||
'no-empty-source': null,
|
||||
'named-grid-areas-no-invalid': null,
|
||||
'unicode-bom': 'never',
|
||||
'no-descending-specificity': null,
|
||||
'font-family-no-missing-generic-family-keyword': null,
|
||||
'declaration-colon-space-after': 'always-single-line',
|
||||
'declaration-colon-space-before': 'never',
|
||||
'declaration-block-trailing-semicolon': null,
|
||||
'rule-empty-line-before': [
|
||||
'always',
|
||||
{
|
||||
@ -214,7 +210,8 @@ module.exports = {
|
||||
files: ['*.vue', '**/*.vue', '*.html', '**/*.html'],
|
||||
extends: ['stylelint-config-recommended', 'stylelint-config-html'],
|
||||
rules: {
|
||||
'keyframes-name-pattern': null,
|
||||
'selector-class-pattern': null,
|
||||
'no-duplicate-selectors': null,
|
||||
'selector-pseudo-class-no-unknown': [
|
||||
true,
|
||||
{
|
||||
|
@ -31,5 +31,5 @@
|
||||
]
|
||||
},
|
||||
"include": ["src", "types/**/*.d.ts"],
|
||||
"exclude": ["dist", "node_modules"]
|
||||
// "exclude": ["dist", "node_modules"]
|
||||
}
|
||||
|
@ -1,9 +1,33 @@
|
||||
import { defineConfig, toEscapedSelector as e, presetUno } from 'unocss'
|
||||
import { defineConfig, toEscapedSelector as e, presetUno, presetIcons } from 'unocss'
|
||||
import transformerVariantGroup from '@unocss/transformer-variant-group'
|
||||
|
||||
const createPresetIcons = () => {
|
||||
// @ts-ignore
|
||||
if (import.meta.env.VITE_USE_ONLINE_ICON === 'true') {
|
||||
return [
|
||||
presetIcons({
|
||||
prefix: ''
|
||||
})
|
||||
]
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
// ...UnoCSS options
|
||||
rules: [
|
||||
[
|
||||
/^overflow-ellipsis$/,
|
||||
([], { rawSelector }) => {
|
||||
const selector = e(rawSelector)
|
||||
return `
|
||||
${selector} {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
`
|
||||
}
|
||||
],
|
||||
[
|
||||
/^custom-hover$/,
|
||||
([], { rawSelector }) => {
|
||||
@ -100,6 +124,11 @@ export default defineConfig({
|
||||
}
|
||||
]
|
||||
],
|
||||
presets: [presetUno({ dark: 'class', attributify: false })],
|
||||
transformers: [transformerVariantGroup()]
|
||||
presets: [presetUno({ dark: 'class', attributify: false }), ...createPresetIcons()],
|
||||
transformers: [transformerVariantGroup()],
|
||||
content: {
|
||||
pipeline: {
|
||||
include: [/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html|ts)($|\?)/]
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -5,13 +5,13 @@ import Vue from '@vitejs/plugin-vue'
|
||||
import VueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import progress from 'vite-plugin-progress'
|
||||
import EslintPlugin from 'vite-plugin-eslint'
|
||||
import { ViteEjsPlugin } from "vite-plugin-ejs"
|
||||
import { viteMockServe } from 'vite-plugin-mock'
|
||||
import { ViteEjsPlugin } from 'vite-plugin-ejs'
|
||||
import PurgeIcons from 'vite-plugin-purge-icons'
|
||||
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite"
|
||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
||||
import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import'
|
||||
import UnoCSS from 'unocss/vite'
|
||||
import { visualizer } from 'rollup-plugin-visualizer'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
const root = process.cwd()
|
||||
@ -24,7 +24,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
let env = {} as any
|
||||
const isBuild = command === 'build'
|
||||
if (!isBuild) {
|
||||
env = loadEnv((process.argv[3] === '--mode' ? process.argv[4] : process.argv[3]), root)
|
||||
env = loadEnv(process.argv[3] === '--mode' ? process.argv[4] : process.argv[3], root)
|
||||
} else {
|
||||
env = loadEnv(mode, root)
|
||||
}
|
||||
@ -39,19 +39,23 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
}),
|
||||
VueJsx(),
|
||||
progress(),
|
||||
createStyleImportPlugin({
|
||||
resolves: [ElementPlusResolve()],
|
||||
libs: [{
|
||||
libraryName: 'element-plus',
|
||||
esModule: true,
|
||||
resolveStyle: (name) => {
|
||||
if (name === 'click-outside') {
|
||||
return ''
|
||||
}
|
||||
return `element-plus/es/components/${name.replace(/^el-/, '')}/style/css`
|
||||
}
|
||||
}]
|
||||
}),
|
||||
env.VITE_USE_ALL_ELEMENT_PLUS_STYLE === 'false'
|
||||
? createStyleImportPlugin({
|
||||
resolves: [ElementPlusResolve()],
|
||||
libs: [
|
||||
{
|
||||
libraryName: 'element-plus',
|
||||
esModule: true,
|
||||
resolveStyle: (name) => {
|
||||
if (name === 'click-outside') {
|
||||
return ''
|
||||
}
|
||||
return `element-plus/es/components/${name.replace(/^el-/, '')}/style/css`
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
: undefined,
|
||||
EslintPlugin({
|
||||
cache: false,
|
||||
include: ['src/**/*.vue', 'src/**/*.ts', 'src/**/*.tsx'] // 检查的文件
|
||||
@ -67,22 +71,10 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
svgoOptions: true
|
||||
}),
|
||||
PurgeIcons(),
|
||||
viteMockServe({
|
||||
ignore: /^\_/,
|
||||
mockPath: 'mock',
|
||||
localEnabled: !isBuild,
|
||||
prodEnabled: isBuild,
|
||||
injectCode: `
|
||||
import { setupProdMockServer } from '../mock/_createProductionServer'
|
||||
|
||||
setupProdMockServer()
|
||||
`
|
||||
}),
|
||||
ViteEjsPlugin({
|
||||
title: env.VITE_APP_TITLE
|
||||
}),
|
||||
UnoCSS(),
|
||||
// sveltekit(),
|
||||
UnoCSS()
|
||||
],
|
||||
|
||||
css: {
|
||||
@ -106,17 +98,28 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
}
|
||||
]
|
||||
},
|
||||
esbuild: {
|
||||
pure: env.VITE_DROP_CONSOLE === 'true' ? ['console.log'] : undefined,
|
||||
drop: env.VITE_DROP_DEBUGGER === 'true' ? ['debugger'] : undefined
|
||||
},
|
||||
build: {
|
||||
minify: 'terser',
|
||||
target: 'es2015',
|
||||
outDir: env.VITE_OUT_DIR || 'dist',
|
||||
sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false,
|
||||
sourcemap: env.VITE_SOURCEMAP === 'true',
|
||||
// brotliSize: false,
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_debugger: env.VITE_DROP_DEBUGGER === 'true',
|
||||
drop_console: env.VITE_DROP_CONSOLE === 'true'
|
||||
rollupOptions: {
|
||||
plugins: env.VITE_USE_BUNDLE_ANALYZER === 'true' ? [visualizer()] : undefined,
|
||||
// 拆包
|
||||
output: {
|
||||
manualChunks: {
|
||||
'vue-chunks': ['vue', 'vue-router', 'pinia', 'vue-i18n'],
|
||||
'element-plus': ['element-plus'],
|
||||
'wang-editor': ['@wangeditor/editor', '@wangeditor/editor-for-vue'],
|
||||
echarts: ['echarts', 'echarts-wordcloud']
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cssCodeSplit: !(env.VITE_USE_CSS_SPLIT === 'false')
|
||||
},
|
||||
server: {
|
||||
port: 5000,
|
||||
@ -125,19 +128,13 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:9000',
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/api/, '')
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
},
|
||||
// 选项写法
|
||||
'/media': {
|
||||
target: 'http://127.0.0.1:9000',
|
||||
changeOrigin: true,
|
||||
rewrite: path => path
|
||||
},
|
||||
// 选项写法
|
||||
'/temp': {
|
||||
target: 'http://127.0.0.1:9000',
|
||||
changeOrigin: true,
|
||||
rewrite: path => path
|
||||
rewrite: (path) => path
|
||||
}
|
||||
},
|
||||
hmr: {
|
||||
@ -163,7 +160,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
'@wangeditor/editor-for-vue',
|
||||
'vue-json-pretty',
|
||||
'@zxcvbn-ts/core',
|
||||
'dayjs'
|
||||
'dayjs',
|
||||
'cropperjs'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,8 @@ class ScheduledTask:
|
||||
self.mongo.close_database_connection()
|
||||
if self.scheduler:
|
||||
self.scheduler.shutdown()
|
||||
self.rd.close_database_connection()
|
||||
if self.rd:
|
||||
self.rd.close_database_connection()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user