neo-cmp-cli 1.0.11 → 1.0.13
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/module/main.js +9 -0
- package/src/oss/publish2oss.js +5 -5
- package/src/template/react-custom-cmp-template/package.json +1 -1
- package/src/template/react-ts-custom-cmp-template/neo.config.js +7 -1
- package/src/template/react-ts-custom-cmp-template/package.json +2 -2
- package/src/template/react-ts-custom-cmp-template/src/preview.tsx +0 -0
- package/src/template/vue2-custom-cmp-template/package.json +1 -1
- package/src/utils/webpack.mf.js +4 -4
package/package.json
CHANGED
package/src/module/main.js
CHANGED
|
@@ -58,10 +58,13 @@ module.exports = {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/*
|
|
62
|
+
// 说明:自定义组件和平台模块联邦使用异常,所以暂时注释掉
|
|
61
63
|
// 添加模块联邦插件
|
|
62
64
|
if (curConfig.dev.enableMF) {
|
|
63
65
|
curConfig.webpack.plugins.push(...MFPlugins);
|
|
64
66
|
}
|
|
67
|
+
*/
|
|
65
68
|
|
|
66
69
|
akfun.dev(curConfig, consoleTag);
|
|
67
70
|
},
|
|
@@ -81,10 +84,13 @@ module.exports = {
|
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
87
|
+
/*
|
|
88
|
+
// 说明:自定义组件和平台模块联邦使用异常,所以暂时注释掉
|
|
84
89
|
if (curConfig.build2lib.enableMF) {
|
|
85
90
|
// 添加模块联邦插件
|
|
86
91
|
curConfig.webpack.plugins.push(...MFPlugins);
|
|
87
92
|
}
|
|
93
|
+
*/
|
|
88
94
|
|
|
89
95
|
akfun.build('lib', curConfig, consoleTag);
|
|
90
96
|
}, // 构建脚本:生产环境
|
|
@@ -107,10 +113,13 @@ module.exports = {
|
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
|
|
116
|
+
/*
|
|
117
|
+
// 说明:自定义组件和平台模块联邦使用异常,所以暂时注释掉
|
|
110
118
|
// 添加模块联邦插件
|
|
111
119
|
if (curConfig.publish2oss.enableMF) {
|
|
112
120
|
curConfig.webpack.plugins.push(...MFPlugins);
|
|
113
121
|
}
|
|
122
|
+
*/
|
|
114
123
|
|
|
115
124
|
akfun.build('lib', curConfig, consoleTag, () => {
|
|
116
125
|
// 构建完成后,执行 publish2oss
|
package/src/oss/publish2oss.js
CHANGED
|
@@ -182,8 +182,8 @@ const getResultFilesByWidgetName = (files) => {
|
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
184
|
let widgetName = file.widgetName;
|
|
185
|
-
if (widgetName.includes('
|
|
186
|
-
widgetName = widgetName.replace('
|
|
185
|
+
if (widgetName.includes('Model')) {
|
|
186
|
+
widgetName = widgetName.replace('Model', '');
|
|
187
187
|
}
|
|
188
188
|
if (widgetFilesMap[widgetName]) {
|
|
189
189
|
widgetFilesMap[widgetName].push(getResultFile(file));
|
|
@@ -196,7 +196,7 @@ const getResultFilesByWidgetName = (files) => {
|
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
// 文件名中添加当前项目版本号
|
|
199
|
-
function addVersionToFilename(filename, version = currentPackageJson.version) {
|
|
199
|
+
function addVersionToFilename(filename, version = currentPackageJson.version, projectName = currentPackageJson.name) {
|
|
200
200
|
// 找到最后一个点的位置,用于分离文件名和扩展名
|
|
201
201
|
let lastDotIndex = filename.lastIndexOf('.umd');
|
|
202
202
|
if (lastDotIndex === -1) {
|
|
@@ -210,7 +210,7 @@ function addVersionToFilename(filename, version = currentPackageJson.version) {
|
|
|
210
210
|
}
|
|
211
211
|
// 如果没有扩展名(没有点),直接在文件名后添加版本号
|
|
212
212
|
if (lastDotIndex === -1) {
|
|
213
|
-
return `${filename}-${version}`;
|
|
213
|
+
return `${projectName}/${filename}-${version}`;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
// 分离文件名的基础部分和扩展名
|
|
@@ -218,7 +218,7 @@ function addVersionToFilename(filename, version = currentPackageJson.version) {
|
|
|
218
218
|
const extension = filename.substring(lastDotIndex);
|
|
219
219
|
|
|
220
220
|
// 组合新的文件名:基础名-版本号.扩展名
|
|
221
|
-
return `${baseName}-${version}${extension}`;
|
|
221
|
+
return `${projectName}/${baseName}-${version}${extension}`;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
module.exports = publish2oss;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const path = require('path');
|
|
3
|
+
const webpack = require('webpack');
|
|
4
|
+
const { ModuleFederationPlugin } = require('webpack').container;
|
|
5
|
+
|
|
6
|
+
// 解析 webpack 模块联邦 remotes 中的变量
|
|
7
|
+
const ExternalTemplateRemotesPlugin = require('external-remotes-plugin');
|
|
8
|
+
|
|
3
9
|
|
|
4
10
|
// 统一路径解析
|
|
5
11
|
function resolve(dir) {
|
|
@@ -35,7 +41,7 @@ module.exports = {
|
|
|
35
41
|
allowList: [], // ignoreNodeModules为true时生效
|
|
36
42
|
projectDir: ['src'],
|
|
37
43
|
// template: resolve('./public/template.html'), // 自定义html模板
|
|
38
|
-
plugins: [],
|
|
44
|
+
// plugins: [],
|
|
39
45
|
babelPlugins: [],
|
|
40
46
|
},
|
|
41
47
|
preview: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-ts-custom-cmp-template",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
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.0.
|
|
50
|
+
"neo-cmp-cli": "^1.0.13",
|
|
51
51
|
"husky": "^4.2.5",
|
|
52
52
|
"lint-staged": "^10.2.9",
|
|
53
53
|
"prettier": "^2.0.5"
|
|
File without changes
|
package/src/utils/webpack.mf.js
CHANGED
|
@@ -34,13 +34,13 @@ const neoSharedDeps = {
|
|
|
34
34
|
|
|
35
35
|
const MFPlugins = [
|
|
36
36
|
new webpack.NormalModuleReplacementPlugin(/(.*)/, (resource) => {
|
|
37
|
-
if (
|
|
37
|
+
if (resource.request === 'react' || resource.request === 'react-dom') {
|
|
38
|
+
// 使用 Neo 提供的 react 和 react-dom
|
|
39
|
+
resource.request = `neoreact/${resource.request}`;
|
|
40
|
+
} else if (neoSharedDeps[resource.request]) {
|
|
38
41
|
// 使用 Neo 提供的其他依赖
|
|
39
42
|
const mfKey = resource.request.replace(/(\/|\.)/gi, '_'); // 换成 neo-ui-mf-base exposes 的 key
|
|
40
43
|
resource.request = `neobase/${mfKey}`;
|
|
41
|
-
} else if (['react', 'react-dom'].indexOf(resource.request) > -1) {
|
|
42
|
-
// 使用 Neo 提供的 react 和 react-dom
|
|
43
|
-
resource.request = `neoreact/${resource.request}`;
|
|
44
44
|
}
|
|
45
45
|
}),
|
|
46
46
|
new ModuleFederationPlugin({
|