kn-cli 1.0.115 → 1.0.117

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.
@@ -40,7 +40,7 @@ warn(`=====================env end=========================`);
40
40
  const build_log_level=process.env.build_log_level || 'clear';
41
41
  const devMode = process.env.build_env !== 'prod';
42
42
  const hashMode = CLI_CONFIG?.hashMode ?? process.env.build_env != 'localdebug';
43
- const cssSplitMode = CLI_CONFIG?.cssSplitMode??true;
43
+ const cssSplitMode = CLI_CONFIG?.cssSplitMode??(process.env.build_env == 'localdebug'?false:true);
44
44
  const resource_path_relative= CLI_CONFIG?.site_root_path??'';
45
45
  const support_sass=CLI_CONFIG?.sass??false;
46
46
  const css_modules= CLI_CONFIG?.cssModule??'local';
@@ -52,6 +52,8 @@ const devServer=CLI_CONFIG?.devServer??{};
52
52
  const prject_name = CLI_CONFIG?.name??'';
53
53
  const sourceMapLocal = CLI_CONFIG?.sourcemap?.local??false;//是否将soucemap改为本地
54
54
 
55
+
56
+
55
57
  let distFolder = 'dist';
56
58
  let distJsFolder='';
57
59
  if(CLI_CONFIG?.dist){
@@ -385,6 +387,10 @@ if(devMode){
385
387
  }
386
388
  plugins.push(new webpack.SourceMapDevToolPlugin({
387
389
  filename: 'sourcemap/[file].map',
390
+ // filename: false, // 避免生成额外的 .map 文件,提高构建速度
391
+ // module: true, // 使 source map 映射到 loader 处理前的源码
392
+ // columns: false, // 只映射到行,忽略列信息,提高性能
393
+ // lineToLine: false, // 关闭逐行映射,减少计算量
388
394
  // publicPath: '..',//resource_path_relative,
389
395
  // fileContext: 'js',
390
396
  }))
@@ -523,6 +529,10 @@ const config={
523
529
  },
524
530
  optimization: optimization,
525
531
  plugins: plugins,
532
+ // watchOptions: {
533
+ // aggregateTimeout: 5000, // 文件变化后延迟 300 毫秒再重新构建
534
+ // ignored: /node_modules/ // 忽略 node_modules 目录
535
+ // }
526
536
  };
527
537
 
528
538
  if(process.env.build_env == 'localdebug'){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-cli",
3
- "version": "1.0.115",
3
+ "version": "1.0.117",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,188 +0,0 @@
1
-
2
- import React from 'react';
3
- // @ts-ignore
4
- import MenuIcon from '@/components/menuIcon';
5
- import PageTemplate from './pages/pageTemplate';
6
-
7
-
8
- const Page1 = React.lazy(() => import('@/pages/demo/page1'));
9
- const Page2 = React.lazy(() => import('@/pages/demo/page2'));
10
- const Page3 = React.lazy(() => import('@/pages/demo/page3'));
11
-
12
- const AuthUser = React.lazy(() => import('@/pages/auth/user'));
13
- const AuthUserCreate = React.lazy(() => import('@/pages/auth/user/create'));
14
-
15
-
16
- /**
17
- * 自动计算菜单权限,使父级菜单权限包含所有子菜单的权限
18
- * @param {RouteMenuItem} menu
19
- * @returns {RouteMenuItem}
20
- */
21
- export const UpdateAuth=(menu)=>{
22
- if(menu.children){
23
-
24
- let auths= menu.children.map(childMenu=>{
25
- let _childMenu = UpdateAuth(childMenu);
26
- if( Array.isArray(_childMenu.auth) ){
27
- return [..._childMenu.auth];
28
- }
29
- return [];
30
- });
31
-
32
- if( Array.isArray(menu.auth) ){
33
-
34
- menu.auth = [...menu.auth,...auths.flat()];
35
- // @ts-ignore
36
- menu.auth = [...new Set(menu.auth)];// 去重
37
- }
38
- }
39
- return menu;
40
- }
41
-
42
- export const LoadComponent=(lazyComponent)=>{
43
- return React.createElement(lazyComponent)
44
- }
45
-
46
- /**
47
- * @type {RouteMenuItem}
48
- */
49
- const DASHBOARD={
50
- name:'仪表盘',
51
- url:'/',
52
- component:LoadComponent(React.lazy(() => import('@/pages/home'))),
53
- children:[
54
- ],
55
- }
56
- /**
57
- * @type {RouteMenuItem}
58
- */
59
- const DNA={
60
- name:'基因库',
61
- url:'/dna',
62
- auth:true,
63
- children:[
64
- {
65
- name: '父菜单1',
66
- icon:<MenuIcon name='icon-dep'/>,
67
- url: '/dna/parent',
68
- auth:true,
69
- children:[
70
- {
71
- component:<Page1 name='父菜单1-子菜单1'/>,
72
- name:'子菜单1-1',
73
- auth:true,
74
- url:'/dna/parent/child1'
75
- }
76
- ]
77
- },
78
- {
79
- name: '父菜单2',
80
- icon:<MenuIcon name='icon-dep'/>,
81
- url: '/dna/parent2',
82
- auth:true,
83
- children:[
84
- {
85
- component:<Page2 name='父菜单2-子菜单1'/>,
86
- name:'子菜单2-1',
87
- auth:true,
88
- url:'/dna/parent2/child1'
89
- }
90
- ]
91
- },
92
- {
93
- name: '父菜单3',
94
- icon:<MenuIcon name='icon-dep'/>,
95
- url: '/dna/parent3',
96
- auth:true,
97
- children:[
98
- {
99
- name:'子菜单3-1',
100
- auth:true,
101
- url:'/dna/parent3/child1',
102
- children:[
103
- {
104
- component:<Page2 name='父菜单3-子菜单1-子子菜单1'/>,
105
- name:'子菜单3-1-1',
106
- auth:true,
107
- url:'/dna/parent3/child1/child1'
108
- }
109
- ]
110
- }
111
- ]
112
- },
113
- ],
114
- }
115
- /**
116
- * @type {RouteMenuItem}
117
- */
118
- const AUTH={
119
- name:'控制室',
120
- url:'/auth',
121
- msgCount:12,
122
- primaryId:'auth',
123
- children:[
124
- {
125
- name: '用户',
126
- component:<AuthUser />,
127
- icon:<MenuIcon name='icon-user'/>,
128
- url: '/auth/user',
129
- auth:true,
130
- primaryId:'authUser',
131
- msgCount:0,
132
- children:[
133
- {
134
- component:<AuthUserCreate />,
135
- name:'新建用户',
136
- url:'/auth/user/create',
137
- hideMenu:true
138
- }
139
- ]
140
- },
141
- {
142
- name: '部门',
143
- icon:<MenuIcon name='icon-dep'/>,
144
- url: '/auth/dep',
145
- auth:true,
146
- children:[
147
- {
148
- component:<PageTemplate name='部门列表' />,
149
- name:'部门列表',
150
- url:'/auth/dep/list',
151
- auth:true,
152
- children:[
153
- {
154
- component:<PageTemplate name='部门详情' />,
155
- name:'部门详情',
156
- routeTemplate:'/auth/dep/detail/:id',
157
- hideMenu:true,
158
- auth:true,
159
- }
160
- ]
161
- },
162
-
163
- ]
164
- },
165
- {
166
- name: '角色',
167
- component:<PageTemplate name='角色' />,
168
- icon:<MenuIcon name='icon-role'/>,
169
- url: '/auth/role',
170
- },
171
- {
172
- name: '操作记录',
173
- component:<PageTemplate name='操作记录' />,
174
- icon:<MenuIcon name='icon-log'/>,
175
- url: '/auth/log',
176
- msgCount:12,
177
- },
178
- {
179
- name: '登录日志',
180
- component:<PageTemplate name='登录日志' />,
181
- icon:<MenuIcon name='icon-loginlog'/>,
182
- url: '/auth/loginLog',
183
- },
184
- ],
185
- }
186
-
187
-
188
- export default [UpdateAuth(DASHBOARD), UpdateAuth(DNA), UpdateAuth(AUTH) ];