create-umi 4.0.0-beta.18 → 4.0.0-canary-20240513.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/bin/create-umi.js +1 -0
- package/dist/cli.js +20 -28
- package/dist/index.d.ts +42 -3
- package/dist/index.js +286 -96
- package/dist/template.d.ts +12 -0
- package/dist/template.js +113 -0
- package/package.json +13 -12
- package/templates/app/.gitignore.tpl +2 -3
- package/templates/app/.npmrc.tpl +1 -0
- package/templates/app/.umirc.ts.tpl +9 -3
- package/templates/app/package.json.tpl +6 -4
- package/templates/app/{layouts → src/layouts}/index.tsx.tpl +0 -1
- package/templates/app/{pages → src/pages}/docs.tsx +3 -3
- package/templates/app/{pages → src/pages}/index.tsx +2 -2
- package/templates/app/tsconfig.json.tpl +3 -0
- package/templates/app/typings.d.ts +1 -3
- package/templates/max/.eslintrc.js.tpl +3 -0
- package/templates/max/.gitignore.tpl +13 -0
- package/templates/max/.husky/commit-msg +1 -0
- package/templates/max/.husky/pre-commit +1 -0
- package/templates/max/.lintstagedrc.tpl +17 -0
- package/templates/max/.npmrc.tpl +2 -0
- package/templates/max/.prettierignore.tpl +3 -0
- package/templates/max/.prettierrc.tpl +8 -0
- package/templates/max/.stylelintrc.js.tpl +3 -0
- package/templates/max/.umirc.ts.tpl +35 -0
- package/templates/max/README.md +3 -0
- package/templates/max/mock/userAPI.ts +20 -0
- package/templates/max/package.json.tpl +29 -0
- package/templates/max/src/access.ts +10 -0
- package/templates/max/src/app.ts +16 -0
- package/templates/max/src/assets/.gitkeep +0 -0
- package/templates/max/src/components/Guide/Guide.less +4 -0
- package/templates/max/src/components/Guide/Guide.tsx +23 -0
- package/templates/max/src/components/Guide/index.ts +2 -0
- package/templates/max/src/constants/index.ts +1 -0
- package/templates/max/src/models/global.ts +13 -0
- package/templates/max/src/pages/Access/index.tsx +21 -0
- package/templates/max/src/pages/Home/index.less +3 -0
- package/templates/max/src/pages/Home/index.tsx +18 -0
- package/templates/max/src/pages/Table/components/CreateForm.tsx +26 -0
- package/templates/max/src/pages/Table/components/UpdateForm.tsx +138 -0
- package/templates/max/src/pages/Table/index.tsx +270 -0
- package/templates/max/src/services/demo/UserController.ts +96 -0
- package/templates/max/src/services/demo/index.ts +7 -0
- package/templates/max/src/services/demo/typings.d.ts +68 -0
- package/templates/max/src/utils/format.ts +4 -0
- package/templates/max/tsconfig.json +3 -0
- package/templates/max/typings.d.ts +1 -0
- package/templates/plugin/.fatherrc.ts +5 -5
- package/templates/plugin/.gitignore.tpl +1 -1
- package/templates/plugin/.npmrc.tpl +1 -0
- package/templates/plugin/README.md.tpl +5 -14
- package/templates/plugin/package.json.tpl +12 -10
- package/templates/plugin/src/index.ts.tpl +2 -2
- package/templates/plugin/tsconfig.json +20 -0
- package/templates/vue-app/.gitignore.tpl +13 -0
- package/templates/vue-app/.npmrc.tpl +2 -0
- package/templates/vue-app/.umirc.ts.tpl +6 -0
- package/templates/vue-app/package.json.tpl +18 -0
- package/templates/vue-app/src/assets/yay.jpg +0 -0
- package/templates/vue-app/src/layouts/index.vue +28 -0
- package/templates/vue-app/src/pages/docs.vue +5 -0
- package/templates/vue-app/src/pages/index.vue +9 -0
- package/templates/vue-app/tsconfig.json.tpl +3 -0
- package/templates/vue-app/typings.d.ts +1 -0
- package/templates/app/tsconfig.json +0 -18
- /package/templates/app/{assets → src/assets}/yay.jpg +0 -0
- /package/templates/app/{layouts → src/layouts}/index.less +0 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import services from '@/services/demo';
|
|
2
|
+
import {
|
|
3
|
+
ActionType,
|
|
4
|
+
FooterToolbar,
|
|
5
|
+
PageContainer,
|
|
6
|
+
ProDescriptions,
|
|
7
|
+
ProDescriptionsItemProps,
|
|
8
|
+
ProTable,
|
|
9
|
+
} from '@ant-design/pro-components';
|
|
10
|
+
import { Button, Divider, Drawer, message } from 'antd';
|
|
11
|
+
import React, { useRef, useState } from 'react';
|
|
12
|
+
import CreateForm from './components/CreateForm';
|
|
13
|
+
import UpdateForm, { FormValueType } from './components/UpdateForm';
|
|
14
|
+
|
|
15
|
+
const { addUser, queryUserList, deleteUser, modifyUser } =
|
|
16
|
+
services.UserController;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 添加节点
|
|
20
|
+
* @param fields
|
|
21
|
+
*/
|
|
22
|
+
const handleAdd = async (fields: API.UserInfo) => {
|
|
23
|
+
const hide = message.loading('正在添加');
|
|
24
|
+
try {
|
|
25
|
+
await addUser({ ...fields });
|
|
26
|
+
hide();
|
|
27
|
+
message.success('添加成功');
|
|
28
|
+
return true;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
hide();
|
|
31
|
+
message.error('添加失败请重试!');
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 更新节点
|
|
38
|
+
* @param fields
|
|
39
|
+
*/
|
|
40
|
+
const handleUpdate = async (fields: FormValueType) => {
|
|
41
|
+
const hide = message.loading('正在配置');
|
|
42
|
+
try {
|
|
43
|
+
await modifyUser(
|
|
44
|
+
{
|
|
45
|
+
userId: fields.id || '',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: fields.name || '',
|
|
49
|
+
nickName: fields.nickName || '',
|
|
50
|
+
email: fields.email || '',
|
|
51
|
+
},
|
|
52
|
+
);
|
|
53
|
+
hide();
|
|
54
|
+
|
|
55
|
+
message.success('配置成功');
|
|
56
|
+
return true;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
hide();
|
|
59
|
+
message.error('配置失败请重试!');
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 删除节点
|
|
66
|
+
* @param selectedRows
|
|
67
|
+
*/
|
|
68
|
+
const handleRemove = async (selectedRows: API.UserInfo[]) => {
|
|
69
|
+
const hide = message.loading('正在删除');
|
|
70
|
+
if (!selectedRows) return true;
|
|
71
|
+
try {
|
|
72
|
+
await deleteUser({
|
|
73
|
+
userId: selectedRows.find((row) => row.id)?.id || '',
|
|
74
|
+
});
|
|
75
|
+
hide();
|
|
76
|
+
message.success('删除成功,即将刷新');
|
|
77
|
+
return true;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
hide();
|
|
80
|
+
message.error('删除失败,请重试');
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const TableList: React.FC<unknown> = () => {
|
|
86
|
+
const [createModalVisible, handleModalVisible] = useState<boolean>(false);
|
|
87
|
+
const [updateModalVisible, handleUpdateModalVisible] =
|
|
88
|
+
useState<boolean>(false);
|
|
89
|
+
const [stepFormValues, setStepFormValues] = useState({});
|
|
90
|
+
const actionRef = useRef<ActionType>();
|
|
91
|
+
const [row, setRow] = useState<API.UserInfo>();
|
|
92
|
+
const [selectedRowsState, setSelectedRows] = useState<API.UserInfo[]>([]);
|
|
93
|
+
const columns: ProDescriptionsItemProps<API.UserInfo>[] = [
|
|
94
|
+
{
|
|
95
|
+
title: '名称',
|
|
96
|
+
dataIndex: 'name',
|
|
97
|
+
tip: '名称是唯一的 key',
|
|
98
|
+
formItemProps: {
|
|
99
|
+
rules: [
|
|
100
|
+
{
|
|
101
|
+
required: true,
|
|
102
|
+
message: '名称为必填项',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: '昵称',
|
|
109
|
+
dataIndex: 'nickName',
|
|
110
|
+
valueType: 'text',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
title: '性别',
|
|
114
|
+
dataIndex: 'gender',
|
|
115
|
+
hideInForm: true,
|
|
116
|
+
valueEnum: {
|
|
117
|
+
0: { text: '男', status: 'MALE' },
|
|
118
|
+
1: { text: '女', status: 'FEMALE' },
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
title: '操作',
|
|
123
|
+
dataIndex: 'option',
|
|
124
|
+
valueType: 'option',
|
|
125
|
+
render: (_, record) => (
|
|
126
|
+
<>
|
|
127
|
+
<a
|
|
128
|
+
onClick={() => {
|
|
129
|
+
handleUpdateModalVisible(true);
|
|
130
|
+
setStepFormValues(record);
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
配置
|
|
134
|
+
</a>
|
|
135
|
+
<Divider type="vertical" />
|
|
136
|
+
<a href="">订阅警报</a>
|
|
137
|
+
</>
|
|
138
|
+
),
|
|
139
|
+
},
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<PageContainer
|
|
144
|
+
header={{
|
|
145
|
+
title: 'CRUD 示例',
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
<ProTable<API.UserInfo>
|
|
149
|
+
headerTitle="查询表格"
|
|
150
|
+
actionRef={actionRef}
|
|
151
|
+
rowKey="id"
|
|
152
|
+
search={{
|
|
153
|
+
labelWidth: 120,
|
|
154
|
+
}}
|
|
155
|
+
toolBarRender={() => [
|
|
156
|
+
<Button
|
|
157
|
+
key="1"
|
|
158
|
+
type="primary"
|
|
159
|
+
onClick={() => handleModalVisible(true)}
|
|
160
|
+
>
|
|
161
|
+
新建
|
|
162
|
+
</Button>,
|
|
163
|
+
]}
|
|
164
|
+
request={async (params, sorter, filter) => {
|
|
165
|
+
const { data, success } = await queryUserList({
|
|
166
|
+
...params,
|
|
167
|
+
// FIXME: remove @ts-ignore
|
|
168
|
+
// @ts-ignore
|
|
169
|
+
sorter,
|
|
170
|
+
filter,
|
|
171
|
+
});
|
|
172
|
+
return {
|
|
173
|
+
data: data?.list || [],
|
|
174
|
+
success,
|
|
175
|
+
};
|
|
176
|
+
}}
|
|
177
|
+
columns={columns}
|
|
178
|
+
rowSelection={{
|
|
179
|
+
onChange: (_, selectedRows) => setSelectedRows(selectedRows),
|
|
180
|
+
}}
|
|
181
|
+
/>
|
|
182
|
+
{selectedRowsState?.length > 0 && (
|
|
183
|
+
<FooterToolbar
|
|
184
|
+
extra={
|
|
185
|
+
<div>
|
|
186
|
+
已选择{' '}
|
|
187
|
+
<a style={{ fontWeight: 600 }}>{selectedRowsState.length}</a>{' '}
|
|
188
|
+
项
|
|
189
|
+
</div>
|
|
190
|
+
}
|
|
191
|
+
>
|
|
192
|
+
<Button
|
|
193
|
+
onClick={async () => {
|
|
194
|
+
await handleRemove(selectedRowsState);
|
|
195
|
+
setSelectedRows([]);
|
|
196
|
+
actionRef.current?.reloadAndRest?.();
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
批量删除
|
|
200
|
+
</Button>
|
|
201
|
+
<Button type="primary">批量审批</Button>
|
|
202
|
+
</FooterToolbar>
|
|
203
|
+
)}
|
|
204
|
+
<CreateForm
|
|
205
|
+
onCancel={() => handleModalVisible(false)}
|
|
206
|
+
modalVisible={createModalVisible}
|
|
207
|
+
>
|
|
208
|
+
<ProTable<API.UserInfo, API.UserInfo>
|
|
209
|
+
onSubmit={async (value) => {
|
|
210
|
+
const success = await handleAdd(value);
|
|
211
|
+
if (success) {
|
|
212
|
+
handleModalVisible(false);
|
|
213
|
+
if (actionRef.current) {
|
|
214
|
+
actionRef.current.reload();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}}
|
|
218
|
+
rowKey="id"
|
|
219
|
+
type="form"
|
|
220
|
+
columns={columns}
|
|
221
|
+
/>
|
|
222
|
+
</CreateForm>
|
|
223
|
+
{stepFormValues && Object.keys(stepFormValues).length ? (
|
|
224
|
+
<UpdateForm
|
|
225
|
+
onSubmit={async (value) => {
|
|
226
|
+
const success = await handleUpdate(value);
|
|
227
|
+
if (success) {
|
|
228
|
+
handleUpdateModalVisible(false);
|
|
229
|
+
setStepFormValues({});
|
|
230
|
+
if (actionRef.current) {
|
|
231
|
+
actionRef.current.reload();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}}
|
|
235
|
+
onCancel={() => {
|
|
236
|
+
handleUpdateModalVisible(false);
|
|
237
|
+
setStepFormValues({});
|
|
238
|
+
}}
|
|
239
|
+
updateModalVisible={updateModalVisible}
|
|
240
|
+
values={stepFormValues}
|
|
241
|
+
/>
|
|
242
|
+
) : null}
|
|
243
|
+
|
|
244
|
+
<Drawer
|
|
245
|
+
width={600}
|
|
246
|
+
open={!!row}
|
|
247
|
+
onClose={() => {
|
|
248
|
+
setRow(undefined);
|
|
249
|
+
}}
|
|
250
|
+
closable={false}
|
|
251
|
+
>
|
|
252
|
+
{row?.name && (
|
|
253
|
+
<ProDescriptions<API.UserInfo>
|
|
254
|
+
column={2}
|
|
255
|
+
title={row?.name}
|
|
256
|
+
request={async () => ({
|
|
257
|
+
data: row || {},
|
|
258
|
+
})}
|
|
259
|
+
params={{
|
|
260
|
+
id: row?.name,
|
|
261
|
+
}}
|
|
262
|
+
columns={columns}
|
|
263
|
+
/>
|
|
264
|
+
)}
|
|
265
|
+
</Drawer>
|
|
266
|
+
</PageContainer>
|
|
267
|
+
);
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export default TableList;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// 该文件由 OneAPI 自动生成,请勿手动修改!
|
|
3
|
+
import { request } from '@umijs/max';
|
|
4
|
+
|
|
5
|
+
/** 此处后端没有提供注释 GET /api/v1/queryUserList */
|
|
6
|
+
export async function queryUserList(
|
|
7
|
+
params: {
|
|
8
|
+
// query
|
|
9
|
+
/** keyword */
|
|
10
|
+
keyword?: string;
|
|
11
|
+
/** current */
|
|
12
|
+
current?: number;
|
|
13
|
+
/** pageSize */
|
|
14
|
+
pageSize?: number;
|
|
15
|
+
},
|
|
16
|
+
options?: { [key: string]: any },
|
|
17
|
+
) {
|
|
18
|
+
return request<API.Result_PageInfo_UserInfo__>('/api/v1/queryUserList', {
|
|
19
|
+
method: 'GET',
|
|
20
|
+
params: {
|
|
21
|
+
...params,
|
|
22
|
+
},
|
|
23
|
+
...(options || {}),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** 此处后端没有提供注释 POST /api/v1/user */
|
|
28
|
+
export async function addUser(
|
|
29
|
+
body?: API.UserInfoVO,
|
|
30
|
+
options?: { [key: string]: any },
|
|
31
|
+
) {
|
|
32
|
+
return request<API.Result_UserInfo_>('/api/v1/user', {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: {
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
},
|
|
37
|
+
data: body,
|
|
38
|
+
...(options || {}),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** 此处后端没有提供注释 GET /api/v1/user/${param0} */
|
|
43
|
+
export async function getUserDetail(
|
|
44
|
+
params: {
|
|
45
|
+
// path
|
|
46
|
+
/** userId */
|
|
47
|
+
userId?: string;
|
|
48
|
+
},
|
|
49
|
+
options?: { [key: string]: any },
|
|
50
|
+
) {
|
|
51
|
+
const { userId: param0 } = params;
|
|
52
|
+
return request<API.Result_UserInfo_>(`/api/v1/user/${param0}`, {
|
|
53
|
+
method: 'GET',
|
|
54
|
+
params: { ...params },
|
|
55
|
+
...(options || {}),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** 此处后端没有提供注释 PUT /api/v1/user/${param0} */
|
|
60
|
+
export async function modifyUser(
|
|
61
|
+
params: {
|
|
62
|
+
// path
|
|
63
|
+
/** userId */
|
|
64
|
+
userId?: string;
|
|
65
|
+
},
|
|
66
|
+
body?: API.UserInfoVO,
|
|
67
|
+
options?: { [key: string]: any },
|
|
68
|
+
) {
|
|
69
|
+
const { userId: param0 } = params;
|
|
70
|
+
return request<API.Result_UserInfo_>(`/api/v1/user/${param0}`, {
|
|
71
|
+
method: 'PUT',
|
|
72
|
+
headers: {
|
|
73
|
+
'Content-Type': 'application/json',
|
|
74
|
+
},
|
|
75
|
+
params: { ...params },
|
|
76
|
+
data: body,
|
|
77
|
+
...(options || {}),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** 此处后端没有提供注释 DELETE /api/v1/user/${param0} */
|
|
82
|
+
export async function deleteUser(
|
|
83
|
+
params: {
|
|
84
|
+
// path
|
|
85
|
+
/** userId */
|
|
86
|
+
userId?: string;
|
|
87
|
+
},
|
|
88
|
+
options?: { [key: string]: any },
|
|
89
|
+
) {
|
|
90
|
+
const { userId: param0 } = params;
|
|
91
|
+
return request<API.Result_string_>(`/api/v1/user/${param0}`, {
|
|
92
|
+
method: 'DELETE',
|
|
93
|
+
params: { ...params },
|
|
94
|
+
...(options || {}),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// 该文件由 OneAPI 自动生成,请勿手动修改!
|
|
3
|
+
|
|
4
|
+
declare namespace API {
|
|
5
|
+
interface PageInfo {
|
|
6
|
+
/**
|
|
7
|
+
1 */
|
|
8
|
+
current?: number;
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
total?: number;
|
|
11
|
+
list?: Array<Record<string, any>>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface PageInfo_UserInfo_ {
|
|
15
|
+
/**
|
|
16
|
+
1 */
|
|
17
|
+
current?: number;
|
|
18
|
+
pageSize?: number;
|
|
19
|
+
total?: number;
|
|
20
|
+
list?: Array<UserInfo>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface Result {
|
|
24
|
+
success?: boolean;
|
|
25
|
+
errorMessage?: string;
|
|
26
|
+
data?: Record<string, any>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface Result_PageInfo_UserInfo__ {
|
|
30
|
+
success?: boolean;
|
|
31
|
+
errorMessage?: string;
|
|
32
|
+
data?: PageInfo_UserInfo_;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Result_UserInfo_ {
|
|
36
|
+
success?: boolean;
|
|
37
|
+
errorMessage?: string;
|
|
38
|
+
data?: UserInfo;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface Result_string_ {
|
|
42
|
+
success?: boolean;
|
|
43
|
+
errorMessage?: string;
|
|
44
|
+
data?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type UserGenderEnum = 'MALE' | 'FEMALE';
|
|
48
|
+
|
|
49
|
+
interface UserInfo {
|
|
50
|
+
id?: string;
|
|
51
|
+
name?: string;
|
|
52
|
+
/** nick */
|
|
53
|
+
nickName?: string;
|
|
54
|
+
/** email */
|
|
55
|
+
email?: string;
|
|
56
|
+
gender?: UserGenderEnum;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface UserInfoVO {
|
|
60
|
+
name?: string;
|
|
61
|
+
/** nick */
|
|
62
|
+
nickName?: string;
|
|
63
|
+
/** email */
|
|
64
|
+
email?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
type definitions_0 = null;
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@umijs/max/typings';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
1
|
+
import { defineConfig } from 'father';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
cjs: {},
|
|
5
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
node_modules
|
|
2
|
-
|
|
2
|
+
/dist
|
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
# {{{
|
|
1
|
+
# {{{ pluginName }}}
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://npmjs.org/package/{{{ name }}})
|
|
5
|
-
|
|
6
|
-
{{{ description }}}
|
|
3
|
+
A umi plugin
|
|
7
4
|
|
|
8
5
|
## Install
|
|
9
6
|
|
|
10
7
|
```bash
|
|
11
|
-
|
|
12
|
-
$ npm install
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
$ npm run build --watch
|
|
17
|
-
$ npm run start
|
|
8
|
+
pnpm i {{{ pluginName }}}
|
|
18
9
|
```
|
|
19
10
|
|
|
20
11
|
## Usage
|
|
21
12
|
|
|
22
|
-
Configure in `.umirc.
|
|
13
|
+
Configure in `.umirc.ts`,
|
|
23
14
|
|
|
24
15
|
```js
|
|
25
16
|
export default {
|
|
26
17
|
plugins: [
|
|
27
|
-
['{{{
|
|
18
|
+
['{{{ pluginName }}}'],
|
|
28
19
|
],
|
|
29
20
|
}
|
|
30
21
|
```
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{{
|
|
2
|
+
"name": "{{{ pluginName }}}",
|
|
3
|
+
"author": "{{{ author }}}",
|
|
3
4
|
"version": "0.0.1",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"types": "dist/cjs/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
8
|
+
"dev": "father dev",
|
|
9
|
+
"build": "father build"
|
|
9
10
|
},
|
|
10
11
|
"keywords": [],
|
|
11
|
-
"repository": "{{{ org }}}/{{{ name }}}",
|
|
12
12
|
"authors": {
|
|
13
13
|
"name": "{{{ author }}}",
|
|
14
|
-
"email": "{{{
|
|
14
|
+
"email": "{{{ email }}}"
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"files": [
|
|
18
|
-
"
|
|
18
|
+
"dist"
|
|
19
19
|
],
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"father": "^4.1.8",
|
|
22
|
+
"umi": "{{{ version }}}",
|
|
23
|
+
"@types/node": "^18.15.11",
|
|
24
|
+
"typescript": "^5.0.3"
|
|
23
25
|
}
|
|
24
26
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2019",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"noFallthroughCasesInSwitch": true,
|
|
12
|
+
"module": "commonjs",
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": false,
|
|
16
|
+
"noEmit": false,
|
|
17
|
+
"declaration": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"author": "{{{ author }}}",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"dev": "umi dev",
|
|
6
|
+
"build": "umi build",
|
|
7
|
+
"postinstall": "umi setup",
|
|
8
|
+
"start": "npm run dev"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"vue": "^3.2.47",
|
|
12
|
+
"umi": "{{{ version }}}"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^5.0.3",
|
|
16
|
+
"@umijs/preset-vue": "{{{ version }}}"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="navs">
|
|
3
|
+
<ul>
|
|
4
|
+
<li>
|
|
5
|
+
<router-link to="/">Home</router-link>
|
|
6
|
+
</li>
|
|
7
|
+
<li>
|
|
8
|
+
<router-link to="/docs">Docs</router-link>
|
|
9
|
+
</li>
|
|
10
|
+
<li>
|
|
11
|
+
<a href="https://github.com/umijs/umi">Github</a>
|
|
12
|
+
</li>
|
|
13
|
+
</ul>
|
|
14
|
+
<router-view></router-view>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
<style lang="less">
|
|
18
|
+
.navs {
|
|
19
|
+
ul {
|
|
20
|
+
padding: 0;
|
|
21
|
+
list-style: none;
|
|
22
|
+
display: flex;
|
|
23
|
+
}
|
|
24
|
+
li {
|
|
25
|
+
margin-right: 1em;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'umi/typings';
|