diff --git a/.npmrc b/.npmrc index dfc2d68..567bfcc 100644 --- a/.npmrc +++ b/.npmrc @@ -2,3 +2,4 @@ registry=https://registry.npmmirror.com/ shamefully-hoist=true ignore-workspace-root-check=true link-workspace-packages=true +enable-pre-post-scripts=true diff --git a/build/plugins/unplugin.ts b/build/plugins/unplugin.ts index 50173c4..8ad80ee 100644 --- a/build/plugins/unplugin.ts +++ b/build/plugins/unplugin.ts @@ -4,7 +4,7 @@ import type { PluginOption } from 'vite'; import Icons from 'unplugin-icons/vite'; import IconsResolver from 'unplugin-icons/resolver'; import Components from 'unplugin-vue-components/vite'; -// import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'; +import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'; import { FileSystemIconLoader } from 'unplugin-icons/loaders'; import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'; @@ -31,7 +31,7 @@ export function setupUnplugin(viteEnv: Env.ImportMeta) { dts: 'src/typings/components.d.ts', types: [{ from: 'vue-router', names: ['RouterLink', 'RouterView'] }], resolvers: [ - // ElementPlusResolver(), // auto import Element Plus components。 full import to see /src/plugins/ui.ts + ElementPlusResolver(), // auto import Element Plus components。 full import to see /src/plugins/ui.ts IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFIX }) ] }), diff --git a/package.json b/package.json index c7ff25c..495ed12 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "dev:prod": "vite --mode prod", "gen-route": "sa gen-route", "lint": "eslint . --fix", + "postbuild": "sa print-soybean", "prepare": "simple-git-hooks", "preview": "vite preview", "release": "sa release", diff --git a/packages/scripts/src/commands/index.ts b/packages/scripts/src/commands/index.ts index db4fc15..c0ec9d6 100644 --- a/packages/scripts/src/commands/index.ts +++ b/packages/scripts/src/commands/index.ts @@ -4,3 +4,4 @@ export * from './update-pkg'; export * from './changelog'; export * from './release'; export * from './router'; +export * from './print-soybean'; diff --git a/packages/scripts/src/commands/print-soybean.ts b/packages/scripts/src/commands/print-soybean.ts new file mode 100644 index 0000000..1a09c42 --- /dev/null +++ b/packages/scripts/src/commands/print-soybean.ts @@ -0,0 +1,16 @@ +const SOYBEANJS = + '2020205f5f5f5f5f202020205f5f5f5f2020205f5f20202020205f5f20205f5f5f5f202020205f5f5f5f5f5f20202020202020202020202020205f2020205f20202020202020205f202020205f5f5f5f5f200a20202f205f5f5f5f7c20202f205f5f205c20205c205c2020202f202f207c20205f205c20207c20205f5f5f5f7c20202020202f5c20202020207c205c207c207c2020202020207c207c20202f205f5f5f5f7c0a207c20285f5f5f2020207c207c20207c207c20205c205c5f2f202f20207c207c5f29207c207c207c5f5f202020202020202f20205c202020207c20205c7c207c2020202020207c207c207c20285f5f5f20200a20205c5f5f5f205c20207c207c20207c207c2020205c2020202f2020207c20205f203c20207c20205f5f7c20202020202f202f5c205c2020207c202e2060207c20205f2020207c207c20205c5f5f5f205c200a20205f5f5f5f29207c207c207c5f5f7c207c202020207c207c202020207c207c5f29207c207c207c5f5f5f5f2020202f205f5f5f5f205c20207c207c5c20207c207c207c5f5f7c207c20205f5f5f5f29207c0a207c5f5f5f5f5f2f2020205c5f5f5f5f2f20202020207c5f7c202020207c5f5f5f5f2f20207c5f5f5f5f5f5f7c202f5f2f202020205c5f5c207c5f7c205c5f7c20205c5f5f5f5f2f20207c5f5f5f5f5f2f20'; + +function decode16(str: string): string { + const arr: string[] = []; + for (let i = 0; i < str.length; i += 2) { + const asciiCode = Number.parseInt(str.slice(i, i + 2), 16); + const charValue = String.fromCharCode(asciiCode); + arr.push(charValue); + } + return arr.join(''); +} + +export async function printSoybean() { + console.log(decode16(SOYBEANJS)); +} diff --git a/packages/scripts/src/index.ts b/packages/scripts/src/index.ts index 34367d7..faad89b 100755 --- a/packages/scripts/src/index.ts +++ b/packages/scripts/src/index.ts @@ -1,11 +1,28 @@ import cac from 'cac'; import { blue, lightGreen } from 'kolorist'; import { version } from '../package.json'; -import { cleanup, genChangelog, generateRoute, gitCommit, gitCommitVerify, release, updatePkg } from './commands'; +import { + cleanup, + genChangelog, + generateRoute, + gitCommit, + gitCommitVerify, + printSoybean, + release, + updatePkg +} from './commands'; import { loadCliOptions } from './config'; import type { Lang } from './locales'; -type Command = 'cleanup' | 'update-pkg' | 'git-commit' | 'git-commit-verify' | 'changelog' | 'release' | 'gen-route'; +type Command = + | 'cleanup' + | 'update-pkg' + | 'git-commit' + | 'git-commit-verify' + | 'changelog' + | 'release' + | 'gen-route' + | 'print-soybean'; type CommandAction = (args?: A) => Promise | void; @@ -96,6 +113,12 @@ export async function setupCli() { action: async () => { await generateRoute(); } + }, + 'print-soybean': { + desc: 'print soybean', + action: async () => { + await printSoybean(); + } } }; diff --git a/src/typings/components.d.ts b/src/typings/components.d.ts index c452985..9b09017 100644 --- a/src/typings/components.d.ts +++ b/src/typings/components.d.ts @@ -23,8 +23,6 @@ declare module 'vue' { ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElColorPicker: typeof import('element-plus/es')['ElColorPicker'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] - ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] - ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] ElDialog: typeof import('element-plus/es')['ElDialog'] ElDivider: typeof import('element-plus/es')['ElDivider'] ElDrawer: typeof import('element-plus/es')['ElDrawer'] @@ -49,16 +47,12 @@ declare module 'vue' { ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSpace: typeof import('element-plus/es')['ElSpace'] - ElStatistic: typeof import('element-plus/es')['ElStatistic'] ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabs: typeof import('element-plus/es')['ElTabs'] - ElTag: typeof import('element-plus/es')['ElTag'] - ElTimeline: typeof import('element-plus/es')['ElTimeline'] - ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTree: typeof import('element-plus/es')['ElTree'] ElWatermark: typeof import('element-plus/es')['ElWatermark']