@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 +13 -0
- package/package.json +2 -1
- package/src/helpers/get_run_configs.js +1 -1
- package/src/run_agent.js +17 -0
- package/src/start_command.js +5 -1
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.
|
|
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",
|
package/src/run_agent.js
ADDED
|
@@ -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
|
package/src/start_command.js
CHANGED
|
@@ -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 = "
|
|
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
|