neo-cmp-cli 1.8.7 → 1.8.8
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/dist/_virtual/_commonjsHelpers.js +12 -0
- package/dist/_virtual/array-set.js +7 -0
- package/dist/_virtual/base64-vlq.js +7 -0
- package/dist/_virtual/base64.js +7 -0
- package/dist/_virtual/binary-search.js +7 -0
- package/dist/_virtual/mapping-list.js +7 -0
- package/dist/_virtual/quick-sort.js +7 -0
- package/dist/_virtual/source-map-consumer.js +7 -0
- package/dist/_virtual/source-map-generator.js +7 -0
- package/dist/_virtual/source-map-support.js +7 -0
- package/dist/_virtual/source-map.js +7 -0
- package/dist/_virtual/source-node.js +7 -0
- package/dist/_virtual/typescript.js +7 -0
- package/dist/_virtual/util.js +7 -0
- package/dist/config/auth.config.js +43 -0
- package/dist/config/default.config.js +192 -0
- package/dist/config/index.js +26 -0
- package/dist/main.js +9 -0
- package/dist/main2.js +259 -0
- package/dist/module/inspect.js +63 -0
- package/dist/module/neoInit.js +75 -0
- package/dist/module/neoInitByCopy.js +83 -0
- package/dist/neo/neoLogin.js +590 -0
- package/dist/neo/neoRequire.js +123 -0
- package/dist/neo/neoService.js +898 -0
- package/dist/node_modules/buffer-from/index.js +86 -0
- package/dist/node_modules/source-map/lib/array-set.js +138 -0
- package/dist/node_modules/source-map/lib/base64-vlq.js +157 -0
- package/dist/node_modules/source-map/lib/base64.js +83 -0
- package/dist/node_modules/source-map/lib/binary-search.js +129 -0
- package/dist/node_modules/source-map/lib/mapping-list.js +96 -0
- package/dist/node_modules/source-map/lib/quick-sort.js +130 -0
- package/dist/node_modules/source-map/lib/source-map-consumer.js +1166 -0
- package/dist/node_modules/source-map/lib/source-map-generator.js +445 -0
- package/dist/node_modules/source-map/lib/source-node.js +431 -0
- package/dist/node_modules/source-map/lib/util.js +506 -0
- package/dist/node_modules/source-map/source-map.js +27 -0
- package/dist/node_modules/source-map-support/source-map-support.js +646 -0
- package/dist/node_modules/typescript/lib/typescript.js +174130 -0
- package/dist/oss/publish2oss.js +331 -0
- package/dist/plugins/AddNeoRequirePlugin.js +195 -0
- package/dist/utils/autoEntryRootDir.js +103 -0
- package/dist/utils/cmpUtils/createCmpByTemplate.js +82 -0
- package/dist/utils/cmpUtils/createCmpByZip.js +433 -0
- package/dist/utils/cmpUtils/createCommonModulesCode.js +139 -0
- package/dist/utils/cmpUtils/deleteCmp.js +81 -0
- package/dist/utils/cmpUtils/getCmpModelRegisterCode.js +47 -0
- package/dist/utils/cmpUtils/getCmpPreviewCode.js +60 -0
- package/dist/utils/cmpUtils/getCmpRegisterCode.js +47 -0
- package/dist/utils/cmpUtils/getCmpTypeByDir.js +59 -0
- package/dist/utils/cmpUtils/hasCmpTypeByDir.js +27 -0
- package/dist/utils/cmpUtils/previewCmp.js +75 -0
- package/dist/utils/cmpUtils/pullCmp.js +126 -0
- package/dist/utils/cmpUtils/pushCmp.js +254 -0
- package/dist/utils/common.js +125 -0
- package/dist/utils/configureNeoBuild.js +129 -0
- package/dist/utils/generateEntries.js +80 -0
- package/dist/utils/neoConfigInit.js +30 -0
- package/dist/utils/neoParams.js +26 -0
- package/dist/utils/pathUtils.js +40 -0
- package/dist/utils/projectNameValidator.js +90 -0
- package/dist/utils/projectUtils/createCmpProjectByTemplate.js +81 -0
- package/dist/utils/projectUtils/createCmpProjectZip.js +141 -0
- package/dist/utils/projectUtils/getEntries.js +99 -0
- package/dist/utils/projectUtils/getEntriesWithAutoRegister.js +129 -0
- package/dist/utils/projectUtils/hasNeoProject.js +34 -0
- package/dist/utils/projectUtils/openProject.js +117 -0
- package/dist/utils/projectUtils/updatePublishLog.js +47 -0
- package/dist/utils/replaceInFilesByMap.js +71 -0
- package/dist/utils/replaceInPackage.js +151 -0
- package/dist/utils/resetPackageVersion.js +132 -0
- package/package.json +6 -8
- package/test/demo.js +0 -2
- package/src/config/auth.config.js +0 -27
- package/src/config/default.config.js +0 -176
- package/src/config/index.js +0 -9
- package/src/initData/defaultTemplate.html +0 -13
- package/src/initData/neo.config.js +0 -138
- package/src/main.js +0 -221
- package/src/module/inspect.js +0 -41
- package/src/module/neoInit.js +0 -55
- package/src/module/neoInitByCopy.js +0 -61
- package/src/neo/NeoUMDContent.js +0 -30
- package/src/neo/neoLogin.js +0 -565
- package/src/neo/neoRequire.js +0 -125
- package/src/neo/neoService.js +0 -874
- package/src/neo/webpack.mf.js +0 -60
- package/src/neo/wrapperContent.js +0 -16
- package/src/oss/publish2oss.js +0 -348
- package/src/plugins/AddNeoRequirePlugin-v1.js +0 -47
- package/src/plugins/AddNeoRequirePlugin.js +0 -179
- package/src/plugins/README.md +0 -109
- package/src/utils/autoEntryRootDir.js +0 -85
- package/src/utils/cmpUtils/createCmpByTemplate.js +0 -60
- package/src/utils/cmpUtils/createCmpByZip.js +0 -408
- package/src/utils/cmpUtils/createCommonModulesCode.js +0 -121
- package/src/utils/cmpUtils/deleteCmp.js +0 -63
- package/src/utils/cmpUtils/getCmpModelRegisterCode.js +0 -31
- package/src/utils/cmpUtils/getCmpPreviewCode.js +0 -43
- package/src/utils/cmpUtils/getCmpRegisterCode.js +0 -31
- package/src/utils/cmpUtils/getCmpTypeByDir.js +0 -41
- package/src/utils/cmpUtils/hasCmpTypeByDir.js +0 -11
- package/src/utils/cmpUtils/previewCmp.js +0 -55
- package/src/utils/cmpUtils/pullCmp.js +0 -104
- package/src/utils/cmpUtils/pushCmp.js +0 -230
- package/src/utils/common.js +0 -107
- package/src/utils/configureNeoBuild.js +0 -109
- package/src/utils/generateEntries.js +0 -63
- package/src/utils/neoConfigInit.js +0 -13
- package/src/utils/neoParams.js +0 -12
- package/src/utils/pathUtils.js +0 -23
- package/src/utils/projectNameValidator.js +0 -76
- package/src/utils/projectUtils/createCmpProjectByTemplate.js +0 -59
- package/src/utils/projectUtils/createCmpProjectZip.js +0 -120
- package/src/utils/projectUtils/getEntries.js +0 -80
- package/src/utils/projectUtils/getEntriesWithAutoRegister.js +0 -108
- package/src/utils/projectUtils/hasNeoProject.js +0 -17
- package/src/utils/projectUtils/openProject.js +0 -96
- package/src/utils/projectUtils/updatePublishLog.js +0 -30
- package/src/utils/replaceInFiles.js +0 -47
- package/src/utils/replaceInFilesByMap.js +0 -54
- package/src/utils/replaceInPackage.js +0 -134
- package/src/utils/resetPackageVersion.js +0 -115
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const require$$1 = require('node:path');
|
|
6
|
+
const require$$3 = require('ora');
|
|
7
|
+
const require$$0$1 = require('node:fs');
|
|
8
|
+
const require$$0 = require('akfun');
|
|
9
|
+
const index = require('../config/index.js');
|
|
10
|
+
const neoParams = require('../utils/neoParams.js');
|
|
11
|
+
const common = require('../utils/common.js');
|
|
12
|
+
|
|
13
|
+
var inspect;
|
|
14
|
+
var hasRequiredInspect;
|
|
15
|
+
|
|
16
|
+
function requireInspect () {
|
|
17
|
+
if (hasRequiredInspect) return inspect;
|
|
18
|
+
hasRequiredInspect = 1;
|
|
19
|
+
const path = require$$1;
|
|
20
|
+
const ora = require$$3;
|
|
21
|
+
const fs = require$$0$1;
|
|
22
|
+
const { getCurWebpackConfig } = require$$0; // 用于获取当前webpack配置的方法
|
|
23
|
+
const curConfig = index.__require();
|
|
24
|
+
const { consoleTag } = neoParams.__require(); // 输出标记
|
|
25
|
+
const { errorLog, successLog } = common.__require();
|
|
26
|
+
|
|
27
|
+
// 根据当前配置文件内容创建指定名称的文件
|
|
28
|
+
const createConfigJs = function (fileName, fileCont) {
|
|
29
|
+
let filePath = path.resolve(process.cwd(), fileName);
|
|
30
|
+
|
|
31
|
+
fs.writeFile(filePath, JSON.stringify(fileCont, null, 2), (err) => {
|
|
32
|
+
if (err) {
|
|
33
|
+
throw Error(err);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 用于输出当前项目配置文件
|
|
40
|
+
*/
|
|
41
|
+
inspect = (type) => {
|
|
42
|
+
const spinner = ora(`${consoleTag}正在获取当前环境的配置数据...`).start();
|
|
43
|
+
if (type === 'dev') {
|
|
44
|
+
const devConfig = getCurWebpackConfig(type, curConfig);
|
|
45
|
+
createConfigJs('current-neo-dev-config.js', devConfig);
|
|
46
|
+
successLog(`当前配置数据已输出至 current-neo-dev-config.js中。`, spinner);
|
|
47
|
+
} else if (type === 'lib') {
|
|
48
|
+
const libraryConfig = getCurWebpackConfig(type, curConfig);
|
|
49
|
+
createConfigJs('current-neo-build2lib-config.js', libraryConfig);
|
|
50
|
+
successLog(`当前配置数据已输出至 current-neo-build2lib-config.js中。`, spinner);
|
|
51
|
+
} else if (type === 'build') {
|
|
52
|
+
const prodConfig = getCurWebpackConfig(type, curConfig);
|
|
53
|
+
// 默认输出生产环境的配置文件
|
|
54
|
+
createConfigJs('current-neo-build-config.js', prodConfig);
|
|
55
|
+
successLog(`当前配置数据已输出至 current-neo-build-config.js。`, spinner);
|
|
56
|
+
} else {
|
|
57
|
+
errorLog(`type 不能为空。`, spinner);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return inspect;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
exports.__require = requireInspect;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const require$$0 = require('akfun');
|
|
6
|
+
require('node:path');
|
|
7
|
+
const neoParams = require('../utils/neoParams.js');
|
|
8
|
+
const replaceInPackage = require('../utils/replaceInPackage.js');
|
|
9
|
+
const resetPackageVersion = require('../utils/resetPackageVersion.js');
|
|
10
|
+
const autoEntryRootDir = require('../utils/autoEntryRootDir.js');
|
|
11
|
+
|
|
12
|
+
var neoInit_1;
|
|
13
|
+
var hasRequiredNeoInit;
|
|
14
|
+
|
|
15
|
+
function requireNeoInit () {
|
|
16
|
+
if (hasRequiredNeoInit) return neoInit_1;
|
|
17
|
+
hasRequiredNeoInit = 1;
|
|
18
|
+
const { gitClone } = require$$0;
|
|
19
|
+
const { consoleTag } = neoParams.__require(); // 输出标记
|
|
20
|
+
const { replaceInPackage: replaceInPackage$1 } = replaceInPackage.__require();
|
|
21
|
+
const { resetPackageVersion: resetPackageVersion$1 } = resetPackageVersion.__require();
|
|
22
|
+
const autoEntryRootDir$1 = autoEntryRootDir.__require();
|
|
23
|
+
|
|
24
|
+
const templateList = {
|
|
25
|
+
react: {
|
|
26
|
+
projectName: 'react-custom-cmp-template',
|
|
27
|
+
url: 'git@github.com:wibetter/react-custom-cmp-template.git'
|
|
28
|
+
},
|
|
29
|
+
'react-ts': {
|
|
30
|
+
projectName: 'react-ts-custom-cmp-template',
|
|
31
|
+
url: 'git@github.com:wibetter/react-ts-custom-cmp-template.git'
|
|
32
|
+
},
|
|
33
|
+
vue2: {
|
|
34
|
+
projectName: 'vue2-custom-cmp-template',
|
|
35
|
+
url: 'git@github.com:wibetter/vue2-custom-cmp-template.git'
|
|
36
|
+
}
|
|
37
|
+
/*
|
|
38
|
+
'vue3': {
|
|
39
|
+
projectName: 'vue3-neo-custom-widget',
|
|
40
|
+
url: 'git@github.com:wibetter/vue3-neo-custom-widget.git'
|
|
41
|
+
}
|
|
42
|
+
*/
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 通过 git clone 从 github 拉取并创建自定义组件
|
|
47
|
+
* @param {*} type 自定义组件类型
|
|
48
|
+
* @param {*} projectName 自定义组件项目名称
|
|
49
|
+
*/
|
|
50
|
+
const neoInit = function (type, projectName) {
|
|
51
|
+
const currentTemplate = templateList[type || 'react'];
|
|
52
|
+
const currentTemplateUrl = currentTemplate.url;
|
|
53
|
+
const finalProjectName = projectName || 'neoCustomCmp';
|
|
54
|
+
|
|
55
|
+
gitClone(
|
|
56
|
+
currentTemplateUrl,
|
|
57
|
+
finalProjectName,
|
|
58
|
+
() => {
|
|
59
|
+
// 克隆完成后,替换项目名称
|
|
60
|
+
replaceInPackage$1(finalProjectName, currentTemplate.projectName, finalProjectName);
|
|
61
|
+
replaceInPackage$1(finalProjectPath, 'wibetter', 'xxx');
|
|
62
|
+
replaceInPackage$1(finalProjectPath, 'neo自定义组件模板', 'neo自定义组件');
|
|
63
|
+
resetPackageVersion$1(finalProjectPath);
|
|
64
|
+
// 自动切换到项目根目录
|
|
65
|
+
autoEntryRootDir$1(finalProjectPath);
|
|
66
|
+
},
|
|
67
|
+
consoleTag
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
neoInit_1 = neoInit;
|
|
72
|
+
return neoInit_1;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
exports.__require = requireNeoInit;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const require$$0 = require('fs-extra');
|
|
6
|
+
const require$$1 = require('node:path');
|
|
7
|
+
const neoParams = require('../utils/neoParams.js');
|
|
8
|
+
const replaceInPackage = require('../utils/replaceInPackage.js');
|
|
9
|
+
const resetPackageVersion = require('../utils/resetPackageVersion.js');
|
|
10
|
+
const autoEntryRootDir = require('../utils/autoEntryRootDir.js');
|
|
11
|
+
const common = require('../utils/common.js');
|
|
12
|
+
|
|
13
|
+
var neoInitByCopy_1;
|
|
14
|
+
var hasRequiredNeoInitByCopy;
|
|
15
|
+
|
|
16
|
+
function requireNeoInitByCopy () {
|
|
17
|
+
if (hasRequiredNeoInitByCopy) return neoInitByCopy_1;
|
|
18
|
+
hasRequiredNeoInitByCopy = 1;
|
|
19
|
+
const fs = require$$0;
|
|
20
|
+
const path = require$$1;
|
|
21
|
+
const { consoleTag } = neoParams.__require(); // 输出标记
|
|
22
|
+
const { replaceInPackage: replaceInPackage$1 } = replaceInPackage.__require();
|
|
23
|
+
const { resetPackageVersion: resetPackageVersion$1 } = resetPackageVersion.__require();
|
|
24
|
+
const autoEntryRootDir$1 = autoEntryRootDir.__require();
|
|
25
|
+
const { errorLog } = common.__require();
|
|
26
|
+
|
|
27
|
+
const templateList = {
|
|
28
|
+
react: {
|
|
29
|
+
projectName: 'react-custom-cmp-template',
|
|
30
|
+
dir: path.resolve(__dirname, '../../template/react-custom-cmp-template')
|
|
31
|
+
},
|
|
32
|
+
'react-ts': {
|
|
33
|
+
projectName: 'react-ts-custom-cmp-template',
|
|
34
|
+
dir: path.resolve(__dirname, '../../template/react-ts-custom-cmp-template')
|
|
35
|
+
},
|
|
36
|
+
antd: {
|
|
37
|
+
projectName: 'antd-custom-cmp-template',
|
|
38
|
+
dir: path.resolve(__dirname, '../../template/antd-custom-cmp-template')
|
|
39
|
+
},
|
|
40
|
+
echarts: {
|
|
41
|
+
projectName: 'echarts-custom-cmp-template',
|
|
42
|
+
dir: path.resolve(__dirname, '../../template/echarts-custom-cmp-template')
|
|
43
|
+
},
|
|
44
|
+
neo: {
|
|
45
|
+
projectName: 'neo-custom-cmp-template',
|
|
46
|
+
dir: path.resolve(__dirname, '../../template/neo-custom-cmp-template')
|
|
47
|
+
},
|
|
48
|
+
vue2: {
|
|
49
|
+
projectName: 'vue2-custom-cmp-template',
|
|
50
|
+
dir: path.resolve(__dirname, '../../template/vue2-custom-cmp-template')
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 通过拷贝模板创建自定义组件
|
|
56
|
+
* @param {*} type 自定义组件类型
|
|
57
|
+
* @param {*} projectName 自定义组件项目名称
|
|
58
|
+
*/
|
|
59
|
+
const neoInitByCopy = function (type, projectName) {
|
|
60
|
+
const currentTemplate = templateList[type || 'react'];
|
|
61
|
+
const currentTemplateDir = currentTemplate.dir;
|
|
62
|
+
const finalProjectName = projectName || 'neoCustomCmp';
|
|
63
|
+
const finalProjectPath = path.resolve(process.cwd(), finalProjectName);
|
|
64
|
+
|
|
65
|
+
fs.copy(currentTemplateDir, finalProjectPath)
|
|
66
|
+
.then(() => {
|
|
67
|
+
replaceInPackage$1(finalProjectPath, currentTemplate.projectName, finalProjectName);
|
|
68
|
+
replaceInPackage$1(finalProjectPath, 'wibetter', 'xxx');
|
|
69
|
+
replaceInPackage$1(finalProjectPath, 'neo自定义组件模板', 'neo自定义组件');
|
|
70
|
+
resetPackageVersion$1(finalProjectPath);
|
|
71
|
+
|
|
72
|
+
console.log(`${consoleTag}已创建自定义组件(${finalProjectName})!`);
|
|
73
|
+
// 自动切换到项目根目录
|
|
74
|
+
autoEntryRootDir$1(finalProjectPath);
|
|
75
|
+
})
|
|
76
|
+
.catch((err) => errorLog(`${consoleTag}自定义组件模板下载失败:`, err));
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
neoInitByCopy_1 = neoInitByCopy;
|
|
80
|
+
return neoInitByCopy_1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
exports.__require = requireNeoInitByCopy;
|