crabatool 1.0.131 → 1.0.132

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.
@@ -1,3 +1,3 @@
1
- {
2
- "eslint.enable": false
1
+ {
2
+ "eslint.enable": false
3
3
  }
package/lib/server.js CHANGED
@@ -4,7 +4,6 @@ var fs = require('fs');
4
4
  var path = require('path');
5
5
  var config = require('./config.js');
6
6
  var utils = require('./utils.js');
7
-
8
7
  var compression = require('compression');
9
8
  var app = new express();
10
9
  //app.use(express.json({ limit: '50mb' })); // post数据包大小限制
@@ -34,6 +33,14 @@ if (config.refresh) {
34
33
  // 指定静态文件目录
35
34
  app.use(express.static(config.webPath))
36
35
 
36
+ // 业务ap的代理转发
37
+ if (config.proxy) {
38
+ var { createProxyMiddleware } = require('http-proxy-middleware');
39
+ for (let key in config.proxy) {
40
+ app.use(key, createProxyMiddleware(config.proxy[key]));
41
+ }
42
+ }
43
+
37
44
  // 启动server
38
45
  var server = http.createServer(app);
39
46
  var hostname = '127.0.0.1';
package/package.json CHANGED
@@ -1,43 +1,43 @@
1
- {
2
- "name": "crabatool",
3
- "version": "1.0.131",
4
- "description": "crabatool",
5
- "main": "index.js",
6
- "scripts": {
7
- "start": "node index.js",
8
- "test": "node ./test/test.js",
9
- "run": "node ./test/test.js -run",
10
- "checkjs": "node ./test/test.js -checkjs",
11
- "webPath": "node ./test/test.js -checkjs -webhooks 0 -webPath F:\\newcrabadoc\\www -modName crabadoc -ignoreCheck ueditor,iconfont,biconfont,js\\math.min.js,js\\es6-promise.auto.min.js,js\\craba.rollup.min.js"
12
- },
13
- "author": "wssf",
14
- "dependencies": {
15
- "axios": "^0.27.2",
16
- "chokidar": "^3.5.3",
17
- "compressing": "^1.6.0",
18
- "compression": "^1.7.4",
19
- "crypto": "^1.0.1",
20
- "express": "^4.17.3",
21
- "htmlparser2": "^8.0.1",
22
- "iconv-jschardet": "^2.0.26",
23
- "iconv-lite": "^0.5.2",
24
- "nodejs-websocket": "^1.7.2",
25
- "readline-sync": "^1.4.10",
26
- "request": "^2.88.2",
27
- "single-line-log": "^1.1.2",
28
- "sync-request": "^6.1.0",
29
- "uglify-js": "^3.15.1",
30
- "xml-js": "^1.6.11",
31
- "eslint": "^8.18.0",
32
- "eslint-plugin-native-ie": "^0.1.2"
33
- },
34
- "repository": {
35
- "type": "git",
36
- "url": "no"
37
- },
38
- "keywords": [
39
- "crabatool"
40
- ],
41
- "license": "UNLICENSED",
42
- "devDependencies": {}
1
+ {
2
+ "name": "crabatool",
3
+ "version": "1.0.132",
4
+ "description": "crabatool",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "start": "node index.js",
8
+ "test": "node ./test/test.js",
9
+ "run": "node ./test/test.js -run",
10
+ "checkjs": "node ./test/test.js -checkjs",
11
+ "webPath": "node ./test/test.js -checkjs -webhooks 0 -webPath F:\\newcrabadoc\\www -modName crabadoc -ignoreCheck ueditor,iconfont,biconfont,js\\math.min.js,js\\es6-promise.auto.min.js,js\\craba.rollup.min.js"
12
+ },
13
+ "author": "wssf",
14
+ "dependencies": {
15
+ "axios": "^0.27.2",
16
+ "chokidar": "^3.5.3",
17
+ "compressing": "^1.6.0",
18
+ "compression": "^1.7.4",
19
+ "crypto": "^1.0.1",
20
+ "eslint": "^8.18.0",
21
+ "eslint-plugin-native-ie": "^0.1.2",
22
+ "express": "^4.17.3",
23
+ "htmlparser2": "^8.0.1",
24
+ "http-proxy-middleware": "^2.0.6",
25
+ "iconv-jschardet": "^2.0.26",
26
+ "iconv-lite": "^0.5.2",
27
+ "nodejs-websocket": "^1.7.2",
28
+ "readline-sync": "^1.4.10",
29
+ "request": "^2.88.2",
30
+ "single-line-log": "^1.1.2",
31
+ "sync-request": "^6.1.0",
32
+ "uglify-js": "^3.15.1",
33
+ "xml-js": "^1.6.11"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "no"
38
+ },
39
+ "keywords": [
40
+ "crabatool"
41
+ ],
42
+ "license": "UNLICENSED"
43
43
  }
package/test/craba.js CHANGED
@@ -9,7 +9,8 @@ var crabaTool = require('crabatool'); // 引入craba脚手架工具包
9
9
  var config = {
10
10
  //【必填】
11
11
  // 告诉工具当前项目的端路径地址,填绝对路径哦
12
- webPath: "F:/shell_master/web/src/main/resources/static/shell",
12
+ //webPath: "F:/shell_master/web/src/main/resources/static/shell",
13
+ webPath: "F:\\crabaevery\\www",
13
14
 
14
15
  //【必填】
15
16
  // 告诉工具当前项目前端服务器端口地址
@@ -31,7 +32,14 @@ var config = {
31
32
 
32
33
  // 【不是必填】
33
34
  // 上一步中打包后的文件是否压缩, true为忽略【不压缩】,false为【要压缩】,各组按需修改
34
- ignoreCompress: true
35
+ ignoreCompress: true,
36
+
37
+ proxy: {
38
+ '/apis/': {
39
+ target: 'http://127.0.0.1:8987',
40
+ changeOrigin: true, //是否重写请求头中的host
41
+ }
42
+ }
35
43
 
36
44
  }
37
45
 
package/test/test.js CHANGED
@@ -10,7 +10,7 @@ var config = {
10
10
  //【必填】
11
11
  // 告诉工具当前项目的端路径地址,填绝对路径哦
12
12
  //webPath: "F:\\jxc\\jxc-web\\src\\main\\resources\\static\\jxc",
13
- //webPath: "F:/shell_master/web/src/main/resources/static/shell",
13
+ webPath: "F:/shell_master/web/src/main/resources/static/shell",
14
14
  //webPath: "F:\\newcrabadoc\\www",
15
15
  //webPath: "F:\\CarpaNET_NEW\\src\\Carpa.Web\\js\\",
16
16
  webPath: "F:/crabaevery/www",
@@ -47,6 +47,13 @@ var config = {
47
47
  // 告诉助手项目有哪些是全局变量,不然会提示未定义
48
48
  globals: ['crabadoc', 'Type', 'CrabaMarkdown', '$doc', 'www', 'crabaJs'],
49
49
 
50
+ proxy: {
51
+ '/apis/': {
52
+ "target": 'http://127.0.0.1:8339',
53
+ "changeOrigin": true, //是否重写请求头中的host
54
+ }
55
+ },
56
+
50
57
  // 告诉助手项目有哪些js忽略语法检查,可以填目录
51
58
  ignoreCheck: [
52
59
  'js/lib/highlight.min.js',
@@ -60,7 +67,7 @@ var config = {
60
67
  ],
61
68
 
62
69
  // 配置js语法检测报告推送地址
63
- webhooks: ''
70
+ //webhooks: ''
64
71
  //https://oapi.dingtalk.com/robot/send?access_token=ce27b1b1540881540d44c0bd05ba738d865363758892ede137dc1020bd36bd5a
65
72
  //'https://oapi.dingtalk.com/robot/send?access_token=37279df60e03ebf25e8eb71230ddb93fe74de99951a8d635d0458e60bfcd44d8'
66
73
  }