补充更新
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=/
|
VITE_BASE_PATH=/
|
||||||
@ -21,3 +21,15 @@ VITE_OUT_DIR=dist-dev
|
|||||||
|
|
||||||
# 标题
|
# 标题
|
||||||
VITE_APP_TITLE=后台系统-开发
|
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=/
|
VITE_BASE_PATH=/
|
||||||
@ -21,3 +21,15 @@ VITE_OUT_DIR=dist-pro
|
|||||||
|
|
||||||
# 标题
|
# 标题
|
||||||
VITE_APP_TITLE=后台系统
|
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/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
|
node_modules
|
||||||
.DS_Store
|
.DS_Store
|
||||||
dist
|
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
*-lock.*
|
*-lock.*
|
||||||
pnpm-debug
|
pnpm-debug
|
||||||
|
stats.html
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
/dist*
|
/dist*
|
||||||
/public/*
|
/public/*
|
||||||
/docs/*
|
/docs/*
|
||||||
/vite.config.ts
|
|
||||||
/src/types/env.d.ts
|
/src/types/env.d.ts
|
||||||
/docs/**/*
|
/docs/**/*
|
||||||
/plop/**/*
|
/plop/**/*
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -20,12 +20,8 @@ module.exports = {
|
|||||||
'function-no-unknown': null,
|
'function-no-unknown': null,
|
||||||
'no-empty-source': null,
|
'no-empty-source': null,
|
||||||
'named-grid-areas-no-invalid': null,
|
'named-grid-areas-no-invalid': null,
|
||||||
'unicode-bom': 'never',
|
|
||||||
'no-descending-specificity': null,
|
'no-descending-specificity': null,
|
||||||
'font-family-no-missing-generic-family-keyword': 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': [
|
'rule-empty-line-before': [
|
||||||
'always',
|
'always',
|
||||||
{
|
{
|
||||||
@ -214,7 +210,8 @@ module.exports = {
|
|||||||
files: ['*.vue', '**/*.vue', '*.html', '**/*.html'],
|
files: ['*.vue', '**/*.vue', '*.html', '**/*.html'],
|
||||||
extends: ['stylelint-config-recommended', 'stylelint-config-html'],
|
extends: ['stylelint-config-recommended', 'stylelint-config-html'],
|
||||||
rules: {
|
rules: {
|
||||||
'keyframes-name-pattern': null,
|
'selector-class-pattern': null,
|
||||||
|
'no-duplicate-selectors': null,
|
||||||
'selector-pseudo-class-no-unknown': [
|
'selector-pseudo-class-no-unknown': [
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
|
@ -31,5 +31,5 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"include": ["src", "types/**/*.d.ts"],
|
"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'
|
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({
|
export default defineConfig({
|
||||||
// ...UnoCSS options
|
// ...UnoCSS options
|
||||||
rules: [
|
rules: [
|
||||||
|
[
|
||||||
|
/^overflow-ellipsis$/,
|
||||||
|
([], { rawSelector }) => {
|
||||||
|
const selector = e(rawSelector)
|
||||||
|
return `
|
||||||
|
${selector} {
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
/^custom-hover$/,
|
/^custom-hover$/,
|
||||||
([], { rawSelector }) => {
|
([], { rawSelector }) => {
|
||||||
@ -100,6 +124,11 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
presets: [presetUno({ dark: 'class', attributify: false })],
|
presets: [presetUno({ dark: 'class', attributify: false }), ...createPresetIcons()],
|
||||||
transformers: [transformerVariantGroup()]
|
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 VueJsx from '@vitejs/plugin-vue-jsx'
|
||||||
import progress from 'vite-plugin-progress'
|
import progress from 'vite-plugin-progress'
|
||||||
import EslintPlugin from 'vite-plugin-eslint'
|
import EslintPlugin from 'vite-plugin-eslint'
|
||||||
import { ViteEjsPlugin } from "vite-plugin-ejs"
|
import { ViteEjsPlugin } from 'vite-plugin-ejs'
|
||||||
import { viteMockServe } from 'vite-plugin-mock'
|
|
||||||
import PurgeIcons from 'vite-plugin-purge-icons'
|
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 { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
||||||
import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import'
|
import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import'
|
||||||
import UnoCSS from 'unocss/vite'
|
import UnoCSS from 'unocss/vite'
|
||||||
|
import { visualizer } from 'rollup-plugin-visualizer'
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
const root = process.cwd()
|
const root = process.cwd()
|
||||||
@ -24,7 +24,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
|||||||
let env = {} as any
|
let env = {} as any
|
||||||
const isBuild = command === 'build'
|
const isBuild = command === 'build'
|
||||||
if (!isBuild) {
|
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 {
|
} else {
|
||||||
env = loadEnv(mode, root)
|
env = loadEnv(mode, root)
|
||||||
}
|
}
|
||||||
@ -39,19 +39,23 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
|||||||
}),
|
}),
|
||||||
VueJsx(),
|
VueJsx(),
|
||||||
progress(),
|
progress(),
|
||||||
createStyleImportPlugin({
|
env.VITE_USE_ALL_ELEMENT_PLUS_STYLE === 'false'
|
||||||
resolves: [ElementPlusResolve()],
|
? createStyleImportPlugin({
|
||||||
libs: [{
|
resolves: [ElementPlusResolve()],
|
||||||
libraryName: 'element-plus',
|
libs: [
|
||||||
esModule: true,
|
{
|
||||||
resolveStyle: (name) => {
|
libraryName: 'element-plus',
|
||||||
if (name === 'click-outside') {
|
esModule: true,
|
||||||
return ''
|
resolveStyle: (name) => {
|
||||||
}
|
if (name === 'click-outside') {
|
||||||
return `element-plus/es/components/${name.replace(/^el-/, '')}/style/css`
|
return ''
|
||||||
}
|
}
|
||||||
}]
|
return `element-plus/es/components/${name.replace(/^el-/, '')}/style/css`
|
||||||
}),
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
: undefined,
|
||||||
EslintPlugin({
|
EslintPlugin({
|
||||||
cache: false,
|
cache: false,
|
||||||
include: ['src/**/*.vue', 'src/**/*.ts', 'src/**/*.tsx'] // 检查的文件
|
include: ['src/**/*.vue', 'src/**/*.ts', 'src/**/*.tsx'] // 检查的文件
|
||||||
@ -67,22 +71,10 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
|||||||
svgoOptions: true
|
svgoOptions: true
|
||||||
}),
|
}),
|
||||||
PurgeIcons(),
|
PurgeIcons(),
|
||||||
viteMockServe({
|
|
||||||
ignore: /^\_/,
|
|
||||||
mockPath: 'mock',
|
|
||||||
localEnabled: !isBuild,
|
|
||||||
prodEnabled: isBuild,
|
|
||||||
injectCode: `
|
|
||||||
import { setupProdMockServer } from '../mock/_createProductionServer'
|
|
||||||
|
|
||||||
setupProdMockServer()
|
|
||||||
`
|
|
||||||
}),
|
|
||||||
ViteEjsPlugin({
|
ViteEjsPlugin({
|
||||||
title: env.VITE_APP_TITLE
|
title: env.VITE_APP_TITLE
|
||||||
}),
|
}),
|
||||||
UnoCSS(),
|
UnoCSS()
|
||||||
// sveltekit(),
|
|
||||||
],
|
],
|
||||||
|
|
||||||
css: {
|
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: {
|
build: {
|
||||||
minify: 'terser',
|
target: 'es2015',
|
||||||
outDir: env.VITE_OUT_DIR || 'dist',
|
outDir: env.VITE_OUT_DIR || 'dist',
|
||||||
sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false,
|
sourcemap: env.VITE_SOURCEMAP === 'true',
|
||||||
// brotliSize: false,
|
// brotliSize: false,
|
||||||
terserOptions: {
|
rollupOptions: {
|
||||||
compress: {
|
plugins: env.VITE_USE_BUNDLE_ANALYZER === 'true' ? [visualizer()] : undefined,
|
||||||
drop_debugger: env.VITE_DROP_DEBUGGER === 'true',
|
// 拆包
|
||||||
drop_console: env.VITE_DROP_CONSOLE === 'true'
|
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: {
|
server: {
|
||||||
port: 5000,
|
port: 5000,
|
||||||
@ -125,19 +128,13 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
|||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://127.0.0.1:9000',
|
target: 'http://127.0.0.1:9000',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: path => path.replace(/^\/api/, '')
|
rewrite: (path) => path.replace(/^\/api/, '')
|
||||||
},
|
},
|
||||||
// 选项写法
|
// 选项写法
|
||||||
'/media': {
|
'/media': {
|
||||||
target: 'http://127.0.0.1:9000',
|
target: 'http://127.0.0.1:9000',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: path => path
|
rewrite: (path) => path
|
||||||
},
|
|
||||||
// 选项写法
|
|
||||||
'/temp': {
|
|
||||||
target: 'http://127.0.0.1:9000',
|
|
||||||
changeOrigin: true,
|
|
||||||
rewrite: path => path
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hmr: {
|
hmr: {
|
||||||
@ -163,7 +160,8 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
|||||||
'@wangeditor/editor-for-vue',
|
'@wangeditor/editor-for-vue',
|
||||||
'vue-json-pretty',
|
'vue-json-pretty',
|
||||||
'@zxcvbn-ts/core',
|
'@zxcvbn-ts/core',
|
||||||
'dayjs'
|
'dayjs',
|
||||||
|
'cropperjs'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,8 @@ class ScheduledTask:
|
|||||||
self.mongo.close_database_connection()
|
self.mongo.close_database_connection()
|
||||||
if self.scheduler:
|
if self.scheduler:
|
||||||
self.scheduler.shutdown()
|
self.scheduler.shutdown()
|
||||||
self.rd.close_database_connection()
|
if self.rd:
|
||||||
|
self.rd.close_database_connection()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user