@rpcbase/cli 0.5.0 → 0.6.0

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/bin.js CHANGED
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  /* @flow */
3
+ process.title = "rb"
3
4
  const path = require("path")
4
5
  require("dotenv").config({path: path.join(__dirname, "./.env")})
5
6
  const yargs = require("yargs/yargs")
6
7
  const {hideBin} = require("yargs/helpers")
7
8
 
8
9
  const default_command = require("./src/default_command")
9
- const run_client = require("./src/run_client")
10
- const run_server = require("./src/run_server")
11
10
  const update = require("./src/update")
12
11
 
13
12
  let is_command = false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "license": "SSPL-1.0",
5
5
  "bin": {
6
6
  "rb": "./bin.js"
@@ -12,6 +12,7 @@
12
12
  "bluebird": "3.7.2",
13
13
  "chalk": "4.1.2",
14
14
  "concurrently": "7.0.0",
15
+ "debug": "4.3.4",
15
16
  "dotenv": "16.0.0",
16
17
  "semver": "7.3.5",
17
18
  "validator": "13.7.0",
@@ -1,4 +1,5 @@
1
1
  /* @flow */
2
+ const debug = require("debug")("rb-cli")
2
3
  const path = require("path")
3
4
  const fs = require("fs")
4
5
  const chalk = require("chalk")
@@ -17,15 +18,22 @@ const default_command = async(args) => {
17
18
  let name
18
19
  let command
19
20
  let prefixColor
21
+ // client
20
22
  if (cfg.type === "client") {
21
23
  name = "client"
22
24
  // command = "yarn dev"
23
25
  command = "./node_modules/.bin/rb-webpack-browser dev"
24
26
  prefixColor = "#C678DD"
27
+ // server
25
28
  } else if (cfg.type === "server") {
26
29
  name = "server"
27
30
  command = "./node_modules/.bin/rb-server start"
28
31
  prefixColor = "#61AFEF"
32
+ // agent
33
+ } else if (cfg.type === "agent") {
34
+ name = "agent"
35
+ command = "../server/node_modules/.bin/rb-server agent"
36
+ prefixColor = "#4DB33D"
29
37
  }
30
38
 
31
39
  // command, name, prefixColor, env, cwd
@@ -62,8 +70,13 @@ const default_command = async(args) => {
62
70
  }
63
71
  })
64
72
 
73
+ debug("run_configs", run_configs)
74
+
65
75
  // asynchronously verify project config and kill process if any error
66
- project_errors = await verify_project(run_configs)
76
+ const configs = run_configs
77
+ .filter(({type}) => ["client", "server"].includes(type))
78
+
79
+ project_errors = await verify_project(configs)
67
80
 
68
81
  if (project_errors.length > 0) {
69
82
  commands.forEach((c) => {
@@ -33,6 +33,10 @@ const get_run_configs = () => {
33
33
  type: "server",
34
34
  working_dir: path.join(cwd, "./server/server")
35
35
  },
36
+ {
37
+ type: "agent",
38
+ working_dir: path.join(cwd, "./server/infrastructure")
39
+ },
36
40
  ]
37
41
  } else {
38
42
  // client
@@ -43,10 +47,16 @@ const get_run_configs = () => {
43
47
  }]
44
48
  // check if parent dir is also server, because we are in server/server
45
49
  } else if (dir === "server" && path.basename(path.dirname(cwd)) === "server") {
46
- return [{
47
- type: "server",
48
- working_dir: cwd
49
- }]
50
+ return [
51
+ {
52
+ type: "server",
53
+ working_dir: cwd
54
+ },
55
+ {
56
+ type: "agent",
57
+ working_dir: path.join(cwd, "../infrastructure")
58
+ },
59
+ ]
50
60
  }
51
61
  }
52
62
 
@@ -62,10 +62,6 @@ const update = async() => {
62
62
  execSync("yarn", {cwd: dir, stdio: "inherit"})
63
63
  }
64
64
  }
65
-
66
-
67
-
68
-
69
65
  }
70
66
 
71
67
  module.exports = update
@@ -1,3 +0,0 @@
1
- /* @flow */
2
-
3
- // check project folder layout
package/src/run_agent.js DELETED
File without changes
package/src/run_client.js DELETED
@@ -1,5 +0,0 @@
1
- /* @flow */
2
- const path = require("path")
3
- const fs = require("fs")
4
-
5
- // console.log("runclient")
package/src/run_server.js DELETED
File without changes
@@ -1 +0,0 @@
1
- /* @flow */