@rpcbase/cli 0.59.0 → 0.60.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
@@ -11,6 +11,7 @@ const {hideBin} = require("yargs/helpers")
11
11
  const increment_pkg = require("./src/versions/increment-pkg")
12
12
  const print_versions = require("./src/print_versions")
13
13
  const start_command = require("./src/start_command")
14
+ const run_agent = require("./src/run_agent")
14
15
  const sync_dotenv = require("./src/sync-dotenv")
15
16
  const update = require("./src/update")
16
17
  const wait_for = require("./src/wait-for")
@@ -44,6 +45,18 @@ yargs(hideBin(process.argv))
44
45
  if (argv.version) return print_versions()
45
46
  start_command(argv)
46
47
  })
48
+ .command(["agent"], "Run the agent", (yargs) => {
49
+ yargs
50
+ // .option("option1", {
51
+ // alias: "o",
52
+ // type: "boolean",
53
+ // default: false,
54
+ // description: "Option description"
55
+ // })
56
+ }, (argv) => {
57
+ if (argv.version) return print_versions()
58
+ run_agent(argv)
59
+ })
47
60
  // Update
48
61
  .command(["update", "up"], "Update rb dependencies to latest version", (yargs) => {
49
62
  yargs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/cli",
3
- "version": "0.59.0",
3
+ "version": "0.60.0",
4
4
  "license": "SSPL-1.0",
5
5
  "bin": {
6
6
  "rb": "./bin.js"
@@ -38,6 +38,7 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
+ "@rpcbase/agent": "0.37.0",
41
42
  "bluebird": "3.7.2",
42
43
  "concurrently": "8.2.1",
43
44
  "debug": "4.3.4",
@@ -63,7 +63,7 @@ const get_run_configs = (args) => {
63
63
  if (server && !args.docker) {
64
64
  run_configs.push({
65
65
  type: "agent",
66
- working_dir: server.working_dir,
66
+ working_dir: cwd,
67
67
  })
68
68
  }
69
69
  return run_configs
@@ -0,0 +1,17 @@
1
+ /* @flow */
2
+ const path = require("path")
3
+ const fs = require("fs")
4
+
5
+ const {run} = require("@rpcbase/agent")
6
+
7
+ const run_agent = async() => {
8
+ process.title = "rb-agent"
9
+
10
+ const cwd = process.cwd()
11
+ const proj_parent_dir = cwd// path.join(cwd, "../../")
12
+ const proj_prefix = path.basename(proj_parent_dir)
13
+
14
+ run(proj_prefix)
15
+ }
16
+
17
+ module.exports = run_agent
@@ -40,8 +40,12 @@ const start_command = async(args) => {
40
40
  // agent
41
41
  } else if (cfg.type === "agent") {
42
42
  name = "agent"
43
- command = "../server/node_modules/.bin/rb-server agent"
43
+ command = "./node_modules/.bin/rb agent"
44
44
  prefixColor = "#4DB33D"
45
+ } else if (cfg.type === "worker") {
46
+ // E2D99F F6D457 F6B51C
47
+ } else {
48
+ throw new Error("unknown cfg.type")
45
49
  }
46
50
 
47
51
  // pass through listed args to client and server