forked from 24jieqi/react-native-xiaoshu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.umirc.ts
88 lines (87 loc) · 2.11 KB
/
.umirc.ts
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
import type WebpackChain from 'webpack-chain'
import { defineConfig } from 'dumi'
import TOKENS from '@fruits-chain/design-tokens-bailu'
import p from './package.json'
const pkgJSON = require('./package.json')
const CopyPlugin = require('copy-webpack-plugin')
const navs = [
{
title: '指南',
path: '/guide',
},
{
title: '组件',
path: '/component',
},
{
title: '案例',
path: '/case',
},
{
title: `GitHub v${p.version}`,
path: 'https://github.com/hjfruit/react-native-xiaoshu',
},
{
title: '更新日志',
path: 'https://github.com/hjfruit/react-native-xiaoshu/releases',
},
{
title: '下载 Android 预览 APK',
path: `https://www.onlyling.com/apks/${p.name}-v${p.version}.apk`,
},
]
// 生成版本json文件
const CopyWebpackPlugin = new CopyPlugin({
patterns: [
{
from: './package.json',
to: './app-info.json',
transform: () => {
return JSON.stringify(
{
navs,
appName: pkgJSON.name,
},
null,
2,
)
},
},
],
})
const repo = process.env.PUBLIC_PATH || ''
export default defineConfig({
chainWebpack(memo: WebpackChain) {
memo.plugins.delete('copy')
if (process.env.NODE_ENV !== 'development') {
memo.plugin('copy-webpack-plugin').use(CopyWebpackPlugin)
}
},
title: '小暑',
mode: 'site',
outputPath: 'docs-dist',
hash: true,
favicon:
'https://raw.githubusercontent.com/hjfruit/react-native-xiaoshu/main/logo-xiaoshu.svg',
logo: 'https://raw.githubusercontent.com/hjfruit/react-native-xiaoshu/main/logo-xiaoshu.svg',
base: `/${repo}`,
publicPath: `/${repo}`,
exportStatic: {}, // 将所有路由输出为 HTML 目录结构,以免刷新页面时 404
apiParser: {
propFilter: {
// 是否忽略从 node_modules 继承的属性,默认值为 false
skipNodeModules: true,
},
},
navs,
resolve: {
includes: ['docs', 'src'],
},
locales: [['zh-CN', '中文']],
styles: [],
theme: {
'@c-primary': TOKENS.brand_6,
'@c-text': TOKENS.gray_8,
'@c-secondary': TOKENS.gray_6,
},
})