diff --git a/.gitignore b/.gitignore index 757e16c..bd4e583 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ stats.html *.sw? /src/typings/components.d.ts +/src/typings/auto-imports.d.ts pnpm-lock.yaml package-lock.json yarn.lock diff --git a/LICENSE b/LICENSE index eb3ef35..341cc2f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Soybean +Copyright (c) 2021 Rock chen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/build/plugins/index.ts b/build/plugins/index.ts index e5dba6f..de3c34c 100644 --- a/build/plugins/index.ts +++ b/build/plugins/index.ts @@ -1,11 +1,12 @@ import type { PluginOption } from 'vite' -import unocss from '@unocss/vite' +import UnoCSS from '@unocss/vite' import vueSetupExtend from 'vite-plugin-vue-setup-extend' import vue from './vue' import compress from './compress' import visualizer from './visualizer' import unplugin from './unplugin' import mock from './mock' +// import { viteMockServe } from 'vite-plugin-mock' // https://github.com/vbenjs/vite-plugin-mock/blob/main/README.zh_CN.md /** * @description: 设置vite插件配置 @@ -13,7 +14,7 @@ import mock from './mock' * @return {*} */ export function setVitePlugins(env: ImportMetaEnv) { - const plugins: PluginOption[] = [...vue, unocss(), ...unplugin, mock, vueSetupExtend()] + const plugins: PluginOption[] = [...vue, UnoCSS(), ...unplugin,mock, vueSetupExtend()] // 是否压缩 if (env.VITE_COMPRESS_OPEN === 'Y') plugins.push(compress(env)) diff --git a/build/plugins/mock.ts b/build/plugins/mock.ts index bd94741..c181842 100644 --- a/build/plugins/mock.ts +++ b/build/plugins/mock.ts @@ -2,5 +2,6 @@ import { viteMockServe } from 'vite-plugin-mock' // https://github.com/vbenjs/vi export default viteMockServe({ mockPath: 'mock', - injectCode: 'import { setupMockServer } from \'../mock\';setupMockServer();', + enable: true, + // watchFiles: false, }) diff --git a/build/plugins/unplugin.ts b/build/plugins/unplugin.ts index 418952e..229c92d 100644 --- a/build/plugins/unplugin.ts +++ b/build/plugins/unplugin.ts @@ -1,5 +1,6 @@ import path from 'node:path' import Components from 'unplugin-vue-components/vite' +import AutoImport from 'unplugin-auto-import/vite' import { NaiveUiResolver } from 'unplugin-vue-components/resolvers' import Icons from 'unplugin-icons/vite' // https://github.com/antfu/unplugin-icons @@ -8,6 +9,15 @@ import IconsResolver from 'unplugin-icons/resolver' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' // https://github.com/vbenjs/vite-plugin-svg-icons/blob/main/README.zh_CN.md export default [ + AutoImport({ + imports: ['vue', 'vue-router','@vueuse/core','pinia'], + include: [ + /\.[tj]sx?$/, + /\.vue$/, + /\.vue\?vue/, + /\.md$/], + dts: 'src/typings/auto-imports.d.ts', + }), Components({ dts: 'src/typings/components.d.ts', resolvers: [IconsResolver(), NaiveUiResolver()], diff --git a/build/plugins/vue.ts b/build/plugins/vue.ts index ca19af0..5f9e324 100644 --- a/build/plugins/vue.ts +++ b/build/plugins/vue.ts @@ -1,6 +1,7 @@ import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' // https://github.com/vitejs/vite/tree/main/packages/plugin-vue-jsx +import VueDevTools from 'vite-plugin-vue-devtools' // https://github.com/webfansplz/vite-plugin-vue-devtools -const plugins = [vue(), vueJsx()] +const plugins = [vue(), vueJsx(),VueDevTools()] export default plugins diff --git a/package.json b/package.json index 2a51b76..997586d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ench-admin", - "version": "0.0.1", + "version": "0.1.0", "private": true, "description": "", "author": { @@ -57,28 +57,25 @@ "@wangeditor/editor-for-vue": "^5.1.12", "axios": "^1.4.0", "crypto-js": "^4.1.1", - "echarts": "^5.4.1", + "echarts": "^5.4.2", "md-editor-v3": "^2.9.3", "pinia": "^2.1.3", "pinia-plugin-persist": "^1.0.0", "qs": "^6.11.1", "vue": "^3.3.4", "vue-qr": "^4.0.9", - "vue-router": "^4.1.6" + "vue-router": "^4.2.2" }, "devDependencies": { "@chansee97/commitlint-config": "^0.3.3", "@chansee97/eslint-config-vue": "^0.3.3", - "@commitlint/cli": "^17.4.1", - "@iconify-json/icon-park-outline": "^1.1.9", - "@iconify/vue": "^4.0.2", + "@commitlint/cli": "^17.6.5", + "@iconify-json/icon-park-outline": "^1.1.11", + "@iconify/vue": "^4.1.1", "@types/crypto-js": "^4.1.1", "@types/mockjs": "^1.0.7", - "@types/node": "^18.15.3", + "@types/node": "^20.3.1", "@types/qs": "^6.9.7", - "@unocss/preset-attributify": "^0.50.4", - "@unocss/preset-uno": "^0.50.4", - "@unocss/vite": "^0.50.4", "@vitejs/plugin-vue": "^4.0.0", "@vitejs/plugin-vue-jsx": "^3.0.0", "commitizen": "^4.2.6", @@ -91,13 +88,16 @@ "naive-ui": "^2.34.4", "rollup-plugin-visualizer": "^5.9.0", "simple-git-hooks": "^2.8.1", - "typescript": "^5.0.4", - "unplugin-icons": "^0.15.3", - "unplugin-vue-components": "^0.24.1", - "vite": "^4.3.8", + "typescript": "^5.1.3", + "unocss": "^0.53.1", + "unplugin-auto-import": "^0.16.4", + "unplugin-icons": "^0.16.3", + "unplugin-vue-components": "^0.25.1", + "vite": "^4.3.9", "vite-plugin-compression": "^0.5.1", "vite-plugin-mock": "^2.9.6", "vite-plugin-svg-icons": "^2.0.1", + "vite-plugin-vue-devtools": "^0.2.0", "vite-plugin-vue-setup-extend": "^0.4.0", "vue-tsc": "^1.6.5" }, @@ -110,6 +110,7 @@ "eslint --fix" ], "*.vue": [ - "eslint --fix" ] + "eslint --fix" + ] } } diff --git a/src/App.vue b/src/App.vue index b588387..91e5f0e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,5 +19,3 @@ const themeOverrides: GlobalThemeOverrides = {} || themeConfig - - diff --git a/unocss.config.ts b/unocss.config.ts index 475f469..f02ff16 100644 --- a/unocss.config.ts +++ b/unocss.config.ts @@ -1,6 +1,4 @@ -import { defineConfig } from '@unocss/vite' // https://github.com/unocss/unocss -import presetUno from '@unocss/preset-uno' -import presetAttributify from '@unocss/preset-attributify' +import { presetUno,presetAttributify,defineConfig } from 'unocss' // https://github.com/unocss/unocss export default defineConfig({ presets: [presetUno({ dark: 'class' }), presetAttributify()],