neo-cmp-cli 1.1.5 → 1.1.6
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 +4 -3
- package/src/config/default.config.js +5 -2
- package/src/config/index.js +1 -1
- package/src/module/main.js +9 -8
- package/src/neo/neoRequire.js +3 -2
- package/src/template/react-ts-custom-cmp-template/neo.config.js +1 -0
- package/src/template/react-ts-custom-cmp-template/src/components/info-card/index.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neo-cmp-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "前端脚手架:自定义组件开发工具,支持react 和 vue2.0技术栈。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neo-cli",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"url": "https://github.com/wibetter/neo-cmp-cli/issues"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"akfun": "^5.1.
|
|
44
|
+
"akfun": "^5.1.12",
|
|
45
45
|
"chalk": "^4.0.0",
|
|
46
46
|
"deepmerge": "^4.2.2",
|
|
47
47
|
"figlet": "^1.2.0",
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"webpack-sources": "^3.2.3",
|
|
52
52
|
"yargs": "^12.0.2",
|
|
53
53
|
"lodash": "^4.17.21",
|
|
54
|
-
"external-remotes-plugin": "^1.0.0"
|
|
54
|
+
"external-remotes-plugin": "^1.0.0",
|
|
55
|
+
"babel-plugin-import": "^1.13.8"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@commitlint/cli": "^8.3.5",
|
|
@@ -29,10 +29,13 @@ const defaultNEOConfig = {
|
|
|
29
29
|
createDeclaration: false, // 打包时是否创建ts声明文件
|
|
30
30
|
ignoreNodeModules: false, // 打包时是否忽略 node_modules
|
|
31
31
|
allowList: [], // ignoreNodeModules为true时生效
|
|
32
|
-
externals:
|
|
32
|
+
externals: {}, // 从输出的 bundle 中排除依赖
|
|
33
33
|
projectDir: ['src'],
|
|
34
34
|
template: resolveByDirname('../initData/defaultTemplate.html'), // 默认使用neo-widget提供的页面模板(会启动页面设计器)
|
|
35
|
-
sassResources: []
|
|
35
|
+
sassResources: [],
|
|
36
|
+
babelPlugins: [
|
|
37
|
+
['import', { libraryName: 'antd', style: 'css' }], // 配置 antd 的样式按需引入
|
|
38
|
+
],
|
|
36
39
|
},
|
|
37
40
|
envParams: {
|
|
38
41
|
// 项目系统环境变量
|
package/src/config/index.js
CHANGED
|
@@ -6,4 +6,4 @@ const defaultNEOConfig = require('./default.config');
|
|
|
6
6
|
const curProjectConfig = getConfigObj(resolve('neo.config.js'));
|
|
7
7
|
|
|
8
8
|
// 备注:数组类型则直接覆盖
|
|
9
|
-
module.exports = deepMergeConfig(defaultNEOConfig, curProjectConfig);
|
|
9
|
+
module.exports = deepMergeConfig(defaultNEOConfig, curProjectConfig);
|
package/src/module/main.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const akfun = require('akfun');
|
|
2
2
|
const path = require('path');
|
|
3
|
+
const _ = require('lodash');
|
|
3
4
|
const neoInit = require('./neoInit');
|
|
4
5
|
const neoInitByCopy = require('./neoInitByCopy');
|
|
5
6
|
const inspect = require('./inspect');
|
|
@@ -109,13 +110,13 @@ module.exports = {
|
|
|
109
110
|
curConfig.webpack.plugins = [new AddNeoRequirePlugin()];
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
// 添加 externals 配置
|
|
113
|
+
// 添加 内置 Neo 的 externals 配置
|
|
113
114
|
const neoExternals = getExternalsByNeoCommonModules();
|
|
114
115
|
if (
|
|
115
116
|
curConfig.dev.externals &&
|
|
116
|
-
|
|
117
|
+
_.isPlainObject(curConfig.dev.externals)
|
|
117
118
|
) {
|
|
118
|
-
curConfig.dev.externals.
|
|
119
|
+
curConfig.dev.externals = Object.assign(curConfig.dev.externals, neoExternals);
|
|
119
120
|
} else {
|
|
120
121
|
curConfig.dev.externals = neoExternals;
|
|
121
122
|
}
|
|
@@ -212,15 +213,15 @@ module.exports = {
|
|
|
212
213
|
curConfig.webpack.plugins = [new AddNeoRequirePlugin()];
|
|
213
214
|
}
|
|
214
215
|
|
|
215
|
-
// 添加 externals 配置
|
|
216
|
+
// 添加 内置 Neo 的 externals 配置
|
|
216
217
|
const neoExternals = getExternalsByNeoCommonModules();
|
|
217
218
|
if (
|
|
218
|
-
curConfig.
|
|
219
|
-
|
|
219
|
+
curConfig.dev.externals &&
|
|
220
|
+
_.isPlainObject(curConfig.dev.externals)
|
|
220
221
|
) {
|
|
221
|
-
curConfig.
|
|
222
|
+
curConfig.dev.externals = Object.assign(curConfig.dev.externals, neoExternals);
|
|
222
223
|
} else {
|
|
223
|
-
curConfig.
|
|
224
|
+
curConfig.dev.externals = neoExternals;
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
akfun.build('lib', curConfig, consoleTag, () => {
|
package/src/neo/neoRequire.js
CHANGED
|
@@ -17,7 +17,7 @@ const NeoCommonModules = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
// 根据 Neo 共享出来的依赖模块,获取 externals 配置
|
|
20
|
-
const
|
|
20
|
+
const getExternalsByNeoCommonModules = () => {
|
|
21
21
|
const neoExternals = {};
|
|
22
22
|
Object.keys(NeoCommonModules).forEach(moduleName => {
|
|
23
23
|
neoExternals[moduleName] = `commonjs ${moduleName}`;
|
|
@@ -25,7 +25,8 @@ const getExternalsByNeoCommonModulesV1 = () => {
|
|
|
25
25
|
return neoExternals;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
// 数组方式的 externals 失效,需要使用对象方式的 externals
|
|
29
|
+
const getExternalsByNeoCommonModulesV2 = () => {
|
|
29
30
|
return Object.keys(NeoCommonModules).map(moduleName => `commonjs ${moduleName}`);
|
|
30
31
|
};
|
|
31
32
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { Avatar } from 'antd';
|
|
3
|
+
import { UserOutlined } from '@ant-design/icons';
|
|
4
4
|
import './style.scss'; // 组件内容样式
|
|
5
5
|
|
|
6
6
|
interface InfoCardProps {
|
|
@@ -43,7 +43,7 @@ export default class InfoCard extends React.PureComponent<InfoCardProps> {
|
|
|
43
43
|
{title ||
|
|
44
44
|
'营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。'}
|
|
45
45
|
{systemInfo.tenantName ? `【${systemInfo.tenantName}】` : ''}
|
|
46
|
-
|
|
46
|
+
<Avatar size={64} icon={<UserOutlined />} />
|
|
47
47
|
</div>
|
|
48
48
|
<div className="item-imgbox">
|
|
49
49
|
{userInfo && userInfo.icon && (
|