config.js 2.83 KB
Newer Older
dengxiaofeng's avatar
dengxiaofeng committed
1 2 3
import chalk from 'chalk';
import { readdirSync } from 'fs';
import { join } from 'path';
崔佳豪's avatar
崔佳豪 committed
4
import proxy from './proxy';
dengxiaofeng's avatar
dengxiaofeng committed
5 6

const headPkgList = [];
7 8 9

const pkgList = ['base-components', 'extend-components']
  .map((dir) => {
崔佳豪's avatar
崔佳豪 committed
10
    const list = readdirSync(join(__dirname, '../packages', dir)).map((item) => item + `!${dir}`);
11 12 13
    return list.filter((pkg) => pkg.charAt(0) !== '.' && !headPkgList.includes(pkg));
  })
  .flat();
dengxiaofeng's avatar
dengxiaofeng committed
14 15

const alias = pkgList.reduce((pre, pkg) => {
16
  const path = pkg.split('!');
崔佳豪's avatar
崔佳豪 committed
17 18 19 20 21 22 23
  pre[`@wisdom-components/pro-${path[0]}`] = join(
    __dirname,
    '../packages',
    path[1],
    path[0],
    'src',
  );
dengxiaofeng's avatar
dengxiaofeng committed
24 25 26 27 28 29 30 31
  return {
    ...pre,
  };
}, {});

console.log(`🌼 alias list \n${chalk.blue(Object.keys(alias).join('\n'))}`);

const tailPkgList = pkgList
32 33 34 35 36 37 38
  .map((pkg) => {
    const path = pkg.split('!');
    return [
      join('packages', path[1], path[0], 'src'),
      join('packages', path[0], 'src', 'components'),
    ];
  })
dengxiaofeng's avatar
dengxiaofeng committed
39 40 41
  .reduce((acc, val) => acc.concat(val), []);

export default {
叶飞's avatar
叶飞 committed
42
  title: 'panda-components',
dengxiaofeng's avatar
dengxiaofeng committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
  mode: 'site',
  logo: 'https://panda-water.cn/web4/assets/images/logo/单独图案-蓝绿色.svg',
  extraBabelPlugins: [
    [
      'import',
      {
        libraryName: 'antd',
        libraryDirectory: 'es',
        style: true,
      },
    ],
  ],
  alias,
  resolve: { includes: [...tailPkgList, 'docs'] },
  navs: [
    null,
    {
      title: 'Gitlab',
      path: 'https://g.civnet.cn:8443/test/winsdom-components',
    },
  ],
  hash: true,
邓晓峰's avatar
邓晓峰 committed
65 66 67
  ssr: {
    devServerRender: false,
  },
dengxiaofeng's avatar
dengxiaofeng committed
68 69 70 71 72 73 74
  targets: {
    chrome: 80,
    firefox: false,
    safari: false,
    edge: false,
    ios: false,
  },
邓晓峰's avatar
邓晓峰 committed
75
  dynamicImport: {},
邓晓峰's avatar
邓晓峰 committed
76 77 78
  theme: {
    '@s-site-menu-width': '258px',
  },
dengxiaofeng's avatar
dengxiaofeng committed
79 80 81 82
  links:
    process.env.NODE_ENV === 'development'
      ? ['https://gw.alipayobjects.com/os/lib/antd/4.6.6/dist/antd.css']
      : [],
邓晓峰's avatar
邓晓峰 committed
83 84 85 86
  menus: {
    '/components': [
      {
        title: '布局',
涂茜's avatar
涂茜 committed
87
        children: ['Empty'],
邓晓峰's avatar
邓晓峰 committed
88 89 90
      },
      {
        title: '通用',
李纪文's avatar
李纪文 committed
91
        children: [
涂茜's avatar
涂茜 committed
92
          'BasicChart',
93
          'BasicTable',
李纪文's avatar
李纪文 committed
94 95 96 97 98 99
          'BasicTools',
          'ImageSelect',
          'QuotaSelect',
          'TimeRangePicker',
          'MqttView',
          'ExportExcel',
100
          'LoadBox',
秦文海's avatar
秦文海 committed
101
          'TipTool',
周宏民's avatar
周宏民 committed
102
          'RichText',
李纪文's avatar
李纪文 committed
103 104 105
          'DatePickerCustom',
          'SelectCustom',
          'TreeCustom',
李纪文's avatar
李纪文 committed
106
        ],
邓晓峰's avatar
邓晓峰 committed
107 108 109
      },
      {
        title: '数据录入',
110
        children: ['ParseForm'],
邓晓峰's avatar
邓晓峰 committed
111 112 113
      },
      {
        title: '数据展示',
114
        children: ['DeviceTree', 'RealTimeInfo', 'HistoryInfo'],
邓晓峰's avatar
邓晓峰 committed
115 116
      },
    ],
117 118
    '/extend-components': [
      {
涂茜's avatar
涂茜 committed
119
        title: '业务数据展示',
涂茜's avatar
涂茜 committed
120 121 122 123 124 125 126
        children: [
          'EC_DeviceTree',
          'EC_QuotaSelect',
          'EC_HistoryInfo',
          'EC_RealTimeInfo',
          'EC_ConfigurationView',
        ],
127 128
      },
    ],
邓晓峰's avatar
邓晓峰 committed
129
  },
崔佳豪's avatar
崔佳豪 committed
130
  proxy,
131 132 133
  define: {
    DUMI_TYPE: 'dumi',
  },
邓晓峰's avatar
邓晓峰 committed
134
};