Skip to content

Commit

Permalink
增加运行时信息
Browse files Browse the repository at this point in the history
  • Loading branch information
hooray committed Jan 13, 2024
1 parent fb540eb commit 738c74d
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@
"@vitejs/plugin-vue": "^5.0.3",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"autoprefixer": "^10.4.16",
"boxen": "^7.1.1",
"eslint": "^8.56.0",
"esno": "^4.0.0",
"fs-extra": "^11.2.0",
"http-server": "^14.1.1",
"inquirer": "^9.2.12",
"lint-staged": "^15.2.0",
"npm-run-all": "^4.1.5",
"picocolors": "^1.0.0",
"plop": "^4.0.1",
"sass": "^1.69.7",
"simple-git-hooks": "^2.9.0",
Expand Down
48 changes: 48 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions vite/plugins/app-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import boxen from 'boxen'
import picocolors from 'picocolors'
import type { Plugin } from 'vite'

export default function appInfo(): Plugin {
return {
name: 'appInfo',
apply: 'serve',
async buildStart() {
const { bold, green, cyan, bgGreen, underline } = picocolors
// eslint-disable-next-line no-console
console.log(
boxen(
`${bold(green(`由 ${bgGreen('Fantastic-admin')} 驱动`))}\n\n${underline('https://fantastic-admin.gitee.io')}\n\n当前使用:${cyan('基础版')}`,
{
padding: 1,
margin: 1,
borderStyle: 'double',
textAlignment: 'center',
},
),
)
},
}
}
2 changes: 2 additions & 0 deletions vite/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { PluginOption } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import vueLegacy from '@vitejs/plugin-legacy'
import appInfo from './app-info'

import createInspector from './inspector'
import createAutoImport from './auto-import'
Expand All @@ -17,6 +18,7 @@ import createBanner from './banner'

export default function createVitePlugins(viteEnv, isBuild = false) {
const vitePlugins: (PluginOption | PluginOption[])[] = [
appInfo(),
vue(),
vueJsx(),
vueLegacy({
Expand Down

0 comments on commit 738c74d

Please sign in to comment.