crabatool 1.0.150 → 1.0.151
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/index.js +1 -1
- package/package.json +1 -1
- package/tool/start.js +8 -3
- package/tool/upgrade.js +6 -4
package/index.js
CHANGED
package/package.json
CHANGED
package/tool/start.js
CHANGED
|
@@ -56,13 +56,14 @@ class Start {
|
|
|
56
56
|
start.installvscode();
|
|
57
57
|
} else if (num == 8) {
|
|
58
58
|
var options = {};
|
|
59
|
-
options.projectPath = await waitFolder(question);
|
|
60
59
|
options.type = await question('选择项目类型:1. 普通craba项目; 2. ngp微前端项目; 输入编号:');
|
|
61
60
|
if (options.type != 1 && options.type != 2) options.type = 1;
|
|
62
61
|
if (options.type == 2) {
|
|
63
62
|
options.modName = await question('请输入微服务的模块名称:');
|
|
64
63
|
if (!options.modName) options.modName = 'emptyname';
|
|
65
64
|
}
|
|
65
|
+
options.projectPath = await waitFolder(question);
|
|
66
|
+
|
|
66
67
|
rl.close(); // 关闭输入等待
|
|
67
68
|
start.createProject(options);
|
|
68
69
|
} else if (num != 9) {
|
|
@@ -251,14 +252,18 @@ function bindConfigByArgv(key, type) {
|
|
|
251
252
|
}
|
|
252
253
|
|
|
253
254
|
async function waitFolder(question) {
|
|
254
|
-
|
|
255
|
+
var tip = '请输入项目生成路径:';
|
|
256
|
+
const projectPath = await question(tip);
|
|
255
257
|
if (!path.isAbsolute(projectPath)) {
|
|
256
258
|
console.log('路径不合法,请输入绝对路径,如:f:\\craba_web');
|
|
257
259
|
return waitFolder(question);
|
|
258
260
|
}
|
|
259
261
|
if (fs.existsSync(projectPath)) {
|
|
260
262
|
if (fs.readdirSync(projectPath).length > 0) {
|
|
261
|
-
|
|
263
|
+
var result = await question('输入的路径下有其他文件,避免文件覆盖或冲突,请确认是否在此路径下创建项目(Y/N):');
|
|
264
|
+
if (result && result.toLowerCace() == 'y') {
|
|
265
|
+
return projectPath;
|
|
266
|
+
}
|
|
262
267
|
return waitFolder(question);
|
|
263
268
|
}
|
|
264
269
|
}
|
package/tool/upgrade.js
CHANGED
|
@@ -81,14 +81,16 @@ class Upgrade {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
createProject(options) {
|
|
84
|
-
|
|
85
84
|
var projectPath = "";
|
|
86
85
|
if (options.type == 1) {
|
|
87
86
|
projectPath = utils.join(options.projectPath, 'www');
|
|
88
87
|
} else if (options.type == 2) {
|
|
89
|
-
projectPath =
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
projectPath = `/web/src/main/resources/static/`;
|
|
89
|
+
if (!options.projectPath.includes(options.modName)) {
|
|
90
|
+
projectPath = utils.join(options.projectPath, options.modName, projectPath, options.modName);
|
|
91
|
+
} else {
|
|
92
|
+
projectPath = utils.join(options.projectPath, projectPath, options.modName);
|
|
93
|
+
}
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
this.done = this._createDone;
|