From 99918fbd3b1009a872aef534a9ded3f3555829a3 Mon Sep 17 00:00:00 2001
From: K <1175047471@qq.com>
Date: Mon, 15 Jan 2024 16:01:47 +0800
Subject: [PATCH] chore: @iconify/iconify -> unocss presetIcons
---
build/generate/icon/index.ts | 68 --
build/vite/optimize.ts | 1 -
package.json | 5 +-
pnpm-lock.yaml | 8 +-
src/components/Application/index.ts | 2 -
.../Application/src/AppLocalePicker.vue | 3 +-
.../Application/src/AppSizePicker.vue | 69 --
.../src/search/AppSearchFooter.vue | 17 +-
.../src/search/AppSearchKeyItem.vue | 13 -
.../Application/src/search/AppSearchModal.vue | 5 +-
src/components/Basic/src/BasicArrow.vue | 3 +-
src/components/Button/src/BasicButton.vue | 5 +-
.../ContextMenu/src/ContextMenu.vue | 3 +-
src/components/CronTab/src/CronTabInput.vue | 3 +-
src/components/Cropper/src/CropperAvatar.vue | 3 +-
src/components/Dropdown/src/Dropdown.vue | 7 +-
.../Form/src/components/FileUpload.vue | 5 +-
.../Form/src/components/UploadItemActions.vue | 7 +-
src/components/Icon/data/icons.data.ts | 793 ------------------
src/components/Icon/index.ts | 5 +-
src/components/Icon/src/Icon.vue | 102 ---
src/components/Icon/src/IconPicker.vue | 19 +-
src/components/Icon/src/icons.ts | 8 +
.../Menu/src/components/MenuItemContent.vue | 3 +-
.../SimpleMenu/src/SimpleSubMenu.vue | 5 +-
.../SimpleMenu/src/components/SubMenuItem.vue | 5 +-
.../Table/src/components/TableAction.vue | 5 +-
.../src/components/settings/ColumnSetting.vue | 9 +-
src/components/Table/src/hooks/useRender.ts | 3 +-
src/components/Tree/src/TreeIcon.ts | 5 +-
.../Tree/src/components/TreeHeader.vue | 3 +-
src/components/Upload/src/BasicUpload.vue | 3 +-
.../default/header/components/ErrorAction.vue | 3 +-
.../components/user-dropdown/DropMenuItem.vue | 4 +-
.../header/components/user-dropdown/index.vue | 6 +-
src/layouts/default/setting/index.vue | 3 +-
src/layouts/default/sider/MixSider.vue | 11 +-
.../default/tabs/components/TabContent.vue | 3 +-
src/router/routes/modules/dashboard.ts | 6 +-
src/views/base/profile/AccountBind.vue | 24 +-
src/views/base/profile/data.ts | 20 -
.../analysis/components/GrowCard.vue | 4 +-
src/views/dashboard/analysis/data.ts | 8 +-
.../workbench/components/DynamicInfo.vue | 4 +-
.../workbench/components/ProjectCard.vue | 64 +-
.../workbench/components/QuickNav.vue | 43 +-
.../dashboard/workbench/components/data.ts | 115 +--
uno.config.ts | 13 +-
48 files changed, 225 insertions(+), 1301 deletions(-)
delete mode 100644 build/generate/icon/index.ts
delete mode 100644 src/components/Application/src/AppSizePicker.vue
delete mode 100644 src/components/Application/src/search/AppSearchKeyItem.vue
delete mode 100644 src/components/Icon/data/icons.data.ts
delete mode 100644 src/components/Icon/src/Icon.vue
create mode 100644 src/components/Icon/src/icons.ts
diff --git a/build/generate/icon/index.ts b/build/generate/icon/index.ts
deleted file mode 100644
index 8d7ced5..0000000
--- a/build/generate/icon/index.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-import path from 'node:path'
-import fs from 'fs-extra'
-import inquirer from 'inquirer'
-import colors from 'picocolors'
-import pkg from '../../../package.json'
-
-async function generateIcon() {
- const dir = path.resolve(process.cwd(), 'node_modules/@iconify/json')
-
- const raw = await fs.readJSON(path.join(dir, 'collections.json'))
-
- const collections = Object.entries(raw).map(([id, v]) => ({
- ...(v as any),
- id,
- }))
-
- const choices = collections.map(item => ({ key: item.id, value: item.id, name: item.name }))
-
- inquirer
- .prompt([
- {
- type: 'list',
- name: 'useType',
- choices: [
- { key: 'local', value: 'local', name: 'Local' },
- { key: 'onLine', value: 'onLine', name: 'OnLine' },
- ],
- message: 'How to use icons?',
- },
- {
- type: 'list',
- name: 'iconSet',
- choices,
- message: 'Select the icon set that needs to be generated?',
- },
- {
- type: 'input',
- name: 'output',
- message: 'Select the icon set that needs to be generated?',
- default: 'src/components/Icon/data',
- },
- ])
- .then(async (answers) => {
- const { iconSet, output, useType } = answers
- const outputDir = path.resolve(process.cwd(), output)
- await fs.ensureDir(outputDir)
- const genCollections = collections.filter(item => [iconSet].includes(item.id))
- const prefixSet: string[] = []
- for (const info of genCollections) {
- const data = await fs.readJSON(path.join(dir, 'json', `${info.id}.json`))
- if (data) {
- const { prefix } = data
- const isLocal = useType === 'local'
- const icons = Object.keys(data.icons).map(item => `${isLocal ? `${prefix}:` : ''}${item}`)
-
- fs.writeFileSync(
- path.join(output, 'icons.data.ts'),
- `export default ${isLocal ? JSON.stringify(icons) : JSON.stringify({ prefix, icons })}`,
- )
- prefixSet.push(prefix)
- }
- }
- await fs.emptyDir(path.join(process.cwd(), 'node_modules/.vite'))
- console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`)
- })
-}
-
-generateIcon()
diff --git a/build/vite/optimize.ts b/build/vite/optimize.ts
index 335b359..e40957c 100644
--- a/build/vite/optimize.ts
+++ b/build/vite/optimize.ts
@@ -22,7 +22,6 @@ const include = [
'echarts/renderers',
'@vueuse/core',
'@zxcvbn-ts/core',
- '@iconify/iconify',
'vue-json-pretty',
'ant-design-vue',
'ant-design-vue/es/style',
diff --git a/package.json b/package.json
index 9dc7ae7..238c530 100644
--- a/package.json
+++ b/package.json
@@ -32,13 +32,11 @@
"preview": "vite preview",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
- "prepare": "husky install",
- "gen:icon": "esno ./build/generate/icon/index.ts"
+ "prepare": "husky install"
},
"dependencies": {
"@ant-design/colors": "^7.0.2",
"@ant-design/icons-vue": "^7.0.1",
- "@iconify/iconify": "^3.1.1",
"@videojs-player/vue": "^1.0.0",
"@vue/runtime-core": "^3.3.8",
"@vueuse/core": "^10.6.1",
@@ -76,7 +74,6 @@
"@commitlint/cli": "^18.4.4",
"@commitlint/config-conventional": "^18.4.4",
"@iconify/json": "^2.2.164",
- "@purge-icons/generated": "^0.10.0",
"@types/codemirror": "^5.60.15",
"@types/crypto-js": "^4.2.1",
"@types/fs-extra": "^11.0.4",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 95481ee..57ed7dd 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -11,9 +11,6 @@ dependencies:
'@ant-design/icons-vue':
specifier: ^7.0.1
version: 7.0.1(vue@3.4.10)
- '@iconify/iconify':
- specifier: ^3.1.1
- version: 3.1.1
'@videojs-player/vue':
specifier: ^1.0.0
version: 1.0.0(@types/video.js@7.3.56)(video.js@7.21.5)(vue@3.4.10)
@@ -121,9 +118,6 @@ devDependencies:
'@iconify/json':
specifier: ^2.2.164
version: 2.2.168
- '@purge-icons/generated':
- specifier: ^0.10.0
- version: 0.10.0
'@types/codemirror':
specifier: ^5.60.15
version: 5.60.15
@@ -2051,6 +2045,7 @@ packages:
resolution: {integrity: sha512-1nemfyD/OJzh9ALepH7YfuuP8BdEB24Skhd8DXWh0hzcOxImbb1ZizSZkpCzAwSZSGcJFmscIBaBQu+yLyWaxQ==}
dependencies:
'@iconify/types': 2.0.0
+ dev: true
/@iconify/json@2.2.168:
resolution: {integrity: sha512-NuimrvW7/BfOK97Kx0YMWG8UMcqdfc0GZ0mZfewA90Qvl3+dchLmbyvNXnFraUFrrS8Luie3P6R0+3gHE9DnIA==}
@@ -2061,6 +2056,7 @@ packages:
/@iconify/types@2.0.0:
resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==}
+ dev: true
/@iconify/utils@2.1.14:
resolution: {integrity: sha512-9pKIntkbLbjVVFxH32td21Am3AGGJfyI2KY2d8yDQxkZe4BBZtufJI8NgcamFn8B5QKLU9ai2VMo8OEov8jAtw==}
diff --git a/src/components/Application/index.ts b/src/components/Application/index.ts
index d7ffa26..2c6090d 100644
--- a/src/components/Application/index.ts
+++ b/src/components/Application/index.ts
@@ -1,7 +1,6 @@
import appLogo from './src/AppLogo.vue'
import appProvider from './src/AppProvider.vue'
import appSearch from './src/search/AppSearch.vue'
-import appSizePicker from './src/AppSizePicker.vue'
import appLocalePicker from './src/AppLocalePicker.vue'
import appDarkModeToggle from './src/AppDarkModeToggle.vue'
import { withInstall } from '@/utils'
@@ -11,6 +10,5 @@ export { useAppProviderContext } from './src/useAppContext'
export const AppLogo = withInstall(appLogo)
export const AppProvider = withInstall(appProvider)
export const AppSearch = withInstall(appSearch)
-export const AppSizePicker = withInstall(appSizePicker)
export const AppLocalePicker = withInstall(appLocalePicker)
export const AppDarkModeToggle = withInstall(appDarkModeToggle)
diff --git a/src/components/Application/src/AppLocalePicker.vue b/src/components/Application/src/AppLocalePicker.vue
index d9ae5e6..401c60c 100644
--- a/src/components/Application/src/AppLocalePicker.vue
+++ b/src/components/Application/src/AppLocalePicker.vue
@@ -3,7 +3,6 @@ import { computed, ref, unref, watchEffect } from 'vue'
import type { LocaleType } from '@/types/config'
import type { DropMenu } from '@/components/Dropdown'
import { Dropdown } from '@/components/Dropdown'
-import { Icon } from '@/components/Icon'
import { useLocale } from '@/locales/useLocale'
import { localeList } from '@/settings/localeSetting'
@@ -58,7 +57,7 @@ function handleMenuEvent(menu: DropMenu) {
@menu-event="handleMenuEvent"
>
-