neo-cmp-cli 1.8.6-beta.6 → 1.8.7
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/bin/index.js +2 -2
- package/package.json +3 -3
- package/src/config/auth.config.js +27 -0
- package/src/config/default.config.js +176 -0
- package/src/config/index.js +9 -0
- package/src/initData/defaultTemplate.html +13 -0
- package/src/initData/neo.config.js +138 -0
- package/src/main.js +221 -0
- package/src/module/inspect.js +41 -0
- package/src/module/neoInit.js +55 -0
- package/src/module/neoInitByCopy.js +61 -0
- package/src/neo/NeoUMDContent.js +30 -0
- package/src/neo/neoLogin.js +565 -0
- package/src/neo/neoRequire.js +125 -0
- package/src/neo/neoService.js +874 -0
- package/src/neo/webpack.mf.js +60 -0
- package/src/neo/wrapperContent.js +16 -0
- package/src/oss/publish2oss.js +348 -0
- package/src/plugins/AddNeoRequirePlugin-v1.js +47 -0
- package/src/plugins/AddNeoRequirePlugin.js +179 -0
- package/src/plugins/README.md +109 -0
- package/src/utils/autoEntryRootDir.js +85 -0
- package/src/utils/cmpUtils/createCmpByTemplate.js +60 -0
- package/src/utils/cmpUtils/createCmpByZip.js +408 -0
- package/src/utils/cmpUtils/createCommonModulesCode.js +121 -0
- package/src/utils/cmpUtils/deleteCmp.js +63 -0
- package/src/utils/cmpUtils/getCmpModelRegisterCode.js +31 -0
- package/src/utils/cmpUtils/getCmpPreviewCode.js +43 -0
- package/src/utils/cmpUtils/getCmpRegisterCode.js +31 -0
- package/src/utils/cmpUtils/getCmpTypeByDir.js +41 -0
- package/src/utils/cmpUtils/hasCmpTypeByDir.js +11 -0
- package/src/utils/cmpUtils/previewCmp.js +55 -0
- package/src/utils/cmpUtils/pullCmp.js +104 -0
- package/src/utils/cmpUtils/pushCmp.js +230 -0
- package/src/utils/common.js +107 -0
- package/src/utils/configureNeoBuild.js +109 -0
- package/src/utils/generateEntries.js +63 -0
- package/src/utils/neoConfigInit.js +13 -0
- package/src/utils/neoParams.js +12 -0
- package/src/utils/pathUtils.js +23 -0
- package/src/utils/projectNameValidator.js +76 -0
- package/src/utils/projectUtils/createCmpProjectByTemplate.js +59 -0
- package/src/utils/projectUtils/createCmpProjectZip.js +120 -0
- package/src/utils/projectUtils/getEntries.js +80 -0
- package/src/utils/projectUtils/getEntriesWithAutoRegister.js +108 -0
- package/src/utils/projectUtils/hasNeoProject.js +17 -0
- package/src/utils/projectUtils/openProject.js +96 -0
- package/src/utils/projectUtils/updatePublishLog.js +30 -0
- package/src/utils/replaceInFiles.js +47 -0
- package/src/utils/replaceInFilesByMap.js +54 -0
- package/src/utils/replaceInPackage.js +134 -0
- package/src/utils/resetPackageVersion.js +115 -0
- package/test/deprecate-versions.js +1 -1
- package/test/neo.config.js +1 -25
- package/dist/_virtual/AddNeoRequirePlugin.js +0 -8
- package/dist/_virtual/OverloadYield.js +0 -5
- package/dist/_virtual/_commonjsHelpers.js +0 -40
- package/dist/_virtual/array-set.js +0 -5
- package/dist/_virtual/base64-vlq.js +0 -5
- package/dist/_virtual/base64.js +0 -5
- package/dist/_virtual/binary-search.js +0 -5
- package/dist/_virtual/createCmpByZip.js +0 -8
- package/dist/_virtual/deleteCmp.js +0 -8
- package/dist/_virtual/index.js +0 -9
- package/dist/_virtual/mapping-list.js +0 -5
- package/dist/_virtual/neoLogin.js +0 -8
- package/dist/_virtual/neoService.js +0 -8
- package/dist/_virtual/openProject.js +0 -8
- package/dist/_virtual/publish2oss.js +0 -8
- package/dist/_virtual/pullCmp.js +0 -8
- package/dist/_virtual/pushCmp.js +0 -8
- package/dist/_virtual/quick-sort.js +0 -5
- package/dist/_virtual/regenerator.js +0 -5
- package/dist/_virtual/regeneratorAsync.js +0 -5
- package/dist/_virtual/regeneratorAsyncGen.js +0 -5
- package/dist/_virtual/regeneratorAsyncIterator.js +0 -5
- package/dist/_virtual/regeneratorDefine.js +0 -5
- package/dist/_virtual/regeneratorKeys.js +0 -5
- package/dist/_virtual/regeneratorRuntime.js +0 -5
- package/dist/_virtual/regeneratorValues.js +0 -5
- package/dist/_virtual/source-map-consumer.js +0 -5
- package/dist/_virtual/source-map-generator.js +0 -5
- package/dist/_virtual/source-map-support.js +0 -5
- package/dist/_virtual/source-map.js +0 -5
- package/dist/_virtual/source-node.js +0 -5
- package/dist/_virtual/typeof.js +0 -5
- package/dist/_virtual/typescript.js +0 -5
- package/dist/_virtual/util.js +0 -5
- package/dist/config/auth.config.js +0 -50
- package/dist/config/default.config.js +0 -225
- package/dist/config/index.js +0 -27
- package/dist/main.js +0 -9
- package/dist/main2.js +0 -261
- package/dist/module/inspect.js +0 -64
- package/dist/module/neoInit.js +0 -69
- package/dist/module/neoInitByCopy.js +0 -81
- package/dist/neo/neoLogin.js +0 -663
- package/dist/neo/neoRequire.js +0 -118
- package/dist/neo/neoService.js +0 -1246
- package/dist/node_modules/@babel/runtime/helpers/OverloadYield.js +0 -19
- package/dist/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +0 -29
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +0 -13
- package/dist/node_modules/@babel/runtime/helpers/regenerator.js +0 -105
- package/dist/node_modules/@babel/runtime/helpers/regeneratorAsync.js +0 -24
- package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js +0 -23
- package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js +0 -50
- package/dist/node_modules/@babel/runtime/helpers/regeneratorDefine.js +0 -37
- package/dist/node_modules/@babel/runtime/helpers/regeneratorKeys.js +0 -25
- package/dist/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +0 -98
- package/dist/node_modules/@babel/runtime/helpers/regeneratorValues.js +0 -35
- package/dist/node_modules/@babel/runtime/helpers/typeof.js +0 -25
- package/dist/node_modules/@babel/runtime/regenerator/index.js +0 -29
- package/dist/node_modules/buffer-from/index.js +0 -57
- package/dist/node_modules/source-map/lib/array-set.js +0 -134
- package/dist/node_modules/source-map/lib/base64-vlq.js +0 -144
- package/dist/node_modules/source-map/lib/base64.js +0 -81
- package/dist/node_modules/source-map/lib/binary-search.js +0 -122
- package/dist/node_modules/source-map/lib/mapping-list.js +0 -94
- package/dist/node_modules/source-map/lib/quick-sort.js +0 -126
- package/dist/node_modules/source-map/lib/source-map-consumer.js +0 -1018
- package/dist/node_modules/source-map/lib/source-map-generator.js +0 -385
- package/dist/node_modules/source-map/lib/source-node.js +0 -400
- package/dist/node_modules/source-map/lib/util.js +0 -449
- package/dist/node_modules/source-map/source-map.js +0 -25
- package/dist/node_modules/source-map-support/source-map-support.js +0 -610
- package/dist/node_modules/typescript/lib/typescript.js +0 -22376
- package/dist/oss/publish2oss.js +0 -378
- package/dist/plugins/AddNeoRequirePlugin.js +0 -178
- package/dist/utils/autoEntryRootDir.js +0 -98
- package/dist/utils/cmpUtils/createCmpByTemplate.js +0 -73
- package/dist/utils/cmpUtils/createCmpByZip.js +0 -530
- package/dist/utils/cmpUtils/createCommonModulesCode.js +0 -84
- package/dist/utils/cmpUtils/deleteCmp.js +0 -98
- package/dist/utils/cmpUtils/getCmpModelRegisterCode.js +0 -38
- package/dist/utils/cmpUtils/getCmpPreviewCode.js +0 -37
- package/dist/utils/cmpUtils/getCmpRegisterCode.js +0 -38
- package/dist/utils/cmpUtils/getCmpTypeByDir.js +0 -58
- package/dist/utils/cmpUtils/hasCmpTypeByDir.js +0 -25
- package/dist/utils/cmpUtils/previewCmp.js +0 -74
- package/dist/utils/cmpUtils/pullCmp.js +0 -144
- package/dist/utils/cmpUtils/pushCmp.js +0 -290
- package/dist/utils/common.js +0 -121
- package/dist/utils/configureNeoBuild.js +0 -153
- package/dist/utils/generateEntries.js +0 -73
- package/dist/utils/neoConfigInit.js +0 -25
- package/dist/utils/neoParams.js +0 -23
- package/dist/utils/pathUtils.js +0 -48
- package/dist/utils/projectNameValidator.js +0 -89
- package/dist/utils/projectUtils/createCmpProjectByTemplate.js +0 -74
- package/dist/utils/projectUtils/createCmpProjectZip.js +0 -135
- package/dist/utils/projectUtils/getEntries.js +0 -99
- package/dist/utils/projectUtils/getEntriesWithAutoRegister.js +0 -127
- package/dist/utils/projectUtils/hasNeoProject.js +0 -31
- package/dist/utils/projectUtils/openProject.js +0 -169
- package/dist/utils/projectUtils/updatePublishLog.js +0 -45
- package/dist/utils/replaceInFilesByMap.js +0 -70
- package/dist/utils/replaceInPackage.js +0 -151
- package/dist/utils/resetPackageVersion.js +0 -134
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const { gitClone } = require('akfun');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { consoleTag } = require('../utils/neoParams'); // 输出标记
|
|
4
|
+
const { replaceInPackage } = require('../utils/replaceInPackage');
|
|
5
|
+
const { resetPackageVersion } = require('../utils/resetPackageVersion');
|
|
6
|
+
const autoEntryRootDir = require('../utils/autoEntryRootDir');
|
|
7
|
+
|
|
8
|
+
const templateList = {
|
|
9
|
+
react: {
|
|
10
|
+
projectName: 'react-custom-cmp-template',
|
|
11
|
+
url: 'git@github.com:wibetter/react-custom-cmp-template.git'
|
|
12
|
+
},
|
|
13
|
+
'react-ts': {
|
|
14
|
+
projectName: 'react-ts-custom-cmp-template',
|
|
15
|
+
url: 'git@github.com:wibetter/react-ts-custom-cmp-template.git'
|
|
16
|
+
},
|
|
17
|
+
vue2: {
|
|
18
|
+
projectName: 'vue2-custom-cmp-template',
|
|
19
|
+
url: 'git@github.com:wibetter/vue2-custom-cmp-template.git'
|
|
20
|
+
}
|
|
21
|
+
/*
|
|
22
|
+
'vue3': {
|
|
23
|
+
projectName: 'vue3-neo-custom-widget',
|
|
24
|
+
url: 'git@github.com:wibetter/vue3-neo-custom-widget.git'
|
|
25
|
+
}
|
|
26
|
+
*/
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 通过 git clone 从 github 拉取并创建自定义组件
|
|
31
|
+
* @param {*} type 自定义组件类型
|
|
32
|
+
* @param {*} projectName 自定义组件项目名称
|
|
33
|
+
*/
|
|
34
|
+
const neoInit = function (type, projectName) {
|
|
35
|
+
const currentTemplate = templateList[type || 'react'];
|
|
36
|
+
const currentTemplateUrl = currentTemplate.url;
|
|
37
|
+
const finalProjectName = projectName || 'neoCustomCmp';
|
|
38
|
+
|
|
39
|
+
gitClone(
|
|
40
|
+
currentTemplateUrl,
|
|
41
|
+
finalProjectName,
|
|
42
|
+
() => {
|
|
43
|
+
// 克隆完成后,替换项目名称
|
|
44
|
+
replaceInPackage(finalProjectName, currentTemplate.projectName, finalProjectName);
|
|
45
|
+
replaceInPackage(finalProjectPath, 'wibetter', 'xxx');
|
|
46
|
+
replaceInPackage(finalProjectPath, 'neo自定义组件模板', 'neo自定义组件');
|
|
47
|
+
resetPackageVersion(finalProjectPath);
|
|
48
|
+
// 自动切换到项目根目录
|
|
49
|
+
autoEntryRootDir(finalProjectPath);
|
|
50
|
+
},
|
|
51
|
+
consoleTag
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
module.exports = neoInit;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { consoleTag } = require('../utils/neoParams'); // 输出标记
|
|
4
|
+
const { replaceInPackage } = require('../utils/replaceInPackage');
|
|
5
|
+
const { resetPackageVersion } = require('../utils/resetPackageVersion');
|
|
6
|
+
const autoEntryRootDir = require('../utils/autoEntryRootDir');
|
|
7
|
+
const { errorLog } = require('../utils/common');
|
|
8
|
+
|
|
9
|
+
const templateList = {
|
|
10
|
+
react: {
|
|
11
|
+
projectName: 'react-custom-cmp-template',
|
|
12
|
+
dir: path.resolve(__dirname, '../../template/react-custom-cmp-template')
|
|
13
|
+
},
|
|
14
|
+
'react-ts': {
|
|
15
|
+
projectName: 'react-ts-custom-cmp-template',
|
|
16
|
+
dir: path.resolve(__dirname, '../../template/react-ts-custom-cmp-template')
|
|
17
|
+
},
|
|
18
|
+
antd: {
|
|
19
|
+
projectName: 'antd-custom-cmp-template',
|
|
20
|
+
dir: path.resolve(__dirname, '../../template/antd-custom-cmp-template')
|
|
21
|
+
},
|
|
22
|
+
echarts: {
|
|
23
|
+
projectName: 'echarts-custom-cmp-template',
|
|
24
|
+
dir: path.resolve(__dirname, '../../template/echarts-custom-cmp-template')
|
|
25
|
+
},
|
|
26
|
+
neo: {
|
|
27
|
+
projectName: 'neo-custom-cmp-template',
|
|
28
|
+
dir: path.resolve(__dirname, '../../template/neo-custom-cmp-template')
|
|
29
|
+
},
|
|
30
|
+
vue2: {
|
|
31
|
+
projectName: 'vue2-custom-cmp-template',
|
|
32
|
+
dir: path.resolve(__dirname, '../../template/vue2-custom-cmp-template')
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 通过拷贝模板创建自定义组件
|
|
38
|
+
* @param {*} type 自定义组件类型
|
|
39
|
+
* @param {*} projectName 自定义组件项目名称
|
|
40
|
+
*/
|
|
41
|
+
const neoInitByCopy = function (type, projectName) {
|
|
42
|
+
const currentTemplate = templateList[type || 'react'];
|
|
43
|
+
const currentTemplateDir = currentTemplate.dir;
|
|
44
|
+
const finalProjectName = projectName || 'neoCustomCmp';
|
|
45
|
+
const finalProjectPath = path.resolve(process.cwd(), finalProjectName);
|
|
46
|
+
|
|
47
|
+
fs.copy(currentTemplateDir, finalProjectPath)
|
|
48
|
+
.then(() => {
|
|
49
|
+
replaceInPackage(finalProjectPath, currentTemplate.projectName, finalProjectName);
|
|
50
|
+
replaceInPackage(finalProjectPath, 'wibetter', 'xxx');
|
|
51
|
+
replaceInPackage(finalProjectPath, 'neo自定义组件模板', 'neo自定义组件');
|
|
52
|
+
resetPackageVersion(finalProjectPath);
|
|
53
|
+
|
|
54
|
+
console.log(`${consoleTag}已创建自定义组件(${finalProjectName})!`);
|
|
55
|
+
// 自动切换到项目根目录
|
|
56
|
+
autoEntryRootDir(finalProjectPath);
|
|
57
|
+
})
|
|
58
|
+
.catch((err) => errorLog(`${consoleTag}自定义组件模板下载失败:`, err));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
module.exports = neoInitByCopy;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 内置 UMD 模块,用于在 Node cli 端加载自定义组件模型
|
|
3
|
+
* 特别说明:这个文件内容会通过 AddNeoRequirePlugin 插入的构建代码中。
|
|
4
|
+
* 暂未使用,保留备用。
|
|
5
|
+
*/
|
|
6
|
+
(function (root, factory) {
|
|
7
|
+
// AMD 环境检测
|
|
8
|
+
if (typeof define === 'function' && define.amd) {
|
|
9
|
+
define([], factory);
|
|
10
|
+
}
|
|
11
|
+
// CommonJS 环境检测
|
|
12
|
+
else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
|
|
13
|
+
module.exports = factory();
|
|
14
|
+
}
|
|
15
|
+
// 浏览器全局变量
|
|
16
|
+
else {
|
|
17
|
+
root.NeoCustomCmpModel = factory();
|
|
18
|
+
}
|
|
19
|
+
})(typeof self !== 'undefined' ? self : this, function () {
|
|
20
|
+
'use strict';
|
|
21
|
+
|
|
22
|
+
const getCustomModels = (cmpType) => {
|
|
23
|
+
// 自定义组件模型列表
|
|
24
|
+
const NEOEditorCustomModels = window.NEOEditorCustomModels || {};
|
|
25
|
+
return NEOEditorCustomModels[cmpType] || {};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// 导出模块
|
|
29
|
+
return getCustomModels;
|
|
30
|
+
});
|