generator-mico-cli 0.2.6 → 0.2.7
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/generators/micro-react/templates/.cursor/rules/development-guide.mdc +1 -2
- package/generators/micro-react/templates/apps/layout/config/config.dev.ts +2 -6
- package/generators/micro-react/templates/apps/layout/config/config.ts +1 -0
- package/generators/micro-react/templates/apps/layout/mock/menus.ts +126 -4
- package/package.json +1 -1
- package/generators/micro-react/templates/apps/layout/mock/menus.json +0 -100
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
// https://umijs.org/config/
|
|
2
2
|
|
|
3
3
|
import { defineConfig } from '@umijs/max';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import path from 'path';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
fs.readFileSync(path.join(__dirname, '../mock/menus.json'), 'utf-8'),
|
|
10
|
-
);
|
|
5
|
+
|
|
6
|
+
import mockMenus from '../mock/menus';
|
|
11
7
|
|
|
12
8
|
const config: ReturnType<typeof defineConfig> = {
|
|
13
9
|
publicPath: '/',
|
|
@@ -2,10 +2,132 @@
|
|
|
2
2
|
* Mock 菜单数据
|
|
3
3
|
* 用于开发环境测试
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* 菜单结构说明:
|
|
6
|
+
* - id: 菜单唯一标识
|
|
7
|
+
* - name: 菜单名称
|
|
8
|
+
* - type: 'page' | 'group' (page: 页面, group: 分组)
|
|
9
|
+
* - path: 路由路径 (group 类型为 null)
|
|
10
|
+
* - icon: 图标名称
|
|
11
|
+
* - enabled: 是否启用
|
|
12
|
+
* - sortOrder: 排序权重
|
|
13
|
+
* - pageId: 关联的页面 ID
|
|
14
|
+
* - page: 页面配置 (微前端入口)
|
|
15
|
+
* - htmlUrl: 子应用入口地址
|
|
16
|
+
* - jsUrls: 额外 JS 资源
|
|
17
|
+
* - cssUrls: 额外 CSS 资源
|
|
18
|
+
* - children: 子菜单数组
|
|
7
19
|
*/
|
|
8
|
-
import mockMenusData from './menus.json';
|
|
9
20
|
|
|
10
|
-
|
|
21
|
+
import type { MenuItem, PageConfig } from '@/common/menu/types';
|
|
22
|
+
|
|
23
|
+
/** Mock 页面配置 - 只需要核心字段 */
|
|
24
|
+
type MockPageConfig = Pick<PageConfig, 'id' | 'name' | 'route' | 'enabled' | 'htmlUrl' | 'jsUrls' | 'cssUrls'>;
|
|
25
|
+
|
|
26
|
+
/** Mock 菜单项 - page 字段使用简化类型 */
|
|
27
|
+
type MockMenuItem = Omit<MenuItem, 'page' | 'children'> & {
|
|
28
|
+
page: MockPageConfig | null;
|
|
29
|
+
children: MockMenuItem[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const mockMenus: MockMenuItem[] = [
|
|
33
|
+
{
|
|
34
|
+
"id": 1,
|
|
35
|
+
"name": "首页",
|
|
36
|
+
"type": "page",
|
|
37
|
+
"path": null,
|
|
38
|
+
"icon": "Home",
|
|
39
|
+
"enabled": true,
|
|
40
|
+
"sortOrder": 0,
|
|
41
|
+
"pageId": 1,
|
|
42
|
+
"page": {
|
|
43
|
+
"id": 1,
|
|
44
|
+
"name": "home",
|
|
45
|
+
"route": "/",
|
|
46
|
+
"enabled": true,
|
|
47
|
+
"htmlUrl": "",
|
|
48
|
+
"jsUrls": [],
|
|
49
|
+
"cssUrls": []
|
|
50
|
+
},
|
|
51
|
+
"children": []
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": 2,
|
|
55
|
+
"name": "示例模块",
|
|
56
|
+
"type": "group",
|
|
57
|
+
"path": null,
|
|
58
|
+
"icon": "List",
|
|
59
|
+
"enabled": true,
|
|
60
|
+
"sortOrder": 1,
|
|
61
|
+
"pageId": null,
|
|
62
|
+
"page": null,
|
|
63
|
+
"children": [
|
|
64
|
+
{
|
|
65
|
+
"id": 3,
|
|
66
|
+
"name": "示例页面",
|
|
67
|
+
"type": "page",
|
|
68
|
+
"path": "/example/page",
|
|
69
|
+
"icon": "File",
|
|
70
|
+
"enabled": true,
|
|
71
|
+
"sortOrder": 1,
|
|
72
|
+
"pageId": 45,
|
|
73
|
+
"page": {
|
|
74
|
+
"id": 45,
|
|
75
|
+
"name": "example-page",
|
|
76
|
+
"route": "/example/page",
|
|
77
|
+
"enabled": true,
|
|
78
|
+
"htmlUrl": "",
|
|
79
|
+
"jsUrls": [],
|
|
80
|
+
"cssUrls": []
|
|
81
|
+
},
|
|
82
|
+
"children": []
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": 5,
|
|
88
|
+
"name": "微应用示例",
|
|
89
|
+
"type": "group",
|
|
90
|
+
"path": null,
|
|
91
|
+
"icon": "Apps",
|
|
92
|
+
"enabled": true,
|
|
93
|
+
"sortOrder": 2,
|
|
94
|
+
"pageId": null,
|
|
95
|
+
"page": null,
|
|
96
|
+
"children": [
|
|
97
|
+
{
|
|
98
|
+
"id": 6,
|
|
99
|
+
"name": "子应用页面",
|
|
100
|
+
"type": "page",
|
|
101
|
+
"path": null,
|
|
102
|
+
"icon": "Desktop",
|
|
103
|
+
"enabled": true,
|
|
104
|
+
"sortOrder": 1,
|
|
105
|
+
"pageId": 55,
|
|
106
|
+
"page": {
|
|
107
|
+
"id": 55,
|
|
108
|
+
"name": "subapp-example",
|
|
109
|
+
"route": "/subapp",
|
|
110
|
+
"enabled": true,
|
|
111
|
+
"htmlUrl": "//localhost:8010",
|
|
112
|
+
"jsUrls": [],
|
|
113
|
+
"cssUrls": []
|
|
114
|
+
},
|
|
115
|
+
"children": []
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"id": 7,
|
|
121
|
+
"name": "外部链接",
|
|
122
|
+
"type": "link",
|
|
123
|
+
"path": "https://github.com",
|
|
124
|
+
"icon": "Link",
|
|
125
|
+
"enabled": true,
|
|
126
|
+
"sortOrder": 3,
|
|
127
|
+
"pageId": null,
|
|
128
|
+
"page": null,
|
|
129
|
+
"children": []
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
|
|
11
133
|
export default mockMenus;
|
package/package.json
CHANGED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": 1,
|
|
4
|
-
"name": "首页",
|
|
5
|
-
"type": "page",
|
|
6
|
-
"path": null,
|
|
7
|
-
"icon": "Home",
|
|
8
|
-
"enabled": true,
|
|
9
|
-
"sortOrder": 0,
|
|
10
|
-
"pageId": 1,
|
|
11
|
-
"page": {
|
|
12
|
-
"id": 1,
|
|
13
|
-
"name": "home",
|
|
14
|
-
"route": "/",
|
|
15
|
-
"enabled": true,
|
|
16
|
-
"htmlUrl": null,
|
|
17
|
-
"jsUrls": [],
|
|
18
|
-
"cssUrls": []
|
|
19
|
-
},
|
|
20
|
-
"children": []
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"id": 2,
|
|
24
|
-
"name": "示例模块",
|
|
25
|
-
"type": "group",
|
|
26
|
-
"path": null,
|
|
27
|
-
"icon": "List",
|
|
28
|
-
"enabled": true,
|
|
29
|
-
"sortOrder": 1,
|
|
30
|
-
"pageId": null,
|
|
31
|
-
"page": null,
|
|
32
|
-
"children": [
|
|
33
|
-
{
|
|
34
|
-
"id": 3,
|
|
35
|
-
"name": "示例页面",
|
|
36
|
-
"type": "page",
|
|
37
|
-
"path": "/example/page",
|
|
38
|
-
"icon": "File",
|
|
39
|
-
"enabled": true,
|
|
40
|
-
"sortOrder": 1,
|
|
41
|
-
"pageId": 45,
|
|
42
|
-
"page": {
|
|
43
|
-
"id": 45,
|
|
44
|
-
"name": "example-page",
|
|
45
|
-
"route": "/example/page",
|
|
46
|
-
"enabled": true,
|
|
47
|
-
"htmlUrl": null,
|
|
48
|
-
"jsUrls": [],
|
|
49
|
-
"cssUrls": []
|
|
50
|
-
},
|
|
51
|
-
"children": []
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"id": 5,
|
|
57
|
-
"name": "微应用示例",
|
|
58
|
-
"type": "group",
|
|
59
|
-
"path": null,
|
|
60
|
-
"icon": "Apps",
|
|
61
|
-
"enabled": true,
|
|
62
|
-
"sortOrder": 2,
|
|
63
|
-
"pageId": null,
|
|
64
|
-
"page": null,
|
|
65
|
-
"children": [
|
|
66
|
-
{
|
|
67
|
-
"id": 6,
|
|
68
|
-
"name": "子应用页面",
|
|
69
|
-
"type": "page",
|
|
70
|
-
"path": null,
|
|
71
|
-
"icon": "Desktop",
|
|
72
|
-
"enabled": true,
|
|
73
|
-
"sortOrder": 1,
|
|
74
|
-
"pageId": 55,
|
|
75
|
-
"page": {
|
|
76
|
-
"id": 55,
|
|
77
|
-
"name": "subapp-example",
|
|
78
|
-
"route": "/subapp",
|
|
79
|
-
"enabled": true,
|
|
80
|
-
"htmlUrl": "//localhost:8010",
|
|
81
|
-
"jsUrls": [],
|
|
82
|
-
"cssUrls": []
|
|
83
|
-
},
|
|
84
|
-
"children": []
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"id": 7,
|
|
90
|
-
"name": "外部链接",
|
|
91
|
-
"type": "link",
|
|
92
|
-
"path": "https://github.com",
|
|
93
|
-
"icon": "Link",
|
|
94
|
-
"enabled": true,
|
|
95
|
-
"sortOrder": 3,
|
|
96
|
-
"pageId": null,
|
|
97
|
-
"page": null,
|
|
98
|
-
"children": []
|
|
99
|
-
}
|
|
100
|
-
]
|