This commit is contained in:
oneao committed 2025-08-14 19:33:38 +08:00
1 parent 0f1604c709
commit 4e42a01b97
18 files changed
+1371 -47

No files matched your search

+1
View File
@@ -0,0 +1 @@
node_modules/
@@ -0,0 +1,101 @@
{
"globals": {
"Component": true,
"ComponentPublicInstance": true,
"ComputedRef": true,
"EffectScope": true,
"ExtractDefaultPropTypes": true,
"ExtractPropTypes": true,
"ExtractPublicPropTypes": true,
"InjectionKey": true,
"PropType": true,
"Ref": true,
"VNode": true,
"WritableComputedRef": true,
"computed": true,
"createApp": true,
"customRef": true,
"defineAsyncComponent": true,
"defineComponent": true,
"effectScope": true,
"getCurrentInstance": true,
"getCurrentScope": true,
"h": true,
"inject": true,
"isProxy": true,
"isReactive": true,
"isReadonly": true,
"isRef": true,
"markRaw": true,
"nextTick": true,
"onActivated": true,
"onAddToFavorites": true,
"onBackPress": true,
"onBeforeMount": true,
"onBeforeUnmount": true,
"onBeforeUpdate": true,
"onDeactivated": true,
"onError": true,
"onErrorCaptured": true,
"onHide": true,
"onLaunch": true,
"onLoad": true,
"onMounted": true,
"onNavigationBarButtonTap": true,
"onNavigationBarSearchInputChanged": true,
"onNavigationBarSearchInputClicked": true,
"onNavigationBarSearchInputConfirmed": true,
"onNavigationBarSearchInputFocusChanged": true,
"onPageNotFound": true,
"onPageScroll": true,
"onPullDownRefresh": true,
"onReachBottom": true,
"onReady": true,
"onRenderTracked": true,
"onRenderTriggered": true,
"onResize": true,
"onScopeDispose": true,
"onServerPrefetch": true,
"onShareAppMessage": true,
"onShareTimeline": true,
"onShow": true,
"onTabItemTap": true,
"onThemeChange": true,
"onUnhandledRejection": true,
"onUnload": true,
"onUnmounted": true,
"onUpdated": true,
"provide": true,
"reactive": true,
"readonly": true,
"ref": true,
"resolveComponent": true,
"shallowReactive": true,
"shallowReadonly": true,
"shallowRef": true,
"toRaw": true,
"toRef": true,
"toRefs": true,
"toValue": true,
"triggerRef": true,
"unref": true,
"useAttrs": true,
"useCssModule": true,
"useCssVars": true,
"useRequest": true,
"useSlots": true,
"useUpload": true,
"useUpload2": true,
"watch": true,
"watchEffect": true,
"watchPostEffect": true,
"watchSyncEffect": true,
"DirectiveBinding": true,
"MaybeRef": true,
"MaybeRefOrGetter": true,
"onWatcherCleanup": true,
"useId": true,
"useModel": true,
"useTemplateRef": true
}
}
+27
View File
@@ -0,0 +1,27 @@
module.exports = {
root: true,
env: {
node: true,
browser: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
'plugin:prettier/recommended',
'./.eslintrc-auto-import.json',
],
parserOptions: {
ecmaVersion: 'latest',
parser: '@typescript-eslint/parser',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'prettier', 'vue'],
rules: {
'no-undef': 'off', // 在 Vue 文件中关闭 `no-undef` 规则
'vue/multi-word-component-names': 'off', // 禁用该规则
'@typescript-eslint/no-explicit-any': 'warn',
'vue/no-reserved-props': 'off',
},
}
+2
View File
@@ -0,0 +1,2 @@
node_modules/
src-tauri/
+18
View File
@@ -0,0 +1,18 @@
module.exports = {
singleQuote: true,
printWidth: 100,
tabWidth: 2,
useTabs: false,
semi: false,
trailingComma: 'all',
endOfLine: 'auto',
htmlWhitespaceSensitivity: 'ignore',
overrides: [
{
files: '*.json',
options: {
trailingComma: 'none',
},
},
],
}
+3 -10
View File
@@ -1,14 +1,7 @@
{
"recommendations": [
"afzalsayed96.icones",
"Vue.volar",
"antfu.iconify",
"antfu.unocss",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"mhutchie.git-graph",
"mikestead.dotenv",
"sdras.vue-vscode-snippets",
"vue.volar",
"antfu.unocss"
]
}
}
+22 -17
View File
@@ -1,22 +1,27 @@
{
"editor.cursorSmoothCaretAnimation": "on",
"css.validate": false,
"less.validate": false,
"scss.validate": false,
// 默认格式化工具选择prettier
"editor.defaultFormatter": "esbenp.prettier-vscode",
// 保存的时候自动格式化
"editor.formatOnSave": true,
//开启自动修复
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
"source.fixAll.stylelint": "explicit"
},
"editor.formatOnSave": false,
"eslint.validate": [
"html",
"css",
"scss",
"json",
"jsonc",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue"
],
"prettier.enable": false,
"typescript.tsdk": "node_modules/typescript/lib",
"unocss.root": ["./"]
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.validate": ["javascript", "javascriptreact", "vue", "typescript", "typescriptreact"]
}
@@ -0,0 +1,12 @@
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
import timezone from 'dayjs/plugin/timezone'
export function getBuildTime() {
dayjs.extend(utc)
dayjs.extend(timezone)
const buildTime = dayjs.tz(Date.now(), 'Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss')
return buildTime
}
@@ -0,0 +1 @@
export * from './time'
@@ -0,0 +1,34 @@
import IconsResolver from 'unplugin-icons/resolver'
import Components from 'unplugin-vue-components/vite'
import { ArcoResolver } from 'unplugin-vue-components/resolvers'
import type { PluginOption } from 'vite'
export function setupAutoImport(viteEnv: Env.ImportMeta) {
// 从环境变量中提取图标相关的前缀
const { VITE_ICON_PREFIX, VITE_ICON_LOCAL_PREFIX } = viteEnv
// 从本地图标前缀中提取图标集合名称
const collectionName = VITE_ICON_LOCAL_PREFIX.replace(`${VITE_ICON_PREFIX}-`, '')
const plugins: PluginOption[] = [
Components({
// 自动导入的组件类型声明文件
dts: 'src/types/auto-import.d.ts',
types: [
{
from: 'vue-router',
names: ['RouterLink', 'RouterView'],
},
],
// 配置图标解析器
resolvers: [
IconsResolver({
customCollections: [collectionName], // 本地图标集合
componentPrefix: VITE_ICON_PREFIX, // 图标组件的前缀
}),
ArcoResolver(),
],
}),
]
return plugins
}
@@ -0,0 +1,13 @@
import type { Plugin } from 'vite'
export function setupHtmlPlugin(buildTime: string) {
const plugin: Plugin = {
name: 'html-plugin',
apply: 'build',
transformIndexHtml(html) {
return html.replace('<head>', `<head>\n <meta name="buildTime" content="${buildTime}">`)
},
}
return plugin
}
@@ -0,0 +1,22 @@
import type { PluginOption } from 'vite'
import vue from '@vitejs/plugin-vue'
import VueDevtools from 'vite-plugin-vue-devtools'
import progress from 'vite-plugin-progress'
import { setupUnocss } from './unocss'
import { setupHtmlPlugin } from './html'
import { setupUnPluginIcon } from './unplugin-icon'
import { setupAutoImport } from './auto-import'
export function setupVitePlugins(viteEnv: Env.ImportMeta, buildTime: string) {
const plugins: PluginOption = [
vue(),
VueDevtools(),
progress(),
setupUnocss(viteEnv),
setupHtmlPlugin(buildTime),
setupAutoImport(viteEnv),
...setupUnPluginIcon(viteEnv),
]
return plugins
}
@@ -0,0 +1,32 @@
import process from 'node:process'
import path from 'node:path'
import unocss from '@unocss/vite'
import presetIcons from '@unocss/preset-icons'
import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
export function setupUnocss(viteEnv: Env.ImportMeta) {
const { VITE_ICON_PREFIX, VITE_ICON_LOCAL_PREFIX } = viteEnv
const localIconPath = path.join(process.cwd(), 'src/assets/svg-icon')
/** The name of the local icon collection */
const collectionName = VITE_ICON_LOCAL_PREFIX.replace(`${VITE_ICON_PREFIX}-`, '')
return unocss({
presets: [
presetIcons({
prefix: `${VITE_ICON_PREFIX}-`,
scale: 1,
extraProperties: {
display: 'inline-block',
},
collections: {
[collectionName]: FileSystemIconLoader(localIconPath, (svg) =>
svg.replace(/^<svg\s/, '<svg width="1em" height="1em" '),
),
},
warn: true,
}),
],
})
}
@@ -0,0 +1,34 @@
import path from 'node:path'
import process from 'node:process'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
import type { PluginOption } from 'vite'
import Icons from 'unplugin-icons/vite'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
export function setupUnPluginIcon(viteEnv: Env.ImportMeta) {
const { VITE_ICON_PREFIX, VITE_ICON_LOCAL_PREFIX } = viteEnv
const localIconPath = path.join(process.cwd(), 'src/assets/svg-icon')
/** The name of the local icon collection */
const collectionName = VITE_ICON_LOCAL_PREFIX.replace(`${VITE_ICON_PREFIX}-`, '')
const plugins: PluginOption[] = [
createSvgIconsPlugin({
iconDirs: [localIconPath],
symbolId: `${VITE_ICON_LOCAL_PREFIX}-[dir]-[name]`,
inject: 'body-last',
customDomId: '__SVG_ICON_LOCAL__',
}),
Icons({
compiler: 'vue3',
customCollections: {
[collectionName]: FileSystemIconLoader(localIconPath, (svg) =>
svg.replace(/^<svg\s/, '<svg width="1em" height="1em" '),
),
},
scale: 1,
defaultClass: 'inline-block',
}),
]
return plugins
}
+7
View File
@@ -40,6 +40,8 @@
"@iconify/utils": "^2.2.1",
"@types/node": "22.10.7",
"@types/nprogress": "0.2.3",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@unocss/preset-icons": "65.4.2",
"@unocss/preset-uno": "65.4.2",
"@unocss/transformer-directives": "65.4.2",
@@ -47,6 +49,11 @@
"@unocss/vite": "65.4.2",
"@vitejs/plugin-vue": "5.2.1",
"@vitejs/plugin-vue-jsx": "4.1.1",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-vue": "^9.32.0",
"prettier-plugin-tailwindcss": "^0.6.11",
"globals": "^15.14.0",
"sass": "1.83.4",
"tsx": "4.19.2",
+1041 -16
View File
File diff suppressed because it is too large. Load diff
-1
View File
@@ -7,7 +7,6 @@ export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
AButton: typeof import('@arco-design/web-vue')['Button']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
SvgIcon: typeof import('./../components/svg-icon.vue')['default']