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
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var require$$0$1 = require('node:fs');
|
|
4
|
-
var require$$1 = require('node:path');
|
|
5
|
-
var require$$2 = require('lodash');
|
|
6
|
-
var require$$0 = require('akfun');
|
|
7
|
-
var pathUtils = require('../pathUtils.js');
|
|
8
|
-
var require$$3 = require('ora');
|
|
9
|
-
var neoService = require('../../_virtual/neoService.js');
|
|
10
|
-
var common = require('../common.js');
|
|
11
|
-
var createCmpProjectZip$1 = require('../projectUtils/createCmpProjectZip.js');
|
|
12
|
-
var _extends = require('../../node_modules/@babel/runtime/helpers/esm/extends.js');
|
|
13
|
-
var asyncToGenerator = require('../../node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js');
|
|
14
|
-
var index = require('../../_virtual/index.js');
|
|
15
|
-
|
|
16
|
-
var fs = require$$0$1;
|
|
17
|
-
var path = require$$1;
|
|
18
|
-
var _ = require$$2;
|
|
19
|
-
var _require = require$$0,
|
|
20
|
-
getConfigObj = _require.getConfigObj;
|
|
21
|
-
var _require2 = pathUtils.__require(),
|
|
22
|
-
catchCurPackageJson = _require2.catchCurPackageJson;
|
|
23
|
-
var ora = require$$3;
|
|
24
|
-
var NeoService = neoService;
|
|
25
|
-
var _require3 = common.__require(),
|
|
26
|
-
getFramework = _require3.getFramework,
|
|
27
|
-
errorLog = _require3.errorLog,
|
|
28
|
-
successLog = _require3.successLog;
|
|
29
|
-
var createCmpProjectZip = createCmpProjectZip$1.__require();
|
|
30
|
-
|
|
31
|
-
// 获取当前项目的package文件
|
|
32
|
-
var currentPackageJsonDir = catchCurPackageJson();
|
|
33
|
-
var currentPackageJson = getConfigObj(currentPackageJsonDir);
|
|
34
|
-
|
|
35
|
-
// 获取属性 propsSchema 数据结构
|
|
36
|
-
var getPropsSchema = function getPropsSchema(propsSchema) {
|
|
37
|
-
if (propsSchema === void 0) {
|
|
38
|
-
propsSchema = [];
|
|
39
|
-
}
|
|
40
|
-
return propsSchema.map(function (item) {
|
|
41
|
-
return {
|
|
42
|
-
label: item.label,
|
|
43
|
-
description: item.description,
|
|
44
|
-
propSchema: JSON.stringify(item)
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 构建组件数据映射
|
|
51
|
-
* @param {string} assetsRoot 构建产物的目录
|
|
52
|
-
* @param {object} cmpInfo 自定义组件信息
|
|
53
|
-
* @returns {Promise<object|null>} 自定义组件数据(含自定义组件模型信息)
|
|
54
|
-
*/
|
|
55
|
-
var buildComponentData = /*#__PURE__*/function () {
|
|
56
|
-
var _ref = asyncToGenerator(/*#__PURE__*/index.mark(function _callee(assetsRoot, cmpInfo) {
|
|
57
|
-
var cmpType, widgetName, modelFile, originalWindow, ModelClass, modelInstance, curCmpInfo, _t;
|
|
58
|
-
return index.wrap(function (_context) {
|
|
59
|
-
while (1) switch (_context.prev = _context.next) {
|
|
60
|
-
case 0:
|
|
61
|
-
if (!(!cmpInfo || !cmpInfo.cmpType)) {
|
|
62
|
-
_context.next = 1;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
errorLog('自定义组件信息或组件名称不能为空');
|
|
66
|
-
return _context.abrupt("return", null);
|
|
67
|
-
case 1:
|
|
68
|
-
cmpType = cmpInfo.cmpType;
|
|
69
|
-
if (!(!assetsRoot || !fs.existsSync(assetsRoot))) {
|
|
70
|
-
_context.next = 2;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
errorLog("\u672A\u627E\u5230\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u76EE\u5F55: " + assetsRoot);
|
|
74
|
-
return _context.abrupt("return", null);
|
|
75
|
-
case 2:
|
|
76
|
-
widgetName = _.camelCase(cmpType);
|
|
77
|
-
modelFile = path.join(assetsRoot, widgetName + "Model.js"); // 为 Node.js 环境设置全局 window 对象(模型文件可能需要)
|
|
78
|
-
// 使用 globalThis 以确保在 Node.js 和浏览器环境中都能工作
|
|
79
|
-
originalWindow = globalThis.window;
|
|
80
|
-
if (!globalThis.window) {
|
|
81
|
-
globalThis.window = {
|
|
82
|
-
console: console,
|
|
83
|
-
neoRequire: function neoRequire() {},
|
|
84
|
-
postMessage: function postMessage() {}
|
|
85
|
-
// 可以添加其他常用的 window 属性
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
_context.prev = 3;
|
|
89
|
-
// 加载自定义组件模型资源文件
|
|
90
|
-
if (fs.existsSync(modelFile)) {
|
|
91
|
-
// 加载自定义组件模型资源文件
|
|
92
|
-
require(modelFile); // 获取导出的模型类(可能是 default 导出或命名导出)
|
|
93
|
-
// const CatchCustomCmpModelClass = modelModule.default || modelModule;
|
|
94
|
-
} else {
|
|
95
|
-
errorLog("\u672A\u627E\u5230\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u6A21\u578B\u6587\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u4EE5\u4E0B\u8DEF\u5F84\u662F\u5426\u5B58\u5728\uFF1A" + modelFile);
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
98
|
-
if (!globalThis.window || !globalThis.window.NEOEditorCustomModels) {
|
|
99
|
-
errorLog("\u6A21\u578B\u6587\u4EF6\u672A\u5BFC\u51FA\u6709\u6548\u6A21\u578B\u65B9\u6CD5\uFF08CatchCustomCmpModelClass\uFF09\uFF0C\u6A21\u578B\u6587\u4EF6\u5730\u5740\uFF1A " + modelFile + " ");
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
ModelClass = globalThis.window.NEOEditorCustomModels[cmpType];
|
|
103
|
-
if (!ModelClass) {
|
|
104
|
-
errorLog("\u672A\u627E\u5230\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u6A21\u578B\u7C7B\uFF08" + cmpType + "\uFF09\uFF0C\u6A21\u578B\u6587\u4EF6\u5730\u5740\uFF1A " + modelFile + " ");
|
|
105
|
-
process.exit(1);
|
|
106
|
-
}
|
|
107
|
-
// 实例化模型类
|
|
108
|
-
modelInstance = new ModelClass();
|
|
109
|
-
if (!modelInstance) {
|
|
110
|
-
errorLog("\u672A\u627E\u5230\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u6A21\u578B\u4FE1\u606F\uFF08" + cmpType + "\uFF09\uFF0C\u6A21\u578B\u6587\u4EF6\u5730\u5740\uFF1A " + modelFile + " ");
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// 构建组件数据,合并模型实例的信息
|
|
115
|
-
curCmpInfo = _extends({}, cmpInfo, {
|
|
116
|
-
version: currentPackageJson.version || '1.0.0',
|
|
117
|
-
// 技术栈标识: 从 package.json / framework 字段获取,没有则默认 为 react ts 技术栈
|
|
118
|
-
framework: currentPackageJson.framework ? getFramework(currentPackageJson.framework) : 0,
|
|
119
|
-
// 0: React, 1: vue2, 2: jQuery, 3: vue3
|
|
120
|
-
// 从模型实例中提取并设置组件信息
|
|
121
|
-
label: modelInstance.label || cmpType,
|
|
122
|
-
description: modelInstance.description || '',
|
|
123
|
-
componentCategory: (modelInstance.tags || ['自定义组件']).join(','),
|
|
124
|
-
targetPage: modelInstance.targetPage || ['customPage'],
|
|
125
|
-
// 支持的页面类型
|
|
126
|
-
targetObject: modelInstance.targetObject || ['all'],
|
|
127
|
-
// 支持的实体类型
|
|
128
|
-
targetApplication: modelInstance.targetApplication || ['all'],
|
|
129
|
-
// 支持的应用类型
|
|
130
|
-
targetDevice: modelInstance.targetDevice || 'all',
|
|
131
|
-
// 支持的设备类型。只有这个字段是字符串数值,其他都是数组
|
|
132
|
-
iconUrl: modelInstance.iconSrc || modelInstance.iconUrl,
|
|
133
|
-
defaultProps: JSON.stringify(modelInstance.defaultComProps || {}),
|
|
134
|
-
previewProps: JSON.stringify(modelInstance.previewComProps || {}),
|
|
135
|
-
props: getPropsSchema(modelInstance.propsSchema || []),
|
|
136
|
-
events: modelInstance.events || [],
|
|
137
|
-
functions: modelInstance.functions || modelInstance.actions || [],
|
|
138
|
-
// 如果模型实例中有其他属性,也可以添加
|
|
139
|
-
exposedToDesigner: modelInstance.exposedToDesigner !== undefined ? modelInstance.exposedToDesigner : true,
|
|
140
|
-
namespace: modelInstance.namespace || 'neo-cmp-cli',
|
|
141
|
-
enableDuplicate: modelInstance.enableDuplicate !== undefined ? modelInstance.enableDuplicate : true
|
|
142
|
-
});
|
|
143
|
-
console.log("\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u6A21\u578B\u4FE1\u606F\uFF08" + cmpType + "\uFF09:", _.omit(curCmpInfo, ['assetFile', 'modelAssetFile', 'cssAssetFile', 'codeLibFile']));
|
|
144
|
-
return _context.abrupt("return", curCmpInfo);
|
|
145
|
-
case 4:
|
|
146
|
-
_context.prev = 4;
|
|
147
|
-
_t = _context["catch"](3);
|
|
148
|
-
errorLog("\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u6A21\u578B\u6587\u4EF6\u89E3\u6790\u5931\u8D25 (" + (modelFile || '未知路径') + "): " + _t.message);
|
|
149
|
-
errorLog(_t.stack);
|
|
150
|
-
return _context.abrupt("return", null);
|
|
151
|
-
case 5:
|
|
152
|
-
_context.prev = 5;
|
|
153
|
-
// 恢复原始的 window 对象(如果之前存在)
|
|
154
|
-
if (originalWindow === undefined) {
|
|
155
|
-
delete globalThis.window;
|
|
156
|
-
} else {
|
|
157
|
-
globalThis.window = originalWindow;
|
|
158
|
-
}
|
|
159
|
-
return _context.finish(5);
|
|
160
|
-
case 6:
|
|
161
|
-
case "end":
|
|
162
|
-
return _context.stop();
|
|
163
|
-
}
|
|
164
|
-
}, _callee, null, [[3, 4, 5, 6]]);
|
|
165
|
-
}));
|
|
166
|
-
return function buildComponentData(_x, _x2) {
|
|
167
|
-
return _ref.apply(this, arguments);
|
|
168
|
-
};
|
|
169
|
-
}();
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* 发布组件到 NeoCRM
|
|
173
|
-
* @param {object} config 配置信息
|
|
174
|
-
* @param {string} cmpType 自定义组件类型
|
|
175
|
-
*
|
|
176
|
-
* 发布流程说明
|
|
177
|
-
* 1. 打包源码文件:将自定义组件源码打包成 zip 文件
|
|
178
|
-
* 2. 上传构建产物到 OSS:将构建后的资源文件上传到 NeoCRM 平台提供的 CDN
|
|
179
|
-
* 3. 构建组件数据:从组件模型文件中提取组件信息
|
|
180
|
-
* 4. 保存组件信息到 NeoCRM 平台:将组件信息保存到平台数据库
|
|
181
|
-
*/
|
|
182
|
-
var pushCmp = /*#__PURE__*/function () {
|
|
183
|
-
var _ref2 = asyncToGenerator(/*#__PURE__*/index.mark(function _callee2(config, cmpType) {
|
|
184
|
-
var spinner, neoService, zipPath, cmpInfo, componentInfo, _t2, _t4;
|
|
185
|
-
return index.wrap(function (_context2) {
|
|
186
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
187
|
-
case 0:
|
|
188
|
-
spinner = ora('正在发布组件...').start();
|
|
189
|
-
_context2.prev = 1;
|
|
190
|
-
// 步骤 1: 初始化 NeoService
|
|
191
|
-
neoService = new NeoService(config); // 获取 token
|
|
192
|
-
_context2.next = 2;
|
|
193
|
-
return neoService.ensureValidToken();
|
|
194
|
-
case 2:
|
|
195
|
-
// 步骤 2: 打包源码文件(打包单个自定义组件源码)
|
|
196
|
-
spinner.start("[1/4] \u6253\u5305\u6E90\u7801\u6587\u4EF6\uFF08\u542B\u5355\u4E2A\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u6E90\u7801\uFF09...");
|
|
197
|
-
try {
|
|
198
|
-
zipPath = createCmpProjectZip(cmpType, process.cwd(), config.assetsRoot);
|
|
199
|
-
if (!zipPath) {
|
|
200
|
-
errorLog('[1/4] 源码文件打包失败,未返回 zip 文件路径。', spinner);
|
|
201
|
-
} else {
|
|
202
|
-
successLog("[1/4] \u6E90\u7801\u6587\u4EF6\u6253\u5305\u5B8C\u6210: " + path.basename(zipPath) + "\u3002", spinner);
|
|
203
|
-
}
|
|
204
|
-
} catch (error) {
|
|
205
|
-
errorLog("[1/4] \u6E90\u7801\u6587\u4EF6\u6253\u5305\u5931\u8D25\u3002", spinner);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/*
|
|
209
|
-
// 步骤 3: 上传构建后资源文件(改放在保存时直接上传组件资源文件)
|
|
210
|
-
spinner.start(`[2/4] 上传自定义组件构建产物到 OSS...`);
|
|
211
|
-
let cmpInfo;
|
|
212
|
-
try {
|
|
213
|
-
cmpInfo = await neoService.publish2oss(cmpType);
|
|
214
|
-
if (!cmpInfo || !cmpInfo.cmpType) {
|
|
215
|
-
errorLog('[2/4] 上传构建产物失败,未获取到组件信息。', spinner);
|
|
216
|
-
} else {
|
|
217
|
-
successLog(`[2/4] 构建产物上传完成。`, spinner);
|
|
218
|
-
}
|
|
219
|
-
} catch (error) {
|
|
220
|
-
errorLog(`[2/4] 构建产物上传失败。`, spinner);
|
|
221
|
-
}
|
|
222
|
-
*/
|
|
223
|
-
spinner.start("[2/4] \u83B7\u53D6\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u6784\u5EFA\u4EA7\u7269...");
|
|
224
|
-
_context2.next = 3;
|
|
225
|
-
return neoService.getCmpAssets(cmpType);
|
|
226
|
-
case 3:
|
|
227
|
-
cmpInfo = _context2.sent;
|
|
228
|
-
// 步骤 4: 构建组件数据
|
|
229
|
-
spinner.start("[3/4] \u6784\u5EFA\u7EC4\u4EF6\u6570\u636E...");
|
|
230
|
-
_context2.prev = 4;
|
|
231
|
-
_context2.next = 5;
|
|
232
|
-
return buildComponentData(config.assetsRoot, cmpInfo);
|
|
233
|
-
case 5:
|
|
234
|
-
componentInfo = _context2.sent;
|
|
235
|
-
if (!componentInfo) {
|
|
236
|
-
errorLog("[3/4] \u672A\u83B7\u53D6\u5230\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u6A21\u578B\u4FE1\u606F\uFF08" + cmpType + "\uFF09\u3002", spinner);
|
|
237
|
-
} else {
|
|
238
|
-
successLog("[3/4] \u7EC4\u4EF6\u6570\u636E\u6784\u5EFA\u5B8C\u6210\u3002", spinner);
|
|
239
|
-
}
|
|
240
|
-
_context2.next = 7;
|
|
241
|
-
break;
|
|
242
|
-
case 6:
|
|
243
|
-
_context2.prev = 6;
|
|
244
|
-
_t2 = _context2["catch"](4);
|
|
245
|
-
errorLog("[3/4] \u7EC4\u4EF6\u6570\u636E\u6784\u5EFA\u5931\u8D25: " + _t2.message, spinner);
|
|
246
|
-
case 7:
|
|
247
|
-
// 步骤 5: 保存组件信息
|
|
248
|
-
spinner.start("[4/4] \u4FDD\u5B58\u7EC4\u4EF6\u4FE1\u606F\u5230 NeoCRM \u5E73\u53F0...");
|
|
249
|
-
_context2.prev = 8;
|
|
250
|
-
_context2.next = 9;
|
|
251
|
-
return neoService.updateCustomComponent(componentInfo);
|
|
252
|
-
case 9:
|
|
253
|
-
successLog("[4/4] \u7EC4\u4EF6\u4FE1\u606F\u4FDD\u5B58\u6210\u529F", spinner);
|
|
254
|
-
_context2.next = 11;
|
|
255
|
-
break;
|
|
256
|
-
case 10:
|
|
257
|
-
_context2.prev = 10;
|
|
258
|
-
_context2["catch"](8);
|
|
259
|
-
errorLog("[4/4] \u7EC4\u4EF6\u4FE1\u606F\u4FDD\u5B58\u5931\u8D25", spinner);
|
|
260
|
-
case 11:
|
|
261
|
-
// 最终成功提示
|
|
262
|
-
console.log('\n✅ 自定义组件发布成功!');
|
|
263
|
-
_context2.next = 13;
|
|
264
|
-
break;
|
|
265
|
-
case 12:
|
|
266
|
-
_context2.prev = 12;
|
|
267
|
-
_t4 = _context2["catch"](1);
|
|
268
|
-
// 内层 catch 已经处理了步骤错误并显示了 spinner 失败状态
|
|
269
|
-
// 这里处理未预期的错误(如果 spinner 还在运行)
|
|
270
|
-
try {
|
|
271
|
-
// ora 的 spinner 对象可能没有 isSpinning 属性,使用 try-catch 安全访问
|
|
272
|
-
if (spinner && spinner.isSpinning) {
|
|
273
|
-
errorLog("\u274C \u81EA\u5B9A\u4E49\u7EC4\u4EF6\u53D1\u5E03\u5931\u8D25: " + _t4.message, spinner);
|
|
274
|
-
}
|
|
275
|
-
} catch (_unused) {
|
|
276
|
-
// 如果访问失败或 spinner 已停止,直接输出错误信息
|
|
277
|
-
errorLog("\n\u274C \u81EA\u5B9A\u4E49\u7EC4\u4EF6\u53D1\u5E03\u5931\u8D25: " + _t4.message);
|
|
278
|
-
}
|
|
279
|
-
throw _t4;
|
|
280
|
-
case 13:
|
|
281
|
-
case "end":
|
|
282
|
-
return _context2.stop();
|
|
283
|
-
}
|
|
284
|
-
}, _callee2, null, [[1, 12], [4, 6], [8, 10]]);
|
|
285
|
-
}));
|
|
286
|
-
return function pushCmp(_x3, _x4) {
|
|
287
|
-
return _ref2.apply(this, arguments);
|
|
288
|
-
};
|
|
289
|
-
}();
|
|
290
|
-
module.exports = pushCmp;
|
package/dist/utils/common.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var require$$0 = require('chalk');
|
|
4
|
-
var typescript = require('../node_modules/typescript/lib/typescript.js');
|
|
5
|
-
var neoParams = require('./neoParams.js');
|
|
6
|
-
|
|
7
|
-
var common;
|
|
8
|
-
var hasRequiredCommon;
|
|
9
|
-
|
|
10
|
-
function requireCommon () {
|
|
11
|
-
if (hasRequiredCommon) return common;
|
|
12
|
-
hasRequiredCommon = 1;
|
|
13
|
-
var chalk = require$$0;
|
|
14
|
-
var ts = typescript.__require();
|
|
15
|
-
var _require = neoParams.__require(),
|
|
16
|
-
consoleTag = _require.consoleTag;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 获取技术栈标识
|
|
20
|
-
* 目的:兼容用户非标准写法
|
|
21
|
-
* 0: React, 1: vue2, 2: jQuery, 3: vue3
|
|
22
|
-
*/
|
|
23
|
-
function getFramework(_framework) {
|
|
24
|
-
var defaultFramework = 0; // 默认 React 技术栈
|
|
25
|
-
if (!_framework) {
|
|
26
|
-
return defaultFramework;
|
|
27
|
-
}
|
|
28
|
-
var curFramework = _framework.toLowerCase().trim();
|
|
29
|
-
switch (curFramework) {
|
|
30
|
-
case 'jquery':
|
|
31
|
-
case 'jq':
|
|
32
|
-
curFramework = 2;
|
|
33
|
-
break;
|
|
34
|
-
case 'vue2':
|
|
35
|
-
case 'vue 2':
|
|
36
|
-
case 'vue2.0':
|
|
37
|
-
case 'vue 2.0':
|
|
38
|
-
curFramework = 1;
|
|
39
|
-
break;
|
|
40
|
-
case 'vue':
|
|
41
|
-
case 'vue3':
|
|
42
|
-
case 'vue 3':
|
|
43
|
-
case 'vue3.0':
|
|
44
|
-
case 'vue 3.0':
|
|
45
|
-
curFramework = 3;
|
|
46
|
-
errorLog('暂不支持 vue3.0 技术栈。');
|
|
47
|
-
break;
|
|
48
|
-
case 'react-js':
|
|
49
|
-
errorLog('暂不支持 react-js 技术栈。');
|
|
50
|
-
curFramework = 0;
|
|
51
|
-
break;
|
|
52
|
-
case 'react':
|
|
53
|
-
case 'react-ts':
|
|
54
|
-
curFramework = 0;
|
|
55
|
-
break;
|
|
56
|
-
default:
|
|
57
|
-
curFramework = 0;
|
|
58
|
-
}
|
|
59
|
-
return curFramework;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// 输出红色字体的错误日志
|
|
63
|
-
function errorLog(message, spinner) {
|
|
64
|
-
var errorMessage = consoleTag + " " + chalk.red(message);
|
|
65
|
-
if (spinner) {
|
|
66
|
-
spinner.fail(errorMessage);
|
|
67
|
-
} else {
|
|
68
|
-
console.error(errorMessage);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// 输出黄色字体的警告日志
|
|
73
|
-
function warningLog(message, spinner) {
|
|
74
|
-
var warningMessage = consoleTag + " " + chalk.yellow(message);
|
|
75
|
-
if (spinner) {
|
|
76
|
-
spinner.warn(warningMessage);
|
|
77
|
-
} else {
|
|
78
|
-
console.warn(warningMessage);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// 输出绿色字体的成功日志
|
|
83
|
-
function successLog(message, spinner) {
|
|
84
|
-
var successMessage = consoleTag + " " + chalk.green(message);
|
|
85
|
-
if (spinner) {
|
|
86
|
-
spinner.succeed(successMessage);
|
|
87
|
-
} else {
|
|
88
|
-
console.log(successMessage);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* 使用 TypeScript 官方 API 解析 tsconfig.json(推荐)
|
|
94
|
-
* 需要安装: npm install typescript --save-dev
|
|
95
|
-
* 优点: 官方支持,能正确处理 extends、注释等所有特性
|
|
96
|
-
*/
|
|
97
|
-
function parseTsConfigWithTypeScript(configPath) {
|
|
98
|
-
try {
|
|
99
|
-
var configFile = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
100
|
-
if (configFile.error) {
|
|
101
|
-
throw new Error("\u89E3\u6790 tsconfig.json \u5931\u8D25: " + configFile.error.messageText);
|
|
102
|
-
}
|
|
103
|
-
return configFile.config;
|
|
104
|
-
} catch (error) {
|
|
105
|
-
if (error.code === 'MODULE_NOT_FOUND') {
|
|
106
|
-
throw new Error('请先安装 typescript: npm install typescript --save-dev');
|
|
107
|
-
}
|
|
108
|
-
throw error;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
common = {
|
|
112
|
-
getFramework: getFramework,
|
|
113
|
-
errorLog: errorLog,
|
|
114
|
-
warningLog: warningLog,
|
|
115
|
-
successLog: successLog,
|
|
116
|
-
parseTsConfigWithTypeScript: parseTsConfigWithTypeScript
|
|
117
|
-
};
|
|
118
|
-
return common;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
exports.__require = requireCommon;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var require$$2 = require('lodash');
|
|
4
|
-
var AddNeoRequirePlugin = require('../_virtual/AddNeoRequirePlugin.js');
|
|
5
|
-
var createCommonModulesCode = require('./cmpUtils/createCommonModulesCode.js');
|
|
6
|
-
var neoRequire = require('../neo/neoRequire.js');
|
|
7
|
-
var index = require('../config/index.js');
|
|
8
|
-
|
|
9
|
-
var configureNeoBuild_1;
|
|
10
|
-
var hasRequiredConfigureNeoBuild;
|
|
11
|
-
|
|
12
|
-
function requireConfigureNeoBuild () {
|
|
13
|
-
if (hasRequiredConfigureNeoBuild) return configureNeoBuild_1;
|
|
14
|
-
hasRequiredConfigureNeoBuild = 1;
|
|
15
|
-
var _ = require$$2;
|
|
16
|
-
var AddNeoRequirePlugin$1 = AddNeoRequirePlugin;
|
|
17
|
-
var createCommonModulesCode$1 = createCommonModulesCode.__require();
|
|
18
|
-
var _require = neoRequire.__require(),
|
|
19
|
-
getExternalsByNeoCommonModules = _require.getExternalsByNeoCommonModules;
|
|
20
|
-
var curConfig = index.__require(); // 获取当前项目根目录下的配置文件
|
|
21
|
-
|
|
22
|
-
// neo.config.js 中的添加的 Neo 共享依赖模块配置
|
|
23
|
-
var neoCommonModule = curConfig.neoCommonModule || {};
|
|
24
|
-
// 自定义组件 需要剔除的依赖模块
|
|
25
|
-
var cmpNeoExternals = neoCommonModule.externals || [];
|
|
26
|
-
|
|
27
|
-
// 组件目录
|
|
28
|
-
curConfig.componentsDir || './src/components';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 添加 AddNeoRequirePlugin 到 webpack 配置
|
|
32
|
-
* @param {object} webpackConfig webpack 配置对象
|
|
33
|
-
* @param {object} [options] 选项
|
|
34
|
-
* @param {boolean} [options.verbose] 是否启用详细日志,默认为 false
|
|
35
|
-
*/
|
|
36
|
-
function addNeoRequirePlugin(webpackConfig, options) {
|
|
37
|
-
if (options === void 0) {
|
|
38
|
-
options = {};
|
|
39
|
-
}
|
|
40
|
-
var _options = options,
|
|
41
|
-
_options$verbose = _options.verbose,
|
|
42
|
-
verbose = _options$verbose === void 0 ? false : _options$verbose;
|
|
43
|
-
var plugin = new AddNeoRequirePlugin$1({
|
|
44
|
-
verbose: verbose
|
|
45
|
-
});
|
|
46
|
-
if (webpackConfig && webpackConfig.plugins && Array.isArray(webpackConfig.plugins)) {
|
|
47
|
-
webpackConfig.plugins.push(plugin);
|
|
48
|
-
} else {
|
|
49
|
-
webpackConfig.plugins = [plugin];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 添加 Neo externals 配置
|
|
55
|
-
* @param {object} config 配置对象(dev 或 build2lib)
|
|
56
|
-
* @param {object} externalsConfig 现有的 externals 配置
|
|
57
|
-
*/
|
|
58
|
-
function addNeoExternals(config, externalsConfig) {
|
|
59
|
-
var externals = getExternalsByNeoCommonModules(cmpNeoExternals);
|
|
60
|
-
if (externalsConfig && _.isPlainObject(externalsConfig)) {
|
|
61
|
-
config.externals = Object.assign(externalsConfig, externals);
|
|
62
|
-
} else {
|
|
63
|
-
config.externals = externals;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 创建并注入 commonModulesCode 到 entry
|
|
69
|
-
* @param {object} config 配置对象(dev 或 build2lib)
|
|
70
|
-
* @param {array} cmpTypes 组件类型列表
|
|
71
|
-
* @param {object} [options] 选项
|
|
72
|
-
* @param {boolean} [options.excludeModel] 是否排除 Model 结尾的 entry,默认为 false
|
|
73
|
-
*/
|
|
74
|
-
function injectCommonModulesCode(config, options) {
|
|
75
|
-
if (options === void 0) {
|
|
76
|
-
options = {};
|
|
77
|
-
}
|
|
78
|
-
var _options2 = options,
|
|
79
|
-
cmpTypes = _options2.cmpTypes,
|
|
80
|
-
defaultExports = _options2.defaultExports,
|
|
81
|
-
_options2$excludeMode = _options2.excludeModel,
|
|
82
|
-
excludeModel = _options2$excludeMode === void 0 ? false : _options2$excludeMode;
|
|
83
|
-
|
|
84
|
-
// 添加默认导出
|
|
85
|
-
if (defaultExports && _.isPlainObject(defaultExports)) {
|
|
86
|
-
if (neoCommonModule.exports && _.isPlainObject(neoCommonModule.exports)) {
|
|
87
|
-
neoCommonModule.exports = Object.assign(neoCommonModule.exports, defaultExports);
|
|
88
|
-
} else if (neoCommonModule.exports && _.isArray(neoCommonModule.exports)) {
|
|
89
|
-
// 先将数组格式改成对象格式
|
|
90
|
-
neoCommonModule.exports.forEach(function (item) {
|
|
91
|
-
if (_.isString(item)) {
|
|
92
|
-
neoCommonModule.exports[item] = item;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
neoCommonModule.exports = Object.assign(neoCommonModule.exports, defaultExports);
|
|
96
|
-
} else {
|
|
97
|
-
neoCommonModule.exports = defaultExports;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
var commonModulesFilePath = createCommonModulesCode$1(neoCommonModule, cmpTypes);
|
|
101
|
-
if (commonModulesFilePath && config.entry) {
|
|
102
|
-
Object.keys(config.entry).forEach(function (name) {
|
|
103
|
-
// 如果 excludeModel 为 true,排除 Model 结尾的文件
|
|
104
|
-
if (!excludeModel || !name.endsWith('Model')) {
|
|
105
|
-
config.entry[name] = [commonModulesFilePath].concat(config.entry[name]);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* 配置 webpack 插件、externals 和 commonModulesCode(用于 linkDebug、publish2oss、pushCmp)
|
|
113
|
-
* @param {object} config 配置对象(dev 或 build2lib)
|
|
114
|
-
* @param {object} [options] 选项
|
|
115
|
-
* @param {array} [options.cmpTypes] 组件类型列表
|
|
116
|
-
* @param {object} [options.defaultExports] 默认导出
|
|
117
|
-
* @param {boolean} [options.verbose] 是否启用详细日志,默认为 false
|
|
118
|
-
* @param {boolean} [options.excludeModel] 是否排除 Model 结尾的 entry,默认为 false
|
|
119
|
-
*/
|
|
120
|
-
function configureNeoBuild(config, options) {
|
|
121
|
-
if (options === void 0) {
|
|
122
|
-
options = {};
|
|
123
|
-
}
|
|
124
|
-
var _options3 = options,
|
|
125
|
-
cmpTypes = _options3.cmpTypes,
|
|
126
|
-
defaultExports = _options3.defaultExports,
|
|
127
|
-
_options3$verbose = _options3.verbose,
|
|
128
|
-
verbose = _options3$verbose === void 0 ? false : _options3$verbose,
|
|
129
|
-
_options3$excludeMode = _options3.excludeModel,
|
|
130
|
-
excludeModel = _options3$excludeMode === void 0 ? false : _options3$excludeMode;
|
|
131
|
-
|
|
132
|
-
// 添加自定义 webpack 插件
|
|
133
|
-
addNeoRequirePlugin(curConfig.webpack, {
|
|
134
|
-
verbose: verbose
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// 添加内置 Neo 的 externals 配置
|
|
138
|
-
addNeoExternals(config, config.externals);
|
|
139
|
-
|
|
140
|
-
// 创建并注入 commonModulesCode
|
|
141
|
-
injectCommonModulesCode(config, {
|
|
142
|
-
cmpTypes: cmpTypes,
|
|
143
|
-
defaultExports: defaultExports,
|
|
144
|
-
excludeModel: excludeModel
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
configureNeoBuild_1 = {
|
|
148
|
-
configureNeoBuild: configureNeoBuild
|
|
149
|
-
};
|
|
150
|
-
return configureNeoBuild_1;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
exports.__require = requireConfigureNeoBuild;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var getEntries = require('./projectUtils/getEntries.js');
|
|
4
|
-
var getEntriesWithAutoRegister = require('./projectUtils/getEntriesWithAutoRegister.js');
|
|
5
|
-
|
|
6
|
-
var generateEntries_1;
|
|
7
|
-
var hasRequiredGenerateEntries;
|
|
8
|
-
|
|
9
|
-
function requireGenerateEntries () {
|
|
10
|
-
if (hasRequiredGenerateEntries) return generateEntries_1;
|
|
11
|
-
hasRequiredGenerateEntries = 1;
|
|
12
|
-
var getEntries$1 = getEntries.__require();
|
|
13
|
-
var getEntriesWithAutoRegister$1 = getEntriesWithAutoRegister.__require();
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 生成 entry 配置
|
|
17
|
-
* @param {object} options 配置选项
|
|
18
|
-
* @param {object} options.configEntry 当前配置中的 entry(如果已存在则直接返回)
|
|
19
|
-
* @param {boolean} options.disableAutoRegister 是否禁用自动注册
|
|
20
|
-
* @param {string} options.componentsDir 组件目录路径
|
|
21
|
-
* @param {string} options.entryType entry 类型:'widget' | 'linkDebug',默认为 'widget'
|
|
22
|
-
* @param {string} [options.cmpType] 可选的组件类型,如果指定则只生成该组件的 entry
|
|
23
|
-
*/
|
|
24
|
-
function generateEntries(_ref) {
|
|
25
|
-
var configEntry = _ref.configEntry,
|
|
26
|
-
disableAutoRegister = _ref.disableAutoRegister,
|
|
27
|
-
componentsDir = _ref.componentsDir,
|
|
28
|
-
_ref$entryType = _ref.entryType,
|
|
29
|
-
entryType = _ref$entryType === void 0 ? 'widget' : _ref$entryType,
|
|
30
|
-
cmpType = _ref.cmpType;
|
|
31
|
-
// 如果已配置 entry 且不需要强制获取 cmpTypes,直接返回
|
|
32
|
-
if (configEntry && Object.keys(configEntry).length > 0) {
|
|
33
|
-
return {
|
|
34
|
-
entries: configEntry,
|
|
35
|
-
cmpTypes: []
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// 根据 disableAutoRegister 选择不同的生成方法
|
|
40
|
-
var entriesResult;
|
|
41
|
-
if (disableAutoRegister) {
|
|
42
|
-
// disableAutoRegister 为 true 时,仅自动生成入口文件(不自动注册)
|
|
43
|
-
entriesResult = getEntries$1(componentsDir, cmpType);
|
|
44
|
-
} else {
|
|
45
|
-
// 自动生成入口文件(并自动创建对应的注册文件)
|
|
46
|
-
entriesResult = getEntriesWithAutoRegister$1(componentsDir, cmpType);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// 根据 entryType 选择对应的 entries
|
|
50
|
-
var entries;
|
|
51
|
-
if (entryType === 'linkDebug') {
|
|
52
|
-
entries = entriesResult.linkDebugEntries || {};
|
|
53
|
-
} else {
|
|
54
|
-
entries = entriesResult.widgetEntries || {};
|
|
55
|
-
}
|
|
56
|
-
var cmpTypes = entriesResult.cmpTypes || [];
|
|
57
|
-
|
|
58
|
-
// 验证 entries 是否有效(仅在需要生成新 entry 时验证)
|
|
59
|
-
if (!entries || Object.keys(entries).length === 0) {
|
|
60
|
-
var defaultComponentsDir = componentsDir || './src/components';
|
|
61
|
-
throw new Error("\u672A\u8BC6\u522B\u5230\u81EA\u5B9A\u4E49\u7EC4\u4EF6\uFF0C\u8BF7\u68C0\u67E5 " + defaultComponentsDir + " \u76EE\u5F55\u4E0B\u662F\u5426\u5B58\u5728\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u3002");
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
entries: entries || configEntry || {},
|
|
65
|
-
cmpTypes: cmpTypes,
|
|
66
|
-
defaultExports: entriesResult.defaultExports || {}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
generateEntries_1 = generateEntries;
|
|
70
|
-
return generateEntries_1;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
exports.__require = requireGenerateEntries;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var require$$1 = require('node:path');
|
|
4
|
-
var require$$0 = require('akfun');
|
|
5
|
-
|
|
6
|
-
var neoConfigInit;
|
|
7
|
-
var hasRequiredNeoConfigInit;
|
|
8
|
-
|
|
9
|
-
function requireNeoConfigInit () {
|
|
10
|
-
if (hasRequiredNeoConfigInit) return neoConfigInit;
|
|
11
|
-
hasRequiredNeoConfigInit = 1;
|
|
12
|
-
var path = require$$1;
|
|
13
|
-
var _require = require$$0,
|
|
14
|
-
createFile = _require.createFile;
|
|
15
|
-
|
|
16
|
-
// 将脚手架的默认配置文件拷贝到当前项目根目录
|
|
17
|
-
var createDefaultConfig = function createDefaultConfig(_configProjectName) {
|
|
18
|
-
var configProjectName = _configProjectName || 'neo.config.js';
|
|
19
|
-
createFile(path.resolve(__dirname, "../initData/" + configProjectName), path.resolve(process.cwd(), "./" + configProjectName));
|
|
20
|
-
};
|
|
21
|
-
neoConfigInit = createDefaultConfig;
|
|
22
|
-
return neoConfigInit;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
exports.__require = requireNeoConfigInit;
|
package/dist/utils/neoParams.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var neoParams;
|
|
4
|
-
var hasRequiredNeoParams;
|
|
5
|
-
|
|
6
|
-
function requireNeoParams () {
|
|
7
|
-
if (hasRequiredNeoParams) return neoParams;
|
|
8
|
-
hasRequiredNeoParams = 1;
|
|
9
|
-
var consoleTag = '[neo-cmp-cli]'; // 输出标记
|
|
10
|
-
|
|
11
|
-
function setConsoleTag(newText) {
|
|
12
|
-
consoleTag = newText;
|
|
13
|
-
}
|
|
14
|
-
neoParams = {
|
|
15
|
-
get consoleTag() {
|
|
16
|
-
return consoleTag;
|
|
17
|
-
},
|
|
18
|
-
setConsoleTag: setConsoleTag
|
|
19
|
-
};
|
|
20
|
-
return neoParams;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
exports.__require = requireNeoParams;
|