@rpcbase/cli 0.18.0 → 0.20.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
package/package.json
CHANGED
|
@@ -5,11 +5,13 @@ const fs = require("fs")
|
|
|
5
5
|
const ERRORS = require("../errors")
|
|
6
6
|
const exit_with_message = require("./exit_with_message")
|
|
7
7
|
|
|
8
|
+
const {CONTAINER_MODE} = process.env
|
|
9
|
+
|
|
10
|
+
|
|
8
11
|
// run type is client | server | both
|
|
9
12
|
const get_run_configs = () => {
|
|
10
13
|
const cwd = process.cwd()
|
|
11
14
|
|
|
12
|
-
|
|
13
15
|
// check if running parent of rb project
|
|
14
16
|
const dir_contents = fs.readdirSync(cwd)
|
|
15
17
|
const is_parent_dir = dir_contents.includes("client") && dir_contents.includes("server")
|
|
@@ -23,8 +25,10 @@ const get_run_configs = () => {
|
|
|
23
25
|
return
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
let run_configs
|
|
29
|
+
|
|
26
30
|
if (is_parent_dir) {
|
|
27
|
-
|
|
31
|
+
run_configs = [
|
|
28
32
|
{
|
|
29
33
|
type: "client",
|
|
30
34
|
working_dir: path.join(cwd, "./client")
|
|
@@ -33,35 +37,39 @@ const get_run_configs = () => {
|
|
|
33
37
|
type: "server",
|
|
34
38
|
working_dir: path.join(cwd, "./server/server")
|
|
35
39
|
},
|
|
36
|
-
{
|
|
37
|
-
type: "agent",
|
|
38
|
-
working_dir: path.join(cwd, "./server/infrastructure")
|
|
39
|
-
},
|
|
40
40
|
]
|
|
41
41
|
} else {
|
|
42
42
|
// client
|
|
43
43
|
if (dir === "client") {
|
|
44
|
-
|
|
44
|
+
run_configs = [{
|
|
45
45
|
type: "client",
|
|
46
46
|
working_dir: cwd
|
|
47
47
|
}]
|
|
48
48
|
// check if parent dir is also server, because we are in server/server
|
|
49
49
|
} else if (dir === "server" && path.basename(path.dirname(cwd)) === "server") {
|
|
50
|
-
|
|
50
|
+
run_configs = [
|
|
51
51
|
{
|
|
52
52
|
type: "server",
|
|
53
53
|
working_dir: cwd
|
|
54
|
-
}
|
|
55
|
-
{
|
|
56
|
-
type: "agent",
|
|
57
|
-
working_dir: path.join(cwd, "../infrastructure")
|
|
58
|
-
},
|
|
54
|
+
}
|
|
59
55
|
]
|
|
60
56
|
} else {
|
|
61
57
|
console.log("TODO: server get_run_configs:handle edge case here")
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
|
|
61
|
+
if (run_configs) {
|
|
62
|
+
// check if there is server we add agent but in native mode only
|
|
63
|
+
const server = run_configs.find((rc) => rc.type === "server")
|
|
64
|
+
if (server && CONTAINER_MODE === "native") {
|
|
65
|
+
run_configs.push({
|
|
66
|
+
type: "agent",
|
|
67
|
+
working_dir: server.working_dir,
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
return run_configs
|
|
71
|
+
}
|
|
72
|
+
|
|
65
73
|
// fails when no match found
|
|
66
74
|
exit_with_message(ERRORS.INVALID_CWD)
|
|
67
75
|
}
|
package/src/start_command.js
CHANGED
|
@@ -26,6 +26,10 @@ const get_root_dir = (run_configs) => {
|
|
|
26
26
|
const verify_project = async(run_configs) => {
|
|
27
27
|
let result_errors = []
|
|
28
28
|
|
|
29
|
+
console.log("WARNING VERIFY_PROJECT IS BROKEN, SKIPPING FOR NOW")
|
|
30
|
+
return result_errors
|
|
31
|
+
|
|
32
|
+
|
|
29
33
|
const project_root_dir = get_root_dir(run_configs)
|
|
30
34
|
|
|
31
35
|
// check if all installed packages match semver in package json file
|
|
@@ -10,8 +10,17 @@ const exec = util.promisify(require("child_process").exec)
|
|
|
10
10
|
const LIST_CMD = "npm ls --depth=0 --json || true"
|
|
11
11
|
|
|
12
12
|
const get_installed_pkgs = async(wd) => {
|
|
13
|
-
const {stdout: npm_out} = await exec(LIST_CMD, {cwd: wd})
|
|
14
|
-
|
|
13
|
+
const {stdout: npm_out, stderr} = await exec(LIST_CMD, {cwd: wd})
|
|
14
|
+
|
|
15
|
+
let npm_json
|
|
16
|
+
try {
|
|
17
|
+
npm_json = JSON.parse(npm_out)
|
|
18
|
+
} catch (err) {
|
|
19
|
+
console.log("failed to parse npm_json:")
|
|
20
|
+
console.log(npm_json)
|
|
21
|
+
console.log("STDERR:", stderr)
|
|
22
|
+
throw err
|
|
23
|
+
}
|
|
15
24
|
const deps = npm_json.dependencies || {}
|
|
16
25
|
|
|
17
26
|
const result = {}
|