config.js 3.06 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
  scripts: [{ src: '/JessibucaVideo/jessibuca.js', defer: true }],
邓晓峰's avatar
邓晓峰 committed
84 85 86 87
  menus: {
    '/components': [
      {
        title: '布局',
涂茜's avatar
涂茜 committed
88
        children: ['Empty'],
邓晓峰's avatar
邓晓峰 committed
89 90 91
      },
      {
        title: '通用',
李纪文's avatar
李纪文 committed
92
        children: [
涂茜's avatar
涂茜 committed
93
          'BasicChart',
94
          'BasicTable',
李纪文's avatar
李纪文 committed
95 96 97 98 99 100
          'BasicTools',
          'ImageSelect',
          'QuotaSelect',
          'TimeRangePicker',
          'MqttView',
          'ExportExcel',
101
          'LoadBox',
秦文海's avatar
秦文海 committed
102
          'TipTool',
周宏民's avatar
周宏民 committed
103
          'RichText',
李纪文's avatar
李纪文 committed
104 105 106
          'DatePickerCustom',
          'SelectCustom',
          'TreeCustom',
107
          'AlarmScrollAssembly',
周宏民's avatar
周宏民 committed
108
          'DataCarousel',
程恺文's avatar
程恺文 committed
109
          'VmsVideo',
110
          'VideoSliderModal',
李纪文's avatar
李纪文 committed
111
        ],
邓晓峰's avatar
邓晓峰 committed
112 113 114
      },
      {
        title: '数据录入',
115
        children: ['ParseForm'],
邓晓峰's avatar
邓晓峰 committed
116 117 118
      },
      {
        title: '数据展示',
119
        children: ['DeviceTree', 'RealTimeInfo', 'HistoryInfo'],
邓晓峰's avatar
邓晓峰 committed
120 121
      },
    ],
122 123
    '/extend-components': [
      {
涂茜's avatar
涂茜 committed
124
        title: '业务数据展示',
涂茜's avatar
涂茜 committed
125 126
        children: [
          'EC_DeviceTree',
李纪文's avatar
李纪文 committed
127
          'EC_DeviceTreeGroup',
涂茜's avatar
涂茜 committed
128 129 130 131
          'EC_QuotaSelect',
          'EC_HistoryInfo',
          'EC_RealTimeInfo',
          'EC_ConfigurationView',
132
          'EC_HistoryView',
涂茜's avatar
涂茜 committed
133
        ],
134 135
      },
    ],
邓晓峰's avatar
邓晓峰 committed
136
  },
崔佳豪's avatar
崔佳豪 committed
137
  proxy,
138 139 140
  define: {
    DUMI_TYPE: 'dumi',
  },
邓晓峰's avatar
邓晓峰 committed
141
};