@rpcbase/cli 0.4.0 → 0.7.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 +7 -2
- package/package.json +2 -1
- package/src/default_command.js +19 -1
- package/src/helpers/get_run_configs.js +14 -4
- package/src/update/index.js +0 -4
- package/src/verify_project/verify_env.js +12 -12
- package/src/auto/run_before.js +0 -3
- package/src/run_agent.js +0 -0
- package/src/run_client.js +0 -5
- package/src/run_server.js +0 -0
- package/src/watch/client/index.js +0 -1
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
|
|
@@ -21,6 +20,12 @@ const args = yargs(hideBin(process.argv))
|
|
|
21
20
|
is_command = true
|
|
22
21
|
console.log("PING")
|
|
23
22
|
})
|
|
23
|
+
.option("coverage", {
|
|
24
|
+
alias: "c",
|
|
25
|
+
type: "boolean",
|
|
26
|
+
default: false,
|
|
27
|
+
description: "Adds coverage instrumentation (always disabled in production)"
|
|
28
|
+
})
|
|
24
29
|
// .option("version", {
|
|
25
30
|
// alias: "v",
|
|
26
31
|
// type: "boolean",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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",
|
package/src/default_command.js
CHANGED
|
@@ -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,27 @@ 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"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// pass through coverage arg to client and server
|
|
40
|
+
if (["client", "server"].includes(cfg.type) && args.coverage) {
|
|
41
|
+
command = `${command} --coverage`
|
|
29
42
|
}
|
|
30
43
|
|
|
31
44
|
// command, name, prefixColor, env, cwd
|
|
@@ -62,8 +75,13 @@ const default_command = async(args) => {
|
|
|
62
75
|
}
|
|
63
76
|
})
|
|
64
77
|
|
|
78
|
+
debug("run_configs", run_configs)
|
|
79
|
+
|
|
65
80
|
// asynchronously verify project config and kill process if any error
|
|
66
|
-
|
|
81
|
+
const configs = run_configs
|
|
82
|
+
.filter(({type}) => ["client", "server"].includes(type))
|
|
83
|
+
|
|
84
|
+
project_errors = await verify_project(configs)
|
|
67
85
|
|
|
68
86
|
if (project_errors.length > 0) {
|
|
69
87
|
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
|
-
|
|
48
|
-
|
|
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
|
|
package/src/update/index.js
CHANGED
|
@@ -36,18 +36,18 @@ const SERVICES = [
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
39
|
+
// {
|
|
40
|
+
// name: "worker-queue",
|
|
41
|
+
// required_env: {
|
|
42
|
+
// "WORKER_QUEUE_PORT": validate_port
|
|
43
|
+
// },
|
|
44
|
+
// },
|
|
45
|
+
// {
|
|
46
|
+
// name: "session-store",
|
|
47
|
+
// required_env: {
|
|
48
|
+
// "SESSION_STORE_PORT": validate_port
|
|
49
|
+
// },
|
|
50
|
+
// },
|
|
51
51
|
]
|
|
52
52
|
|
|
53
53
|
|
package/src/auto/run_before.js
DELETED
package/src/run_agent.js
DELETED
|
File without changes
|
package/src/run_client.js
DELETED
package/src/run_server.js
DELETED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/* @flow */
|