Skip to content

Commit

Permalink
chore: 启动项目时,控制台增加应用信息打印
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed May 11, 2024
1 parent 1421412 commit 52e7682
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 3 deletions.
25 changes: 25 additions & 0 deletions config/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('ContiNew Admin v3.1.0-SNAPSHOT')}`))}\n${cyan('在线文档:')}${underline('https://continew.top')}\n${cyan('持续迭代优化的前后端分离中后台管理系统框架。')}`,
{
padding: 1,
margin: 1,
borderStyle: 'double',
textAlignment: 'center'
}
)
)
}
}
}
3 changes: 2 additions & 1 deletion config/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import type { PluginOption } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'

import appInfo from './app-info'
import createDevtools from './devtools'
import createAutoImport from './auto-import'
import createComponents from './components'
import createSvgIcon from './svg-icon'
import createMock from './mock'

export default function createVitePlugins(viteEnv, isBuild = false) {
const vitePlugins: (PluginOption | PluginOption[])[] = [vue(), vueJsx()]
const vitePlugins: (PluginOption | PluginOption[])[] = [appInfo(), vue(), vueJsx()]
vitePlugins.push(createDevtools(viteEnv))
vitePlugins.push(createAutoImport())
vitePlugins.push(createComponents())
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/tsconfig": "^0.1.3",
"boxen": "^7.1.1",
"eslint": "^9.0.0",
"less": "^4.1.3",
"less-loader": "^11.0.0",
"lint-staged": "^15.2.2",
"picocolors": "^1.0.0",
"sass": "^1.62.1",
"sass-loader": "^13.2.2",
"simple-git-hooks": "^2.11.1",
Expand All @@ -80,7 +82,7 @@
"vue-tsc": "^2.0.6"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
"pre-commit": "npm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
Expand Down
86 changes: 85 additions & 1 deletion pnpm-lock.yaml

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

0 comments on commit 52e7682

Please sign in to comment.