app-info.ts 999 B

1234567891011121314151617181920212223242526272829303132
  1. import boxen from 'boxen';
  2. import picocolors from 'picocolors';
  3. import { copyFileSync } from 'fs';
  4. import { resolve } from 'path';
  5. import type { Plugin } from 'vite';
  6. export default function appInfo(): Plugin {
  7. return {
  8. name: 'appInfo',
  9. apply: 'serve',
  10. async buildStart() {
  11. const { bold, green, cyan, bgGreen, underline } = picocolors;
  12. console.log(
  13. boxen(
  14. `${bold(green(`由 ${bgGreen(' ST-ADMIN ')} 驱动`))}\n\n${cyan('在线文档:')}${underline('http://192.168.6.181:6066/')}\n${cyan('持续迭代优化的前后端分离中后台管理系统框架。')}`,
  15. {
  16. padding: 0.5,
  17. borderColor: 'cyan',
  18. borderStyle: 'round'
  19. }
  20. )
  21. );
  22. // 更新配置
  23. if (process.env.APP_ENV) {
  24. copyFileSync(
  25. resolve(process.cwd(), `build/conf/admin-config-${process.env.APP_ENV}.js`),
  26. resolve(process.cwd(), `public/admin-config.js`)
  27. );
  28. }
  29. }
  30. };
  31. }