Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(icons): integrate unplugin-icons for enhanced icon management #1807

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion apps/desktop/electron.vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { resolve } from 'node:path'
import vue from '@vitejs/plugin-vue'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
import IconsResolver from 'unplugin-icons/resolver'
import Icons from 'unplugin-icons/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
import VueRouter from 'unplugin-vue-router/vite'
Expand Down Expand Up @@ -31,7 +34,21 @@ export default defineConfig({
dts: true,
directoryAsNamespace: true,
dirs: ['src/components', '../../../../packages/ui/src/components'],
resolvers: [ElementPlusResolver()],
resolvers: [
ElementPlusResolver(),
IconsResolver({
prefix: 'icon',
customCollections: [
'custom',
],
}),
],
}),
Icons({
compiler: 'vue3',
customCollections: {
custom: FileSystemIconLoader('../../packages/ui/src/assets/icons'),
},
}),
],
},
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"sass": "^1.80.6",
"tailwindcss": "^3.4.14",
"typescript": "^5.6.3",
"unplugin-icons": "^0.20.1",
"unplugin-vue-components": "^0.27.4",
"unplugin-vue-router": "^0.10.8",
"vite": "^5.4.10",
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/tsconfig.web.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"paths": {
"@renderer/*": ["src/renderer/src/*"]
},
"types": ["element-plus/global", "node", "mqttx"],
"types": ["element-plus/global", "node", "mqttx", "unplugin-icons/types/vue"],
"verbatimModuleSyntax": true
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"sass": "^1.80.6",
"tailwindcss": "^3.4.14",
"typescript": "~5.6.3",
"unplugin-icons": "^0.20.1",
"unplugin-vue-components": "^0.27.4",
"unplugin-vue-router": "^0.10.8",
"vite": "^5.4.10",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"paths": {
"@/*": ["./src/*"]
},
"types": ["element-plus/global", "node", "mqttx"],
"types": ["element-plus/global", "node", "mqttx", "unplugin-icons/types/vue"],
"esModuleInterop": true
},
"include": [
Expand Down
19 changes: 18 additions & 1 deletion apps/web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { fileURLToPath, URL } from 'node:url'

import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
import IconsResolver from 'unplugin-icons/resolver'
import Icons from 'unplugin-icons/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
import VueRouter from 'unplugin-vue-router/vite'
Expand All @@ -17,7 +20,21 @@ export default defineConfig({
dts: true,
directoryAsNamespace: true,
dirs: ['src/components', '../../packages/ui/src/components'],
resolvers: [ElementPlusResolver()],
resolvers: [
ElementPlusResolver(),
IconsResolver({
prefix: 'icon',
customCollections: [
'custom',
],
}),
],
}),
Icons({
compiler: 'vue3',
customCollections: {
custom: FileSystemIconLoader('../../packages/ui/src/assets/icons'),
},
}),
],
resolve: {
Expand Down
3 changes: 0 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ export default antfu(
*/
markdown: 'prettier',
},
ignores: [
'**/assets/fonts',
],
},
{
rules: {
Expand Down
21 changes: 21 additions & 0 deletions packages/ui/components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}

/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
CommonEmptyView: typeof import('./src/components/common/EmptyView.vue')['default']
CommonLeftMenu: typeof import('./src/components/common/LeftMenu.vue')['default']
CommonMainView: typeof import('./src/components/common/MainView.vue')['default']
CommonSplitView: typeof import('./src/components/common/SplitView.vue')['default']
ConnectionsDetailsView: typeof import('./src/components/connections/DetailsView.vue')['default']
ConnectionsListView: typeof import('./src/components/connections/ListView.vue')['default']
ElAside: typeof import('element-plus/es')['ElAside']
ElMain: typeof import('element-plus/es')['ElMain']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}
2 changes: 2 additions & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"sass": "^1.80.6",
"tailwindcss": "^3.4.14",
"typescript": "^5.6.3",
"unplugin-icons": "^0.20.1",
"unplugin-vue-components": "^0.27.4",
"vite": "^5.4.10",
"vite-plugin-dts": "^4.3.0",
"vitest": "^2.1.4",
Expand Down
195 changes: 0 additions & 195 deletions packages/ui/src/assets/fonts/iconfont.css

This file was deleted.

68 changes: 0 additions & 68 deletions packages/ui/src/assets/fonts/iconfont.js

This file was deleted.

Loading
Loading