neo-cmp-cli 1.1.9 → 1.1.11
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/package.json +1 -1
- package/src/cmpUtils/createCommonModulesCode.js +18 -6
- package/src/module/main.js +19 -7
- package/src/neo/neoRequire.js +2 -2
- package/src/template/antd-custom-cmp-template/neo.config.js +2 -2
- package/src/template/antd-custom-cmp-template/package.json +2 -2
- package/src/template/antd-custom-cmp-template/src/components/data-dashboard/style.scss +20 -20
- package/src/template/antd-custom-cmp-template/src/components/{info-card → info-card2}/index.tsx +20 -0
- package/src/template/antd-custom-cmp-template/src/components/{info-card → info-card2}/model.ts +1 -1
- package/src/template/echarts-custom-cmp-template/neo.config.js +4 -4
- package/src/template/echarts-custom-cmp-template/package.json +2 -2
- package/src/template/neo-custom-cmp-template/package.json +1 -1
- package/src/template/react-custom-cmp-template/package.json +1 -1
- package/src/template/react-ts-custom-cmp-template/package.json +1 -1
- package/src/template/vue2-custom-cmp-template/package.json +1 -1
- /package/src/template/antd-custom-cmp-template/src/components/{info-card → info-card2}/style.scss +0 -0
package/package.json
CHANGED
|
@@ -16,23 +16,35 @@ const createCommonModulesCode = (neoExports) => {
|
|
|
16
16
|
|
|
17
17
|
// 根据 neoExports 获取共享的依赖模块
|
|
18
18
|
if (Array.isArray(neoExports) && neoExports.length > 0) {
|
|
19
|
-
neoExports.forEach(module => {
|
|
19
|
+
neoExports.forEach((module) => {
|
|
20
20
|
CustomCmpCommonModules[module] = require(module);
|
|
21
21
|
});
|
|
22
|
-
} else if (isPlainObject(neoExports)) {
|
|
23
|
-
|
|
22
|
+
} else if (isPlainObject(neoExports) && Object.keys(neoExports).length > 0) {
|
|
23
|
+
Object.keys(neoExports).forEach((moduleId) => {
|
|
24
|
+
CustomCmpCommonModules[moduleId] = `require('${neoExports[moduleId]}')`;
|
|
25
|
+
});
|
|
24
26
|
} else {
|
|
25
|
-
console.error(
|
|
27
|
+
console.error(
|
|
28
|
+
'neoExports 格式不正确,请检查 neo.config.js 文件中的 neoCommonModule / neoExports 配置'
|
|
29
|
+
);
|
|
26
30
|
process.exit(1);
|
|
27
|
-
return '';
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
// 构建 CustomCmpCommonModules 对象的代码字符串
|
|
34
|
+
let customCmpCommonModulesCode = '{\n';
|
|
35
|
+
const moduleEntries = Object.entries(CustomCmpCommonModules);
|
|
36
|
+
moduleEntries.forEach(([moduleId, moduleValue], index) => {
|
|
37
|
+
const isLast = index === moduleEntries.length - 1;
|
|
38
|
+
customCmpCommonModulesCode += ` "${moduleId}": ${moduleValue}${isLast ? '' : ','}\n`;
|
|
39
|
+
});
|
|
40
|
+
customCmpCommonModulesCode += '}';
|
|
41
|
+
|
|
30
42
|
const commonModulesCode = `
|
|
31
43
|
/**
|
|
32
44
|
* 自定义组件 共享出来的依赖模块
|
|
33
45
|
* 备注:可在其他模块中通过 neoRequire 中使用
|
|
34
46
|
*/
|
|
35
|
-
const CustomCmpCommonModules = ${
|
|
47
|
+
const CustomCmpCommonModules = ${customCmpCommonModulesCode};
|
|
36
48
|
|
|
37
49
|
// 用于添加共享的依赖模块
|
|
38
50
|
const addNeoCommonModules = (modules) => {
|
package/src/module/main.js
CHANGED
|
@@ -125,13 +125,19 @@ module.exports = {
|
|
|
125
125
|
curConfig.dev.externals = neoExternals;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
if (
|
|
128
|
+
if (
|
|
129
|
+
cmpNeoExports &&
|
|
130
|
+
((Array.isArray(cmpNeoExports) && cmpNeoExports.length > 0) ||
|
|
131
|
+
(_.isPlainObject(cmpNeoExports) && Object.keys(cmpNeoExports).length > 0))
|
|
132
|
+
) {
|
|
129
133
|
const commonModulesFilePath = createCommonModulesCode(cmpNeoExports);
|
|
130
134
|
|
|
131
135
|
// 所有入口文件添加 commonModulesFile
|
|
132
136
|
if (curConfig.dev.entry) {
|
|
133
137
|
Object.keys(curConfig.dev.entry).forEach((name) => {
|
|
134
|
-
|
|
138
|
+
curConfig.dev.entry[name] = [commonModulesFilePath].concat(
|
|
139
|
+
curConfig.dev.entry[name]
|
|
140
|
+
);
|
|
135
141
|
});
|
|
136
142
|
}
|
|
137
143
|
}
|
|
@@ -230,19 +236,25 @@ module.exports = {
|
|
|
230
236
|
|
|
231
237
|
// 添加 内置 Neo 的 externals 配置
|
|
232
238
|
const neoExternals = getExternalsByNeoCommonModules(cmpNeoExternals);
|
|
233
|
-
if (curConfig.build2lib.externals && _.isPlainObject(curConfig.
|
|
239
|
+
if (curConfig.build2lib.externals && _.isPlainObject(curConfig.build2lib.externals)) {
|
|
234
240
|
curConfig.build2lib.externals = Object.assign(curConfig.build2lib.externals, neoExternals);
|
|
235
241
|
} else {
|
|
236
242
|
curConfig.build2lib.externals = neoExternals;
|
|
237
243
|
}
|
|
238
244
|
|
|
239
|
-
if (
|
|
245
|
+
if (
|
|
246
|
+
cmpNeoExports &&
|
|
247
|
+
((Array.isArray(cmpNeoExports) && cmpNeoExports.length > 0) ||
|
|
248
|
+
(_.isPlainObject(cmpNeoExports) && Object.keys(cmpNeoExports).length > 0))
|
|
249
|
+
) {
|
|
240
250
|
const commonModulesFilePath = createCommonModulesCode(cmpNeoExports);
|
|
241
251
|
|
|
242
252
|
// 所有入口文件添加 commonModulesFile
|
|
243
|
-
if (curConfig.
|
|
244
|
-
Object.keys(curConfig.
|
|
245
|
-
|
|
253
|
+
if (curConfig.build2lib.entry) {
|
|
254
|
+
Object.keys(curConfig.build2lib.entry).forEach((name) => {
|
|
255
|
+
curConfig.build2lib.entry[name] = [commonModulesFilePath].concat(
|
|
256
|
+
curConfig.build2lib.entry[name]
|
|
257
|
+
);
|
|
246
258
|
});
|
|
247
259
|
}
|
|
248
260
|
}
|
package/src/neo/neoRequire.js
CHANGED
|
@@ -28,8 +28,8 @@ const getExternalsByNeoCommonModules = (cmpNeoExternals) => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
// 如果自定义组件有共享的依赖模块,则合并到 neoExternals 中
|
|
31
|
-
if (cmpNeoExternals &&
|
|
32
|
-
|
|
31
|
+
if (cmpNeoExternals && cmpNeoExternals.length > 0) {
|
|
32
|
+
cmpNeoExternals.forEach(moduleName => {
|
|
33
33
|
neoExternals[moduleName] = `commonjs ${moduleName}`;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -41,8 +41,8 @@ module.exports = {
|
|
|
41
41
|
// Neo 共享依赖模块
|
|
42
42
|
neoCommonModule: {
|
|
43
43
|
// neoExports: ['echarts'], // 自定义组件 共享出来的模块,支持数组和对象
|
|
44
|
-
// neoExports: {},
|
|
45
|
-
neoExternals: ['neo-register'], // 自定义组件 需要剔除的模块,仅支持数组写法
|
|
44
|
+
// neoExports: {}, // 对象写法
|
|
45
|
+
// neoExternals: ['neo-register', 'chart-widget'], // 自定义组件 需要剔除的模块,仅支持数组写法
|
|
46
46
|
},
|
|
47
47
|
preview: {
|
|
48
48
|
// 用于开启本地预览模式的相关配置信息
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-custom-cmp-template",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "neo自定义组件模板(react&ts技术栈)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"自定义组件模板",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@commitlint/config-conventional": "^9.1.1",
|
|
48
48
|
"@types/react": "^16.9.11",
|
|
49
49
|
"@types/react-dom": "^16.9.15",
|
|
50
|
-
"neo-cmp-cli": "^1.1.
|
|
50
|
+
"neo-cmp-cli": "^1.1.11",
|
|
51
51
|
"husky": "^4.2.5",
|
|
52
52
|
"lint-staged": "^10.2.9",
|
|
53
53
|
"prettier": "^2.0.5"
|
|
@@ -254,11 +254,11 @@
|
|
|
254
254
|
border: 1px solid rgba(51, 65, 85, 0.5);
|
|
255
255
|
backdrop-filter: blur(20px);
|
|
256
256
|
color: var(--text-inverse);
|
|
257
|
-
|
|
257
|
+
|
|
258
258
|
.dashboard-title {
|
|
259
259
|
color: var(--text-inverse);
|
|
260
260
|
}
|
|
261
|
-
|
|
261
|
+
|
|
262
262
|
.user-info {
|
|
263
263
|
.user-name {
|
|
264
264
|
color: var(--text-inverse);
|
|
@@ -275,86 +275,86 @@
|
|
|
275
275
|
border: 1px solid rgba(51, 65, 85, 0.5);
|
|
276
276
|
color: var(--text-inverse);
|
|
277
277
|
backdrop-filter: blur(20px);
|
|
278
|
-
|
|
278
|
+
|
|
279
279
|
.ant-card-head-title {
|
|
280
280
|
color: var(--text-inverse);
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
|
|
283
283
|
.ant-statistic-title {
|
|
284
284
|
color: var(--text-inverse);
|
|
285
285
|
}
|
|
286
|
-
|
|
286
|
+
|
|
287
287
|
.ant-statistic-content-value {
|
|
288
288
|
color: var(--text-inverse);
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
|
|
291
291
|
.metric-trend {
|
|
292
292
|
.trend-text {
|
|
293
293
|
color: var(--text-inverse);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
|
|
296
|
+
|
|
297
297
|
.product-name {
|
|
298
298
|
color: var(--text-inverse);
|
|
299
299
|
}
|
|
300
|
-
|
|
300
|
+
|
|
301
301
|
.product-sales {
|
|
302
302
|
color: rgba(255, 255, 255, 0.7);
|
|
303
303
|
}
|
|
304
|
-
|
|
304
|
+
|
|
305
305
|
.activity-text {
|
|
306
306
|
.user-name {
|
|
307
307
|
color: var(--primary-light);
|
|
308
308
|
}
|
|
309
|
-
|
|
309
|
+
|
|
310
310
|
.action {
|
|
311
311
|
color: var(--text-inverse);
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
|
|
314
|
+
|
|
315
315
|
.activity-time {
|
|
316
316
|
color: rgba(255, 255, 255, 0.7);
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
|
|
319
319
|
.performance-header {
|
|
320
320
|
.metric-name {
|
|
321
321
|
color: var(--text-inverse);
|
|
322
322
|
}
|
|
323
|
-
|
|
323
|
+
|
|
324
324
|
.metric-value {
|
|
325
325
|
color: var(--primary-light);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
|
|
328
|
+
|
|
329
329
|
.performance-target {
|
|
330
330
|
color: rgba(255, 255, 255, 0.7);
|
|
331
331
|
}
|
|
332
|
-
|
|
332
|
+
|
|
333
333
|
.active-users-description {
|
|
334
334
|
color: rgba(255, 255, 255, 0.7);
|
|
335
335
|
}
|
|
336
|
-
|
|
336
|
+
|
|
337
337
|
.active-users-number {
|
|
338
338
|
.unit {
|
|
339
339
|
color: rgba(255, 255, 255, 0.7);
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
|
|
342
|
+
|
|
343
343
|
.ant-btn {
|
|
344
344
|
color: var(--text-inverse);
|
|
345
345
|
border-color: rgba(255, 255, 255, 0.3);
|
|
346
|
-
|
|
346
|
+
|
|
347
347
|
&:hover {
|
|
348
348
|
color: var(--text-inverse);
|
|
349
349
|
border-color: var(--primary-light);
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
|
|
352
|
+
|
|
353
353
|
.ant-tag {
|
|
354
354
|
color: var(--text-inverse);
|
|
355
355
|
border-color: rgba(255, 255, 255, 0.3);
|
|
356
356
|
}
|
|
357
|
-
|
|
357
|
+
|
|
358
358
|
.ant-progress-text {
|
|
359
359
|
color: var(--text-inverse);
|
|
360
360
|
}
|
package/src/template/antd-custom-cmp-template/src/components/{info-card → info-card2}/index.tsx
RENAMED
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { Avatar } from 'antd';
|
|
3
3
|
import { UserOutlined } from '@ant-design/icons';
|
|
4
4
|
import './style.scss'; // 组件内容样式
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
// import ChartWidget from 'chart-widget'; // 另一个自定义组件导出的模块
|
|
5
7
|
|
|
6
8
|
interface InfoCardProps {
|
|
7
9
|
title: string;
|
|
@@ -66,6 +68,24 @@ export default class InfoCard extends React.PureComponent<InfoCardProps> {
|
|
|
66
68
|
</div>
|
|
67
69
|
)}
|
|
68
70
|
</div>
|
|
71
|
+
{/*
|
|
72
|
+
<ChartWidget
|
|
73
|
+
chartType="line"
|
|
74
|
+
title="销售趋势"
|
|
75
|
+
subtitle="2025年数据"
|
|
76
|
+
width={800}
|
|
77
|
+
height={400}
|
|
78
|
+
mockData={{
|
|
79
|
+
xAxis: ['1月', '2月', '3月', '4月', '5月', '6月'],
|
|
80
|
+
series: [
|
|
81
|
+
{
|
|
82
|
+
name: '销售额',
|
|
83
|
+
data: [120, 200, 150, 80, 70, 110],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
*/}
|
|
69
89
|
</div>
|
|
70
90
|
);
|
|
71
91
|
}
|
|
@@ -39,12 +39,12 @@ module.exports = {
|
|
|
39
39
|
// babelPlugins: [],
|
|
40
40
|
},
|
|
41
41
|
neoCommonModule: {
|
|
42
|
-
// neoExports: [
|
|
42
|
+
// neoExports: [], // 自定义组件 共享出来的模块,支持数组和对象
|
|
43
43
|
neoExports: {
|
|
44
|
-
'
|
|
45
|
-
'neo-register':
|
|
44
|
+
'chart-widget': path.resolve('./src/components/chart-widget'), // 导出图表自定义组件
|
|
45
|
+
'neo-register': 'neo-register', // 导出 Neo 注册模块
|
|
46
46
|
},
|
|
47
|
-
neoExternals: [
|
|
47
|
+
// neoExternals: [], // 自定义组件 需要剔除的模块,仅支持数组写法
|
|
48
48
|
},
|
|
49
49
|
preview: {
|
|
50
50
|
// 用于开启本地预览模式的相关配置信息
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echarts-custom-cmp-template",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "neo自定义组件模板(react&ts技术栈)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"自定义组件模板",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@commitlint/config-conventional": "^9.1.1",
|
|
48
48
|
"@types/react": "^16.9.11",
|
|
49
49
|
"@types/react-dom": "^16.9.15",
|
|
50
|
-
"neo-cmp-cli": "^1.1.
|
|
50
|
+
"neo-cmp-cli": "^1.1.11",
|
|
51
51
|
"husky": "^4.2.5",
|
|
52
52
|
"lint-staged": "^10.2.9",
|
|
53
53
|
"prettier": "^2.0.5",
|
/package/src/template/antd-custom-cmp-template/src/components/{info-card → info-card2}/style.scss
RENAMED
|
File without changes
|