neo-cmp-cli 1.8.6-beta.2 → 1.8.6-beta.3
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/dist/_virtual/AddNeoRequirePlugin.js +8 -0
- package/dist/_virtual/OverloadYield.js +5 -0
- package/dist/_virtual/_commonjsHelpers.js +40 -0
- package/dist/_virtual/array-set.js +5 -0
- package/dist/_virtual/base64-vlq.js +5 -0
- package/dist/_virtual/base64.js +5 -0
- package/dist/_virtual/binary-search.js +5 -0
- package/dist/_virtual/createCmpByZip.js +8 -0
- package/dist/_virtual/deleteCmp.js +8 -0
- package/dist/_virtual/index.js +9 -0
- package/dist/_virtual/mapping-list.js +5 -0
- package/dist/_virtual/neoLogin.js +8 -0
- package/dist/_virtual/neoService.js +8 -0
- package/dist/_virtual/openProject.js +8 -0
- package/dist/_virtual/publish2oss.js +8 -0
- package/dist/_virtual/pullCmp.js +8 -0
- package/dist/_virtual/pushCmp.js +8 -0
- package/dist/_virtual/quick-sort.js +5 -0
- package/dist/_virtual/regenerator.js +5 -0
- package/dist/_virtual/regeneratorAsync.js +5 -0
- package/dist/_virtual/regeneratorAsyncGen.js +5 -0
- package/dist/_virtual/regeneratorAsyncIterator.js +5 -0
- package/dist/_virtual/regeneratorDefine.js +5 -0
- package/dist/_virtual/regeneratorKeys.js +5 -0
- package/dist/_virtual/regeneratorRuntime.js +5 -0
- package/dist/_virtual/regeneratorValues.js +5 -0
- package/dist/_virtual/source-map-consumer.js +5 -0
- package/dist/_virtual/source-map-generator.js +5 -0
- package/dist/_virtual/source-map-support.js +5 -0
- package/dist/_virtual/source-map.js +5 -0
- package/dist/_virtual/source-node.js +5 -0
- package/dist/_virtual/typeof.js +5 -0
- package/dist/_virtual/typescript.js +5 -0
- package/dist/_virtual/util.js +5 -0
- package/dist/config/auth.config.js +50 -0
- package/dist/config/default.config.js +225 -0
- package/dist/config/index.js +27 -0
- package/dist/main.js +9 -0
- package/dist/main2.js +261 -0
- package/dist/module/inspect.js +64 -0
- package/dist/module/neoInit.js +69 -0
- package/dist/module/neoInitByCopy.js +81 -0
- package/dist/neo/neoLogin.js +663 -0
- package/dist/neo/neoRequire.js +118 -0
- package/dist/neo/neoService.js +1246 -0
- package/dist/node_modules/@babel/runtime/helpers/OverloadYield.js +19 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +29 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -0
- package/dist/node_modules/@babel/runtime/helpers/regenerator.js +105 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorAsync.js +24 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncGen.js +23 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorAsyncIterator.js +50 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorDefine.js +37 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorKeys.js +25 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +98 -0
- package/dist/node_modules/@babel/runtime/helpers/regeneratorValues.js +35 -0
- package/dist/node_modules/@babel/runtime/helpers/typeof.js +25 -0
- package/dist/node_modules/@babel/runtime/regenerator/index.js +29 -0
- package/dist/node_modules/buffer-from/index.js +57 -0
- package/dist/node_modules/source-map/lib/array-set.js +134 -0
- package/dist/node_modules/source-map/lib/base64-vlq.js +144 -0
- package/dist/node_modules/source-map/lib/base64.js +81 -0
- package/dist/node_modules/source-map/lib/binary-search.js +122 -0
- package/dist/node_modules/source-map/lib/mapping-list.js +94 -0
- package/dist/node_modules/source-map/lib/quick-sort.js +126 -0
- package/dist/node_modules/source-map/lib/source-map-consumer.js +1018 -0
- package/dist/node_modules/source-map/lib/source-map-generator.js +385 -0
- package/dist/node_modules/source-map/lib/source-node.js +400 -0
- package/dist/node_modules/source-map/lib/util.js +449 -0
- package/dist/node_modules/source-map/source-map.js +25 -0
- package/dist/node_modules/source-map-support/source-map-support.js +610 -0
- package/dist/node_modules/typescript/lib/typescript.js +22376 -0
- package/dist/oss/publish2oss.js +378 -0
- package/dist/plugins/AddNeoRequirePlugin.js +178 -0
- package/dist/utils/autoEntryRootDir.js +98 -0
- package/dist/utils/cmpUtils/createCmpByTemplate.js +73 -0
- package/dist/utils/cmpUtils/createCmpByZip.js +530 -0
- package/dist/utils/cmpUtils/createCommonModulesCode.js +84 -0
- package/dist/utils/cmpUtils/deleteCmp.js +98 -0
- package/dist/utils/cmpUtils/getCmpModelRegisterCode.js +38 -0
- package/dist/utils/cmpUtils/getCmpPreviewCode.js +37 -0
- package/dist/utils/cmpUtils/getCmpRegisterCode.js +38 -0
- package/dist/utils/cmpUtils/getCmpTypeByDir.js +58 -0
- package/dist/utils/cmpUtils/hasCmpTypeByDir.js +25 -0
- package/dist/utils/cmpUtils/previewCmp.js +74 -0
- package/dist/utils/cmpUtils/pullCmp.js +144 -0
- package/dist/utils/cmpUtils/pushCmp.js +290 -0
- package/dist/utils/common.js +121 -0
- package/dist/utils/configureNeoBuild.js +153 -0
- package/dist/utils/generateEntries.js +73 -0
- package/dist/utils/neoConfigInit.js +25 -0
- package/dist/utils/neoParams.js +23 -0
- package/dist/utils/pathUtils.js +48 -0
- package/dist/utils/projectNameValidator.js +89 -0
- package/dist/utils/projectUtils/createCmpProjectByTemplate.js +74 -0
- package/dist/utils/projectUtils/createCmpProjectZip.js +135 -0
- package/dist/utils/projectUtils/getEntries.js +99 -0
- package/dist/utils/projectUtils/getEntriesWithAutoRegister.js +127 -0
- package/dist/utils/projectUtils/hasNeoProject.js +31 -0
- package/dist/utils/projectUtils/openProject.js +168 -0
- package/dist/utils/projectUtils/updatePublishLog.js +45 -0
- package/dist/utils/replaceInFilesByMap.js +70 -0
- package/dist/utils/replaceInPackage.js +151 -0
- package/dist/utils/resetPackageVersion.js +134 -0
- package/package.json +2 -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/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 -94
- 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
package/dist/main2.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var require$$0 = require('akfun');
|
|
4
|
+
require('lodash');
|
|
5
|
+
var neoInit = require('./module/neoInit.js');
|
|
6
|
+
var neoInitByCopy = require('./module/neoInitByCopy.js');
|
|
7
|
+
var inspect = require('./module/inspect.js');
|
|
8
|
+
var neoConfigInit = require('./utils/neoConfigInit.js');
|
|
9
|
+
var neoParams = require('./utils/neoParams.js');
|
|
10
|
+
var index = require('./config/index.js');
|
|
11
|
+
var publish2oss = require('./_virtual/publish2oss.js');
|
|
12
|
+
var pushCmp = require('./_virtual/pushCmp.js');
|
|
13
|
+
var previewCmp = require('./utils/cmpUtils/previewCmp.js');
|
|
14
|
+
var generateEntries = require('./utils/generateEntries.js');
|
|
15
|
+
var createCmpByTemplate = require('./utils/cmpUtils/createCmpByTemplate.js');
|
|
16
|
+
var createCmpProjectByTemplate = require('./utils/projectUtils/createCmpProjectByTemplate.js');
|
|
17
|
+
var pullCmp = require('./_virtual/pullCmp.js');
|
|
18
|
+
var deleteCmp = require('./_virtual/deleteCmp.js');
|
|
19
|
+
var openProject = require('./_virtual/openProject.js');
|
|
20
|
+
var configureNeoBuild = require('./utils/configureNeoBuild.js');
|
|
21
|
+
var common = require('./utils/common.js');
|
|
22
|
+
var projectNameValidator = require('./utils/projectNameValidator.js');
|
|
23
|
+
var getCmpTypeByDir = require('./utils/cmpUtils/getCmpTypeByDir.js');
|
|
24
|
+
var neoService = require('./_virtual/neoService.js');
|
|
25
|
+
var neoLogin = require('./_virtual/neoLogin.js');
|
|
26
|
+
var hasNeoProject = require('./utils/projectUtils/hasNeoProject.js');
|
|
27
|
+
|
|
28
|
+
var main;
|
|
29
|
+
var hasRequiredMain;
|
|
30
|
+
|
|
31
|
+
function requireMain () {
|
|
32
|
+
if (hasRequiredMain) return main;
|
|
33
|
+
hasRequiredMain = 1;
|
|
34
|
+
var akfun = require$$0;
|
|
35
|
+
var neoInit$1 = neoInit.__require();
|
|
36
|
+
var neoInitByCopy$1 = neoInitByCopy.__require();
|
|
37
|
+
var inspect$1 = inspect.__require();
|
|
38
|
+
var neoConfigInit$1 = neoConfigInit.__require();
|
|
39
|
+
var _require = neoParams.__require(),
|
|
40
|
+
consoleTag = _require.consoleTag;
|
|
41
|
+
var curConfig = index.__require(); // 获取当前项目根目录下的配置文件
|
|
42
|
+
var _publish2oss = publish2oss;
|
|
43
|
+
var _pushCmp = pushCmp;
|
|
44
|
+
var _previewCmp = previewCmp.__require();
|
|
45
|
+
var generateEntries$1 = generateEntries.__require();
|
|
46
|
+
// const { MFPlugins } = require('./neo/webpack.mf');
|
|
47
|
+
var createCmpByTemplate$1 = createCmpByTemplate.__require();
|
|
48
|
+
var createCmpProjectByTemplate$1 = createCmpProjectByTemplate.__require();
|
|
49
|
+
var _pullCmp = pullCmp;
|
|
50
|
+
var _deleteCmp = deleteCmp;
|
|
51
|
+
var openProject$1 = openProject;
|
|
52
|
+
var _require2 = configureNeoBuild.__require(),
|
|
53
|
+
configureNeoBuild$1 = _require2.configureNeoBuild;
|
|
54
|
+
var _require3 = common.__require(),
|
|
55
|
+
errorLog = _require3.errorLog,
|
|
56
|
+
successLog = _require3.successLog;
|
|
57
|
+
// 导出工具函数
|
|
58
|
+
var _require4 = projectNameValidator.__require(),
|
|
59
|
+
validateProjectName = _require4.validateProjectName;
|
|
60
|
+
var getCmpTypeByDir$1 = getCmpTypeByDir.__require();
|
|
61
|
+
var NeoService = neoService;
|
|
62
|
+
var NeoLoginService = neoLogin;
|
|
63
|
+
var hasNeoProject$1 = hasNeoProject.__require();
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 生成并设置 entry 配置
|
|
67
|
+
* @param {object} config 配置对象(dev 或 build2lib)
|
|
68
|
+
* @param {object} options 生成选项
|
|
69
|
+
* @param {string} options.entryType entry 类型:'widget' | 'linkDebug'
|
|
70
|
+
* @param {string} [options.cmpType] 可选的组件类型
|
|
71
|
+
* @returns {array} cmpTypes 组件类型列表
|
|
72
|
+
*/
|
|
73
|
+
function setupEntries(config, options) {
|
|
74
|
+
var entryType = options.entryType,
|
|
75
|
+
cmpType = options.cmpType;
|
|
76
|
+
var cmpTypes = [];
|
|
77
|
+
var defaultExports = {};
|
|
78
|
+
try {
|
|
79
|
+
var _generateEntries = generateEntries$1({
|
|
80
|
+
configEntry: config.entry,
|
|
81
|
+
disableAutoRegister: config.disableAutoRegister,
|
|
82
|
+
componentsDir: curConfig.componentsDir,
|
|
83
|
+
entryType: entryType,
|
|
84
|
+
cmpType: cmpType
|
|
85
|
+
}),
|
|
86
|
+
entries = _generateEntries.entries,
|
|
87
|
+
generatedCmpTypes = _generateEntries.cmpTypes,
|
|
88
|
+
generatedDefaultExports = _generateEntries.defaultExports;
|
|
89
|
+
if (entries && Object.keys(entries).length > 0) {
|
|
90
|
+
config.entry = entries;
|
|
91
|
+
cmpTypes = generatedCmpTypes;
|
|
92
|
+
console.info('已自动生成 entry 入口配置:', entries);
|
|
93
|
+
}
|
|
94
|
+
defaultExports = generatedDefaultExports;
|
|
95
|
+
} catch (error) {
|
|
96
|
+
errorLog(error.message);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
cmpTypes: cmpTypes,
|
|
101
|
+
defaultExports: defaultExports
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 准备 build2lib 配置(用于 publish2oss 和 pushCmp)
|
|
107
|
+
* @param {object} sourceConfig 源配置对象
|
|
108
|
+
* @returns {object} 合并后的配置对象
|
|
109
|
+
*/
|
|
110
|
+
function prepareBuild2LibConfig(sourceConfig) {
|
|
111
|
+
return Object.assign(curConfig.build2lib, sourceConfig);
|
|
112
|
+
}
|
|
113
|
+
main = {
|
|
114
|
+
neoInit: neoInit$1,
|
|
115
|
+
neoInitByCopy: neoInitByCopy$1,
|
|
116
|
+
inspect: inspect$1,
|
|
117
|
+
neoConfigInit: neoConfigInit$1,
|
|
118
|
+
projectConfig: curConfig,
|
|
119
|
+
consoleTag: consoleTag,
|
|
120
|
+
errorLog: errorLog,
|
|
121
|
+
successLog: successLog,
|
|
122
|
+
validateProjectName: validateProjectName,
|
|
123
|
+
getCmpTypeByDir: getCmpTypeByDir$1,
|
|
124
|
+
NeoService: NeoService,
|
|
125
|
+
NeoLoginService: NeoLoginService,
|
|
126
|
+
hasNeoProject: hasNeoProject$1,
|
|
127
|
+
createCmpProjectByTemplate: createCmpProjectByTemplate$1,
|
|
128
|
+
createCmpByTemplate: createCmpByTemplate$1,
|
|
129
|
+
dev: function dev() {
|
|
130
|
+
if (!curConfig.dev) {
|
|
131
|
+
errorLog('未找到 dev 相关配置。');
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
akfun.dev(curConfig, consoleTag);
|
|
135
|
+
},
|
|
136
|
+
previewCmp: function previewCmp(cmpName) {
|
|
137
|
+
// 预览组件本身内容
|
|
138
|
+
if (!cmpName) {
|
|
139
|
+
errorLog('请输入要预览的组件名称。');
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
if (!curConfig.preview) {
|
|
143
|
+
errorLog('未找到 preview 相关配置。');
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
curConfig.dev = Object.assign(curConfig.dev, curConfig.preview); // 将 preview 设置给 dev
|
|
147
|
+
delete curConfig.preview;
|
|
148
|
+
_previewCmp(curConfig, cmpName);
|
|
149
|
+
},
|
|
150
|
+
linkDebug: function linkDebug() {
|
|
151
|
+
// 外链调试模式
|
|
152
|
+
if (!curConfig.linkDebug) {
|
|
153
|
+
errorLog('未找到 debug 相关配置。');
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
// 将 linkDebug 设置给 dev
|
|
157
|
+
curConfig.dev = Object.assign(curConfig.dev, curConfig.linkDebug);
|
|
158
|
+
delete curConfig.linkDebug;
|
|
159
|
+
delete curConfig.dev.ignoreNodeModules; // 需要注入依赖
|
|
160
|
+
curConfig.webpack.ignoreNodeModules = false;
|
|
161
|
+
|
|
162
|
+
// 生成并设置 entry 配置
|
|
163
|
+
var _setupEntries = setupEntries(curConfig.dev, {
|
|
164
|
+
entryType: 'linkDebug'
|
|
165
|
+
}),
|
|
166
|
+
curCmpTypes = _setupEntries.cmpTypes,
|
|
167
|
+
defaultExports = _setupEntries.defaultExports;
|
|
168
|
+
|
|
169
|
+
// 配置 webpack 插件、externals 和 commonModulesCode
|
|
170
|
+
configureNeoBuild$1(curConfig.dev, {
|
|
171
|
+
cmpTypes: curCmpTypes,
|
|
172
|
+
defaultExports: defaultExports,
|
|
173
|
+
verbose: true,
|
|
174
|
+
excludeModel: false // linkDebug 不排除 Model
|
|
175
|
+
});
|
|
176
|
+
akfun.dev(curConfig, consoleTag);
|
|
177
|
+
},
|
|
178
|
+
build: function build() {
|
|
179
|
+
return akfun.build('build', curConfig, consoleTag);
|
|
180
|
+
},
|
|
181
|
+
// 构建脚本:生产环境
|
|
182
|
+
build2lib: function build2lib() {
|
|
183
|
+
// 生成并设置 entry 配置
|
|
184
|
+
setupEntries(curConfig.build2lib, {
|
|
185
|
+
entryType: 'widget'
|
|
186
|
+
});
|
|
187
|
+
akfun.build('lib', curConfig, consoleTag);
|
|
188
|
+
},
|
|
189
|
+
// 构建脚本:生产环境
|
|
190
|
+
publish2oss: function publish2oss(cmpType) {
|
|
191
|
+
// 将 publish2oss 相关配置设置给 build2lib
|
|
192
|
+
var publish2ossConfig = curConfig.publish2oss;
|
|
193
|
+
curConfig.build2lib = prepareBuild2LibConfig(publish2ossConfig);
|
|
194
|
+
|
|
195
|
+
// 生成并设置 entry 配置
|
|
196
|
+
var _setupEntries2 = setupEntries(curConfig.build2lib, {
|
|
197
|
+
entryType: 'widget',
|
|
198
|
+
cmpType: cmpType
|
|
199
|
+
}),
|
|
200
|
+
curCmpTypes = _setupEntries2.cmpTypes,
|
|
201
|
+
defaultExports = _setupEntries2.defaultExports;
|
|
202
|
+
|
|
203
|
+
// 配置 webpack 插件、externals 和 commonModulesCode
|
|
204
|
+
configureNeoBuild$1(curConfig.build2lib, {
|
|
205
|
+
cmpTypes: curCmpTypes,
|
|
206
|
+
defaultExports: defaultExports,
|
|
207
|
+
verbose: true,
|
|
208
|
+
excludeModel: true // publish2oss 排除 Model 结尾的文件
|
|
209
|
+
});
|
|
210
|
+
akfun.build('lib', curConfig, consoleTag, function () {
|
|
211
|
+
// 构建完成后,执行 publish2oss
|
|
212
|
+
_publish2oss(publish2ossConfig.ossType, publish2ossConfig.ossConfig, publish2ossConfig.assetsRoot);
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
// 发布组件到 NeoCRM 平台
|
|
216
|
+
pushCmp: function pushCmp(cmpType) {
|
|
217
|
+
var neoConfig = curConfig.neoConfig,
|
|
218
|
+
_pushCmpConfig = curConfig.pushCmp;
|
|
219
|
+
var pushCmpConfig = Object.assign({}, _pushCmpConfig, neoConfig);
|
|
220
|
+
// 将 pushCmp 相关配置设置给 build2lib
|
|
221
|
+
curConfig.build2lib = prepareBuild2LibConfig(pushCmpConfig);
|
|
222
|
+
|
|
223
|
+
// 生成并设置 entry 配置
|
|
224
|
+
var _setupEntries3 = setupEntries(curConfig.build2lib, {
|
|
225
|
+
entryType: 'widget',
|
|
226
|
+
cmpType: cmpType
|
|
227
|
+
}),
|
|
228
|
+
curCmpTypes = _setupEntries3.cmpTypes,
|
|
229
|
+
defaultExports = _setupEntries3.defaultExports;
|
|
230
|
+
|
|
231
|
+
// 配置 webpack 插件、externals 和 commonModulesCode
|
|
232
|
+
configureNeoBuild$1(curConfig.build2lib, {
|
|
233
|
+
cmpTypes: curCmpTypes,
|
|
234
|
+
defaultExports: defaultExports,
|
|
235
|
+
verbose: false,
|
|
236
|
+
excludeModel: true // pushCmp 排除 Model 结尾的文件
|
|
237
|
+
});
|
|
238
|
+
akfun.build('lib', curConfig, consoleTag, function () {
|
|
239
|
+
// 构建完成后,执行 pushCmp
|
|
240
|
+
_pushCmp(pushCmpConfig, cmpType);
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
// 从 NeoCRM 平台拉取组件
|
|
244
|
+
pullCmp: function pullCmp(cmpType, neoService) {
|
|
245
|
+
_pullCmp(cmpType, curConfig.neoConfig, neoService);
|
|
246
|
+
},
|
|
247
|
+
// 从 NeoCRM 平台删除组件
|
|
248
|
+
deleteCmp: function deleteCmp(cmpType, neoService) {
|
|
249
|
+
_deleteCmp(cmpType, curConfig.neoConfig, neoService);
|
|
250
|
+
},
|
|
251
|
+
build2esm: function build2esm(fileName) {
|
|
252
|
+
return akfun.build2esm(fileName, curConfig, consoleTag);
|
|
253
|
+
},
|
|
254
|
+
// 构建esm输出模块
|
|
255
|
+
// 打开编辑器(Cursor 或 VSCode)
|
|
256
|
+
openEditor: openProject$1
|
|
257
|
+
};
|
|
258
|
+
return main;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
exports.__require = requireMain;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var require$$1 = require('node:path');
|
|
4
|
+
var require$$3 = require('ora');
|
|
5
|
+
var require$$0$1 = require('node:fs');
|
|
6
|
+
var require$$0 = require('akfun');
|
|
7
|
+
var index = require('../config/index.js');
|
|
8
|
+
var neoParams = require('../utils/neoParams.js');
|
|
9
|
+
var common = require('../utils/common.js');
|
|
10
|
+
|
|
11
|
+
var inspect;
|
|
12
|
+
var hasRequiredInspect;
|
|
13
|
+
|
|
14
|
+
function requireInspect () {
|
|
15
|
+
if (hasRequiredInspect) return inspect;
|
|
16
|
+
hasRequiredInspect = 1;
|
|
17
|
+
var path = require$$1;
|
|
18
|
+
var ora = require$$3;
|
|
19
|
+
var fs = require$$0$1;
|
|
20
|
+
var _require = require$$0,
|
|
21
|
+
getCurWebpackConfig = _require.getCurWebpackConfig; // 用于获取当前webpack配置的方法
|
|
22
|
+
var curConfig = index.__require();
|
|
23
|
+
var _require2 = neoParams.__require(),
|
|
24
|
+
consoleTag = _require2.consoleTag; // 输出标记
|
|
25
|
+
var _require3 = common.__require(),
|
|
26
|
+
errorLog = _require3.errorLog,
|
|
27
|
+
successLog = _require3.successLog;
|
|
28
|
+
|
|
29
|
+
// 根据当前配置文件内容创建指定名称的文件
|
|
30
|
+
var createConfigJs = function createConfigJs(fileName, fileCont) {
|
|
31
|
+
var filePath = path.resolve(process.cwd(), fileName);
|
|
32
|
+
fs.writeFile(filePath, JSON.stringify(fileCont, null, 2), function (err) {
|
|
33
|
+
if (err) {
|
|
34
|
+
throw Error(err);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 用于输出当前项目配置文件
|
|
41
|
+
*/
|
|
42
|
+
inspect = function (type) {
|
|
43
|
+
var spinner = ora(consoleTag + "\u6B63\u5728\u83B7\u53D6\u5F53\u524D\u73AF\u5883\u7684\u914D\u7F6E\u6570\u636E...").start();
|
|
44
|
+
if (type === 'dev') {
|
|
45
|
+
var devConfig = getCurWebpackConfig(type, curConfig);
|
|
46
|
+
createConfigJs('current-neo-dev-config.js', devConfig);
|
|
47
|
+
successLog("\u5F53\u524D\u914D\u7F6E\u6570\u636E\u5DF2\u8F93\u51FA\u81F3 current-neo-dev-config.js\u4E2D\u3002", spinner);
|
|
48
|
+
} else if (type === 'lib') {
|
|
49
|
+
var libraryConfig = getCurWebpackConfig(type, curConfig);
|
|
50
|
+
createConfigJs('current-neo-build2lib-config.js', libraryConfig);
|
|
51
|
+
successLog("\u5F53\u524D\u914D\u7F6E\u6570\u636E\u5DF2\u8F93\u51FA\u81F3 current-neo-build2lib-config.js\u4E2D\u3002", spinner);
|
|
52
|
+
} else if (type === 'build') {
|
|
53
|
+
var prodConfig = getCurWebpackConfig(type, curConfig);
|
|
54
|
+
// 默认输出生产环境的配置文件
|
|
55
|
+
createConfigJs('current-neo-build-config.js', prodConfig);
|
|
56
|
+
successLog("\u5F53\u524D\u914D\u7F6E\u6570\u636E\u5DF2\u8F93\u51FA\u81F3 current-neo-build-config.js\u3002", spinner);
|
|
57
|
+
} else {
|
|
58
|
+
errorLog("type \u4E0D\u80FD\u4E3A\u7A7A\u3002", spinner);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return inspect;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
exports.__require = requireInspect;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var require$$0 = require('akfun');
|
|
4
|
+
require('node:path');
|
|
5
|
+
var neoParams = require('../utils/neoParams.js');
|
|
6
|
+
var replaceInPackage = require('../utils/replaceInPackage.js');
|
|
7
|
+
var resetPackageVersion = require('../utils/resetPackageVersion.js');
|
|
8
|
+
var autoEntryRootDir = require('../utils/autoEntryRootDir.js');
|
|
9
|
+
|
|
10
|
+
var neoInit_1;
|
|
11
|
+
var hasRequiredNeoInit;
|
|
12
|
+
|
|
13
|
+
function requireNeoInit () {
|
|
14
|
+
if (hasRequiredNeoInit) return neoInit_1;
|
|
15
|
+
hasRequiredNeoInit = 1;
|
|
16
|
+
var _require = require$$0,
|
|
17
|
+
gitClone = _require.gitClone;
|
|
18
|
+
var _require2 = neoParams.__require(),
|
|
19
|
+
consoleTag = _require2.consoleTag; // 输出标记
|
|
20
|
+
var _require3 = replaceInPackage.__require(),
|
|
21
|
+
replaceInPackage$1 = _require3.replaceInPackage;
|
|
22
|
+
var _require4 = resetPackageVersion.__require(),
|
|
23
|
+
resetPackageVersion$1 = _require4.resetPackageVersion;
|
|
24
|
+
var autoEntryRootDir$1 = autoEntryRootDir.__require();
|
|
25
|
+
var templateList = {
|
|
26
|
+
react: {
|
|
27
|
+
projectName: 'react-custom-cmp-template',
|
|
28
|
+
url: 'git@github.com:wibetter/react-custom-cmp-template.git'
|
|
29
|
+
},
|
|
30
|
+
'react-ts': {
|
|
31
|
+
projectName: 'react-ts-custom-cmp-template',
|
|
32
|
+
url: 'git@github.com:wibetter/react-ts-custom-cmp-template.git'
|
|
33
|
+
},
|
|
34
|
+
vue2: {
|
|
35
|
+
projectName: 'vue2-custom-cmp-template',
|
|
36
|
+
url: 'git@github.com:wibetter/vue2-custom-cmp-template.git'
|
|
37
|
+
}
|
|
38
|
+
/*
|
|
39
|
+
'vue3': {
|
|
40
|
+
projectName: 'vue3-neo-custom-widget',
|
|
41
|
+
url: 'git@github.com:wibetter/vue3-neo-custom-widget.git'
|
|
42
|
+
}
|
|
43
|
+
*/
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 通过 git clone 从 github 拉取并创建自定义组件
|
|
48
|
+
* @param {*} type 自定义组件类型
|
|
49
|
+
* @param {*} projectName 自定义组件项目名称
|
|
50
|
+
*/
|
|
51
|
+
var neoInit = function neoInit(type, projectName) {
|
|
52
|
+
var currentTemplate = templateList[type || 'react'];
|
|
53
|
+
var currentTemplateUrl = currentTemplate.url;
|
|
54
|
+
var finalProjectName = projectName || 'neoCustomCmp';
|
|
55
|
+
gitClone(currentTemplateUrl, finalProjectName, function () {
|
|
56
|
+
// 克隆完成后,替换项目名称
|
|
57
|
+
replaceInPackage$1(finalProjectName, currentTemplate.projectName, finalProjectName);
|
|
58
|
+
replaceInPackage$1(finalProjectPath, 'wibetter', 'xxx');
|
|
59
|
+
replaceInPackage$1(finalProjectPath, 'neo自定义组件模板', 'neo自定义组件');
|
|
60
|
+
resetPackageVersion$1(finalProjectPath);
|
|
61
|
+
// 自动切换到项目根目录
|
|
62
|
+
autoEntryRootDir$1(finalProjectPath);
|
|
63
|
+
}, consoleTag);
|
|
64
|
+
};
|
|
65
|
+
neoInit_1 = neoInit;
|
|
66
|
+
return neoInit_1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
exports.__require = requireNeoInit;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var require$$0 = require('fs-extra');
|
|
4
|
+
var require$$1 = require('node:path');
|
|
5
|
+
var neoParams = require('../utils/neoParams.js');
|
|
6
|
+
var replaceInPackage = require('../utils/replaceInPackage.js');
|
|
7
|
+
var resetPackageVersion = require('../utils/resetPackageVersion.js');
|
|
8
|
+
var autoEntryRootDir = require('../utils/autoEntryRootDir.js');
|
|
9
|
+
var common = require('../utils/common.js');
|
|
10
|
+
|
|
11
|
+
var neoInitByCopy_1;
|
|
12
|
+
var hasRequiredNeoInitByCopy;
|
|
13
|
+
|
|
14
|
+
function requireNeoInitByCopy () {
|
|
15
|
+
if (hasRequiredNeoInitByCopy) return neoInitByCopy_1;
|
|
16
|
+
hasRequiredNeoInitByCopy = 1;
|
|
17
|
+
var fs = require$$0;
|
|
18
|
+
var path = require$$1;
|
|
19
|
+
var _require = neoParams.__require(),
|
|
20
|
+
consoleTag = _require.consoleTag; // 输出标记
|
|
21
|
+
var _require2 = replaceInPackage.__require(),
|
|
22
|
+
replaceInPackage$1 = _require2.replaceInPackage;
|
|
23
|
+
var _require3 = resetPackageVersion.__require(),
|
|
24
|
+
resetPackageVersion$1 = _require3.resetPackageVersion;
|
|
25
|
+
var autoEntryRootDir$1 = autoEntryRootDir.__require();
|
|
26
|
+
var _require4 = common.__require(),
|
|
27
|
+
errorLog = _require4.errorLog;
|
|
28
|
+
var templateList = {
|
|
29
|
+
react: {
|
|
30
|
+
projectName: 'react-custom-cmp-template',
|
|
31
|
+
dir: path.resolve(__dirname, '../../template/react-custom-cmp-template')
|
|
32
|
+
},
|
|
33
|
+
'react-ts': {
|
|
34
|
+
projectName: 'react-ts-custom-cmp-template',
|
|
35
|
+
dir: path.resolve(__dirname, '../../template/react-ts-custom-cmp-template')
|
|
36
|
+
},
|
|
37
|
+
antd: {
|
|
38
|
+
projectName: 'antd-custom-cmp-template',
|
|
39
|
+
dir: path.resolve(__dirname, '../../template/antd-custom-cmp-template')
|
|
40
|
+
},
|
|
41
|
+
echarts: {
|
|
42
|
+
projectName: 'echarts-custom-cmp-template',
|
|
43
|
+
dir: path.resolve(__dirname, '../../template/echarts-custom-cmp-template')
|
|
44
|
+
},
|
|
45
|
+
neo: {
|
|
46
|
+
projectName: 'neo-custom-cmp-template',
|
|
47
|
+
dir: path.resolve(__dirname, '../../template/neo-custom-cmp-template')
|
|
48
|
+
},
|
|
49
|
+
vue2: {
|
|
50
|
+
projectName: 'vue2-custom-cmp-template',
|
|
51
|
+
dir: path.resolve(__dirname, '../../template/vue2-custom-cmp-template')
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 通过拷贝模板创建自定义组件
|
|
57
|
+
* @param {*} type 自定义组件类型
|
|
58
|
+
* @param {*} projectName 自定义组件项目名称
|
|
59
|
+
*/
|
|
60
|
+
var neoInitByCopy = function neoInitByCopy(type, projectName) {
|
|
61
|
+
var currentTemplate = templateList[type || 'react'];
|
|
62
|
+
var currentTemplateDir = currentTemplate.dir;
|
|
63
|
+
var finalProjectName = projectName || 'neoCustomCmp';
|
|
64
|
+
var finalProjectPath = path.resolve(process.cwd(), finalProjectName);
|
|
65
|
+
fs.copy(currentTemplateDir, finalProjectPath).then(function () {
|
|
66
|
+
replaceInPackage$1(finalProjectPath, currentTemplate.projectName, finalProjectName);
|
|
67
|
+
replaceInPackage$1(finalProjectPath, 'wibetter', 'xxx');
|
|
68
|
+
replaceInPackage$1(finalProjectPath, 'neo自定义组件模板', 'neo自定义组件');
|
|
69
|
+
resetPackageVersion$1(finalProjectPath);
|
|
70
|
+
console.log(consoleTag + "\u5DF2\u521B\u5EFA\u81EA\u5B9A\u4E49\u7EC4\u4EF6\uFF08" + finalProjectName + "\uFF09!");
|
|
71
|
+
// 自动切换到项目根目录
|
|
72
|
+
autoEntryRootDir$1(finalProjectPath);
|
|
73
|
+
}).catch(function (err) {
|
|
74
|
+
return errorLog(consoleTag + "\u81EA\u5B9A\u4E49\u7EC4\u4EF6\u6A21\u677F\u4E0B\u8F7D\u5931\u8D25\uFF1A", err);
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
neoInitByCopy_1 = neoInitByCopy;
|
|
78
|
+
return neoInitByCopy_1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
exports.__require = requireNeoInitByCopy;
|