From fda056528b1de204e8be6407c218994edd023e96 Mon Sep 17 00:00:00 2001 From: m1m1sha <18262227804@163.com> Date: Sun, 5 May 2024 23:10:42 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B3=20chore:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- easytier-gui/.npmrc | 2 + easytier-gui/eslint.config.js | 7 ++++ easytier-gui/package.json | 29 +++++++++---- easytier-gui/tsconfig.json | 52 ++++++++++++++++------- easytier-gui/vite.config.ts | 79 +++++++++++++++++++++++++++++++---- 5 files changed, 137 insertions(+), 32 deletions(-) create mode 100644 easytier-gui/.npmrc create mode 100644 easytier-gui/eslint.config.js diff --git a/easytier-gui/.npmrc b/easytier-gui/.npmrc new file mode 100644 index 0000000..1cfbd6f --- /dev/null +++ b/easytier-gui/.npmrc @@ -0,0 +1,2 @@ +shamefully-hoist=true +strict-peer-dependencies=false \ No newline at end of file diff --git a/easytier-gui/eslint.config.js b/easytier-gui/eslint.config.js new file mode 100644 index 0000000..d869433 --- /dev/null +++ b/easytier-gui/eslint.config.js @@ -0,0 +1,7 @@ +// @ts-check +import antfu from "@antfu/eslint-config"; + +export default antfu({ + unocss: true, + formatters: true, +}); diff --git a/easytier-gui/package.json b/easytier-gui/package.json index cd11a08..bb9aa06 100644 --- a/easytier-gui/package.json +++ b/easytier-gui/package.json @@ -14,24 +14,35 @@ "pinia": "^2.1.7", "primeflex": "^3.3.1", "primeicons": "^7.0.0", - "primevue": "^3.51.0", - "vue": "^3.3.4", - "vue-router": "^4.3.0" + "primevue": "^3.52.0", + "vue": "^3.4.26", + "vue-i18n": "^9.13.1", + "vue-router": "^4.3.2" }, "devDependencies": { + "@antfu/eslint-config": "^2.16.1", + "@intlify/unplugin-vue-i18n": "^4.0.0", "@tauri-apps/cli": "^1", + "@types/node": "^20.12.8", "@types/uuid": "^9.0.8", "@vitejs/plugin-vue": "^5.0.4", + "eslint": "^9.2.0", "autoprefixer": "^10.4.19", - "naive-ui": "^2.38.1", + "naive-ui": "^2.38.2", "postcss": "^8.4.38", "tailwindcss": "^3.4.3", - "typescript": "^5.0.2", - "unplugin-vue-components": "^0.26.0", + "typescript": "^5.4.5", + "unplugin-auto-import": "^0.17.5", + "unplugin-vue-components": "^0.27.0", + "unplugin-vue-macros": "^2.9.2", + "unplugin-vue-markdown": "^0.26.2", + "unplugin-vue-router": "^0.8.6", "uuid": "^9.0.1", "vfonts": "^0.0.3", - "vite": "^5.0.0", - "vue-i18n": "^9.12.0", - "vue-tsc": "^1.8.5" + "vite": "^5.2.11", + "vite-plugin-vue-devtools": "^7.1.3", + "vite-plugin-vue-layouts": "^0.11.0", + "vue-i18n": "^9.13.1", + "vue-tsc": "^2.0.16" } } diff --git a/easytier-gui/tsconfig.json b/easytier-gui/tsconfig.json index f82888f..cdb4de3 100644 --- a/easytier-gui/tsconfig.json +++ b/easytier-gui/tsconfig.json @@ -1,25 +1,45 @@ { "compilerOptions": { - "target": "ES2020", - "useDefineForClassFields": true, + "target": "ESNext", + "jsx": "preserve", + "lib": [ + "DOM", + "ESNext" + ], + "baseUrl": ".", "module": "ESNext", - "lib": ["ES2020", "DOM", "DOM.Iterable"], - "skipLibCheck": true, - - /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "isolatedModules": true, "noEmit": true, - "jsx": "preserve", - - /* Linting */ + "paths": { + "~/*": [ + "src/*" + ] + }, + "resolveJsonModule": true, + "types": [ + "vite/client", + "vite-plugin-vue-layouts/client", + "unplugin-vue-macros/macros-global", + "unplugin-vue-router/client" + ], + "allowJs": true, "strict": true, + "strictNullChecks": true, "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "isolatedModules": true, + "skipLibCheck": true }, - "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], - "references": [{ "path": "./tsconfig.node.json" }] -} + "vueCompilerOptions": { + "plugins": [ + "@vue-macros/volar/define-models", + "@vue-macros/volar/define-slots" + ] + }, + "exclude": [ + "dist", + "node_modules" + ] +} \ No newline at end of file diff --git a/easytier-gui/vite.config.ts b/easytier-gui/vite.config.ts index 596e131..44723b7 100644 --- a/easytier-gui/vite.config.ts +++ b/easytier-gui/vite.config.ts @@ -1,19 +1,84 @@ -import { defineConfig } from "vite"; -import vue from "@vitejs/plugin-vue"; - -import Components from 'unplugin-vue-components/vite'; +import path from 'node:path' +import { defineConfig } from 'vite' +import Vue from '@vitejs/plugin-vue' +import Layouts from 'vite-plugin-vue-layouts' +import Components from 'unplugin-vue-components/vite' +import AutoImport from 'unplugin-auto-import/vite' +import VueMacros from 'unplugin-vue-macros/vite' +import VueI18n from '@intlify/unplugin-vue-i18n/vite' +import VueDevTools from 'vite-plugin-vue-devtools' +import VueRouter from 'unplugin-vue-router/vite' +import { VueRouterAutoImports } from 'unplugin-vue-router' import { PrimeVueResolver } from 'unplugin-vue-components/resolvers'; // https://vitejs.dev/config/ export default defineConfig(async () => ({ + resolve: { + alias: { + "~/": `${path.resolve(__dirname, "src")}/`, + }, + }, plugins: [ - vue(), + VueMacros({ + plugins: { + vue: Vue({ + include: [/\.vue$/, /\.md$/], + }), + }, + }), + + // https://github.com/posva/unplugin-vue-router + VueRouter({ + extensions: ['.vue', '.md'], + dts: 'src/typed-router.d.ts', + }), + + // https://github.com/JohnCampionJr/vite-plugin-vue-layouts + Layouts(), + + // https://github.com/antfu/unplugin-auto-import + AutoImport({ + imports: [ + 'vue', + 'vue-i18n', + 'pinia', + VueRouterAutoImports, + { + // add any other imports you were relying on + 'vue-router/auto': ['useLink'], + }, + ], + dts: 'src/auto-imports.d.ts', + dirs: [ + 'src/composables', + 'src/stores', + ], + vueTemplate: true, + }), + + // https://github.com/antfu/unplugin-vue-components Components({ - dts: true, + // allow auto load markdown components under `./src/components/` + extensions: ['vue', 'md'], + // allow auto import and register components used in markdown + include: [/\.vue$/, /\.vue\?vue/, /\.md$/], + dts: 'src/components.d.ts', resolvers: [ PrimeVueResolver() ] - })], + }), + + // https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n + VueI18n({ + runtimeOnly: true, + compositionOnly: true, + fullInstall: true, + include: [path.resolve(__dirname, 'locales/**')], + }), + + // https://github.com/webfansplz/vite-plugin-vue-devtools + VueDevTools(), + ], // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` //