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 CHANGED
@@ -9,7 +9,7 @@ module.exports.run = function(options) {
9
9
 
10
10
  start.checkConfig(); // 检查参数
11
11
 
12
- console.log('运行参数:', options);
12
+ if (options) console.log('运行参数:', options);
13
13
 
14
14
  // 1. 服务端构建环境,自动化,根据命令行参数,直接调用脚手架功能
15
15
  if (process.argv.length > 2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.150",
3
+ "version": "1.0.151",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "bin": {
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
- const projectPath = await question('请输入项目生成路径(必须为空路径):');
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
- console.log(':::输入的项目路径不为空,避免文件覆盖或冲突,请重新输入一个空路径或不存在的路径:::');
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 = `${options.modName}/web/src/main/resources/static/${options.modName}`;
90
- projectPath = utils.join(options.projectPath, projectPath);
91
- projectPath = projectPath;
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;