-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdoczrc.js
89 lines (83 loc) · 1.97 KB
/
doczrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable global-require */
import url from 'url';
import packageInfo from './package.json';
import proxyPlugin from './scripts/proxy-plugin';
/**
* 获取基本URL
*/
function getBaseUrl() {
if (process.env.NODE_ENV === 'production') {
const { name, homepage } = packageInfo;
if (homepage) {
return url.parse(homepage).path;
}
if (name.startsWith('@')) {
return name.substr(name.indexOf('/'));
}
return `/${name}`;
}
return '/';
}
export default {
title: 'editable-data-table',
codeSandbox: false,
typescript: true,
files: ['**/*.mdx'],
public: './docs/assets',
menu: [
'开始',
'单元格编辑器',
'组件API',
'校验',
'样式定制',
'分页加载数据',
{
name: '分页展示数据',
menu: [
'开始',
'完整示例',
'加载并展示数据',
'新增、编辑与删除',
'校验',
'查询',
'选择数据行',
],
},
],
wrapper: 'docs/Wrapper.tsx',
indexHtml: 'docs/index.html',
base: getBaseUrl(),
plugins: [proxyPlugin()],
onCreateWebpackChain: (config) => {
// 配置webpack的方式:[webpack-chain](https://github.com/neutrinojs/webpack-chain)
config.module
.rule('css')
.test(/\.css$/)
.use('style-loader')
.loader('style-loader')
.end()
.use('css-loader')
.loader('css-loader')
.options({
importLoaders: 1,
})
.end()
.use('postcss-loader')
.loader('postcss-loader')
.options({
plugins: (loader) => [
require('postcss-import')({ root: loader.resourcePath }),
require('postcss-preset-env')({
browsers: ['last 2 versions', 'not dead', 'IE 10', 'IE 11'],
}),
],
})
.end();
config
.plugin('ghpages')
.use(require('webpack-docz-ghpages-plugin'))
.end();
return config;
},
};