neo-cmp-cli 1.1.3 → 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 +24 -0
- package/src/neo/neoRequire.js +9 -0
- package/src/plugins/AddNeoRequirePlugin.js +1 -1
- package/src/template/react-ts-custom-cmp-template/neo.config.js +1 -0
- package/src/template/react-ts-custom-cmp-template/package.json +1 -1
- 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');
|
|
@@ -11,6 +12,7 @@ const getEntries = require('../cmpUtils/getEntries');
|
|
|
11
12
|
const getEntriesWithAutoRegister = require('../cmpUtils/getEntriesWithAutoRegister');
|
|
12
13
|
const previewCmp = require('./previewCmp');
|
|
13
14
|
const AddNeoRequirePlugin = require('../plugins/AddNeoRequirePlugin');
|
|
15
|
+
const { getExternalsByNeoCommonModules } = require('../neo/neoRequire');
|
|
14
16
|
// const { MFPlugins } = require('../utils/webpack.mf');
|
|
15
17
|
|
|
16
18
|
const getValue = (originValue, defaultValue) => {
|
|
@@ -108,6 +110,17 @@ module.exports = {
|
|
|
108
110
|
curConfig.webpack.plugins = [new AddNeoRequirePlugin()];
|
|
109
111
|
}
|
|
110
112
|
|
|
113
|
+
// 添加 内置 Neo 的 externals 配置
|
|
114
|
+
const neoExternals = getExternalsByNeoCommonModules();
|
|
115
|
+
if (
|
|
116
|
+
curConfig.dev.externals &&
|
|
117
|
+
_.isPlainObject(curConfig.dev.externals)
|
|
118
|
+
) {
|
|
119
|
+
curConfig.dev.externals = Object.assign(curConfig.dev.externals, neoExternals);
|
|
120
|
+
} else {
|
|
121
|
+
curConfig.dev.externals = neoExternals;
|
|
122
|
+
}
|
|
123
|
+
|
|
111
124
|
akfun.dev(curConfig, consoleTag);
|
|
112
125
|
},
|
|
113
126
|
build: () => akfun.build('build', curConfig, consoleTag), // 构建脚本:生产环境
|
|
@@ -200,6 +213,17 @@ module.exports = {
|
|
|
200
213
|
curConfig.webpack.plugins = [new AddNeoRequirePlugin()];
|
|
201
214
|
}
|
|
202
215
|
|
|
216
|
+
// 添加 内置 Neo 的 externals 配置
|
|
217
|
+
const neoExternals = getExternalsByNeoCommonModules();
|
|
218
|
+
if (
|
|
219
|
+
curConfig.dev.externals &&
|
|
220
|
+
_.isPlainObject(curConfig.dev.externals)
|
|
221
|
+
) {
|
|
222
|
+
curConfig.dev.externals = Object.assign(curConfig.dev.externals, neoExternals);
|
|
223
|
+
} else {
|
|
224
|
+
curConfig.dev.externals = neoExternals;
|
|
225
|
+
}
|
|
226
|
+
|
|
203
227
|
akfun.build('lib', curConfig, consoleTag, () => {
|
|
204
228
|
// 构建完成后,执行 publish2oss
|
|
205
229
|
publish2oss(
|
package/src/neo/neoRequire.js
CHANGED
|
@@ -18,6 +18,15 @@ const NeoCommonModules = {
|
|
|
18
18
|
|
|
19
19
|
// 根据 Neo 共享出来的依赖模块,获取 externals 配置
|
|
20
20
|
const getExternalsByNeoCommonModules = () => {
|
|
21
|
+
const neoExternals = {};
|
|
22
|
+
Object.keys(NeoCommonModules).forEach(moduleName => {
|
|
23
|
+
neoExternals[moduleName] = `commonjs ${moduleName}`;
|
|
24
|
+
});
|
|
25
|
+
return neoExternals;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// 数组方式的 externals 失效,需要使用对象方式的 externals
|
|
29
|
+
const getExternalsByNeoCommonModulesV2 = () => {
|
|
21
30
|
return Object.keys(NeoCommonModules).map(moduleName => `commonjs ${moduleName}`);
|
|
22
31
|
};
|
|
23
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 && (
|