node-automator 1.3.13 → 1.3.14

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,5 +1,7 @@
1
1
  const { get_file_list, read_cfg, get_fst_file } = require("../utils/file_tool");
2
2
  const { whisper, info, warn, success, vital, setLastExecFile } = require("../utils/log_tool");
3
+ const { parse } = require('../utils/parse_tool');
4
+ const { doRequest } = require('../utils/request_tool');
3
5
  const { toArray } = require("../utils/transform_tool");
4
6
  const { BaseCommand } = require("./base");
5
7
 
@@ -10,7 +12,10 @@ class ExecFromFileCommand extends BaseCommand {
10
12
  let srcs = toArray(data.src);
11
13
  for (let i = 0; i < srcs.length; i++) {
12
14
  let src = srcs[i];
13
- src = get_fst_file(src);
15
+ const isRemote = /^https?:\/\//.test(src);
16
+ if (!isRemote) {
17
+ src = get_fst_file(src);
18
+ }
14
19
  if (!src) {
15
20
  throw (`配置文件未找到 ${srcs[i]}`);
16
21
  }
@@ -21,7 +26,12 @@ class ExecFromFileCommand extends BaseCommand {
21
26
  info(`执行配置文件 ${src}`);
22
27
  this.globalData.executed_cfg.push(src);
23
28
  setLastExecFile(src);
24
- let cfg = await read_cfg(src, data.type);
29
+ let cfg;
30
+ if (isRemote) {
31
+ cfg = await parse(await doRequest({src, quiet: true}), "yml");
32
+ } else {
33
+ cfg = await read_cfg(src, data.type);
34
+ }
25
35
  await this.exec(cfg, this.depth + 1);
26
36
  }
27
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-automator",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "description": "Execute automation with yaml configuration(compatible with json)",
5
5
  "main": "index.js",
6
6
  "repository": {