crabatool 1.0.74 → 1.0.77

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
@@ -33,7 +33,7 @@ module.exports.run = function(options) {
33
33
  }
34
34
  }
35
35
 
36
- start.showLocalVersion();
36
+ start.showLocalVersion(true);
37
37
 
38
38
  // 2. 开发环境让开发选择功能
39
39
  start.waitInput();
package/lib/config.js CHANGED
@@ -12,8 +12,9 @@ class Config {
12
12
 
13
13
  this.Version = pg.version;
14
14
  this.Debug = false;
15
- this.Host = "http://crabadoc.mygjp.com.cn";
16
- //this.Host = "http://127.0.0.1:9998";
15
+ //this.SourceHost = "http://crabadoc.mygjp.com.cn";
16
+ this.SourceHost = "http://crabadoc.ca.com";
17
+ //this.SourceHost = "http://127.0.0.1:9998";
17
18
  this.TempPath = path.join(os.tmpdir(), '_crabatemp');
18
19
  this.ImageCache = path.join(this.TempPath, "_img");
19
20
  this.JsonFile = path.join(this.TempPath, "craba.json");
package/lib/utils.js CHANGED
@@ -471,7 +471,7 @@ class Utils {
471
471
  downloadFile(uri, savePath, callback) {
472
472
  if (!uri || !savePath) throw new Error('uri或savePath不能为空');
473
473
 
474
- console.log('下载文件中');
474
+ //console.log('下载文件中');
475
475
  axios({
476
476
  method: 'get',
477
477
  url: uri,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.74",
3
+ "version": "1.0.77",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tool/install.js CHANGED
@@ -12,6 +12,9 @@ class Install {
12
12
  installIDEA() {
13
13
  // AppData
14
14
  var p1 = process.env.APPDATA;
15
+ if (!p1) {
16
+ return console.log('本机没有APPDATA目录,本功能暂不支持mac');
17
+ }
15
18
  var JetBrains = path.join(p1, "JetBrains");
16
19
  if (fs.existsSync(JetBrains)) {
17
20
  var folderName = utils.searchFolder("IntelliJIdea", JetBrains);
@@ -30,23 +33,25 @@ class Install {
30
33
  return;
31
34
  }
32
35
 
33
- console.log("没有找到IDEA的数据目录,请检查是否已经安装idea;如果有安装请反馈给管理员");
36
+ console.log("没有找到IDEA的数据目录,请检查是否已经安装idea");
34
37
  }
35
38
 
36
39
  doIDEA(ideaPath) {
40
+ console.log('idea路径:' + ideaPath);
41
+
37
42
  // 第1步:gspx智能语法提示
38
43
  var xsdFile = path.join(process.env.ProgramData, "idea/Craba.UI.xsd");
39
44
  utils.mkdirsSync(xsdFile);
40
- utils.downloadFile(config.Host + "/setup/Craba.UI.xsd", xsdFile, true);
45
+ utils.downloadFile(config.SourceHost + "/setup/Craba.UI.xsd", xsdFile, true);
41
46
 
42
47
  var extFile = path.join(ideaPath, "options/javaeeExternalResources.xml");
43
- utils.downloadFile(config.Host + "/setup/idea/options/javaeeExternalResources.xml", extFile);
48
+ utils.downloadFile(config.SourceHost + "/setup/idea/options/javaeeExternalResources.xml", extFile);
44
49
 
45
50
  // 第2步:创建页面模板
46
51
  var gspxPath = path.join(ideaPath, "fileTemplates/Craba.gspx");
47
52
  utils.mkdirsSync(gspxPath);
48
- utils.downloadFile(config.Host + "/setup/idea/fileTemplates/Craba.xml", gspxPath);
49
- utils.downloadFile(config.Host + "/setup/idea/fileTemplates/CrabaJs.js", path.join(ideaPath, "fileTemplates/CrabaJs.js"));
53
+ utils.downloadFile(config.SourceHost + "/setup/idea/fileTemplates/Craba.xml", gspxPath);
54
+ utils.downloadFile(config.SourceHost + "/setup/idea/fileTemplates/CrabaJs.js", path.join(ideaPath, "fileTemplates/CrabaJs.js"));
50
55
 
51
56
  // 第3步:gspx语法高亮
52
57
  var fileTypes = path.join(ideaPath, "options/filetypes.xml");
package/tool/start.js CHANGED
@@ -83,7 +83,9 @@ class Start {
83
83
  bindConfigByArgv('-ignoreCompress', 'boolean');
84
84
  bindConfigByArgv('-Debug', 'boolean');
85
85
  bindConfigByArgv('-checkgspx', 'boolean');
86
+ }
86
87
 
88
+ checkPath() {
87
89
  if (!config.webPath) {
88
90
  throw new Error('请检查craba.js,必须告诉工具当前项目的前端路径地址,填绝对路径哦');
89
91
  }
@@ -111,24 +113,27 @@ class Start {
111
113
 
112
114
  // 启动服务
113
115
  runServer() {
116
+ this.checkPath();
114
117
  require('../lib/server.js');
115
118
  }
116
119
 
117
120
  // 更新平台后启动服务
118
121
  update() {
122
+ this.checkPath();
119
123
  upgrade.updateCraba(start.runServer);
120
124
  }
121
125
 
122
126
  // 查看本地版本
123
- showLocalVersion() {
127
+ showLocalVersion(check) {
128
+ if (check && !config.webPath) return;
129
+ this.checkPath();
124
130
  var localData = upgrade.getLocalVersion();
125
131
  console.log(`\r\n本地craba版本:[${localData.version}]\r\n本地craba日期:[${localData.date}]`);
126
132
  }
127
133
 
128
134
  // 查看线上版本
129
135
  showNewVersion() {
130
- start.showLocalVersion();
131
-
136
+ start.showLocalVersion(true);
132
137
  var data = upgrade.getNewVersion();
133
138
  utils.error(`最新craba版本:[${data.version}]`);
134
139
  utils.error(`最新craba日期:[${data.date}]`);
@@ -148,6 +153,7 @@ class Start {
148
153
 
149
154
  // 按配置对项目init.js和biz.js打包
150
155
  mergeInit() {
156
+ this.checkPath();
151
157
  if (config.modName && config.childModList && config.childModList.length > 0) {
152
158
  config.mergeinitjs = true; // 标记仅打包,不监视文件变动
153
159
  require('./ngptool.js');
@@ -158,11 +164,13 @@ class Start {
158
164
 
159
165
  // 校验项目js语法
160
166
  checkAllJs() {
167
+ this.checkPath();
161
168
  require('./checkjs.js').start();
162
169
  }
163
170
 
164
171
  // 对整个项目js打包
165
172
  compressAllJs() {
173
+ this.checkPath();
166
174
  console.log('待实现');
167
175
  }
168
176
 
package/tool/upgrade.js CHANGED
@@ -11,14 +11,14 @@ class Upgrade {
11
11
  }
12
12
 
13
13
  getVersionUrl() {
14
- var url = config.Host;
14
+ var url = config.SourceHost;
15
15
  if (!url.endsWith("/")) url += "/";
16
16
  url += "setup/crabaConfig.json";
17
17
  return url;
18
18
  }
19
19
 
20
20
  getCrabaFileUrl() {
21
- var url = config.Host;
21
+ var url = config.SourceHost;
22
22
  if (!url.endsWith("/")) url += "/";
23
23
  url += "setup/craba.zip";
24
24
  return url;