@rpcbase/server 0.62.0 → 0.63.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/cli/get_runtime.js +0 -1
- package/cli/run_docker.js +32 -13
- package/express/index.js +1 -1
- package/index.js +1 -0
- package/package.json +1 -1
package/cli/get_runtime.js
CHANGED
package/cli/run_docker.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* @flow */
|
|
2
|
-
const {
|
|
2
|
+
const {spawn} = require("child_process")
|
|
3
3
|
const path = require("path")
|
|
4
4
|
|
|
5
|
+
const chalk = require("chalk")
|
|
6
|
+
|
|
5
7
|
const is_production = "yes" === process.env.INFRASTRUCTURE_IS_PRODUCTION
|
|
6
8
|
|
|
7
9
|
const run_docker = async(infrastructure_dir, proj_prefix, is_native) => {
|
|
@@ -9,28 +11,45 @@ const run_docker = async(infrastructure_dir, proj_prefix, is_native) => {
|
|
|
9
11
|
const env_path = path.relative(infrastructure_dir, path.join(process.cwd(), "./.env"))
|
|
10
12
|
|
|
11
13
|
// compose files
|
|
12
|
-
const compose_files = ["-f common.yml"]
|
|
14
|
+
const compose_files = ["-f", "common.yml"]
|
|
13
15
|
if (!is_native) {
|
|
14
|
-
compose_files.push("-f native.yml")
|
|
16
|
+
compose_files.push("-f", "native.yml")
|
|
15
17
|
}
|
|
16
18
|
if (is_production) {
|
|
17
|
-
compose_files.push("-f prod.yml")
|
|
19
|
+
compose_files.push("-f", "prod.yml")
|
|
18
20
|
}
|
|
19
|
-
else compose_files.push("-f dev.yml")
|
|
21
|
+
else compose_files.push("-f", "dev.yml")
|
|
20
22
|
|
|
21
23
|
const opts = ["--build", "--remove-orphans"]
|
|
22
24
|
if (!is_production) opts.push("--abort-on-container-exit")
|
|
23
25
|
|
|
24
|
-
const cmd =
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
const cmd = "docker-compose"
|
|
27
|
+
// const cmd_args = `--env-file ${env_path} -p ${proj_prefix} ${compose_files.join(" ")} up ${opts.join(" ")}`
|
|
28
|
+
const cmd_args = ["--env-file", env_path, "-p", proj_prefix, ...compose_files, "up", ...opts]
|
|
29
|
+
|
|
30
|
+
console.log(cmd_args.join(" "))
|
|
31
|
+
|
|
32
|
+
const ps = spawn(cmd, cmd_args, {cwd: infrastructure_dir})
|
|
33
|
+
ps.stdout.on("data", (data) => {
|
|
34
|
+
const lines = data.toString().split("\n")
|
|
35
|
+
lines.forEach((line) => {
|
|
36
|
+
if (line.trim() === "") {
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
process.stdout.write(`${chalk.cyan("docker")}: ${line}`)
|
|
40
|
+
})
|
|
41
|
+
})
|
|
27
42
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
ps.stderr.on("data", (data) => {
|
|
44
|
+
const lines = data.toString().split("\n")
|
|
45
|
+
lines.forEach((line) => {
|
|
46
|
+
if (line.trim() === "") {
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
process.stdout.write(`${chalk.cyan("docker")}: ${chalk.yellow(line)}\n`)
|
|
50
|
+
})
|
|
33
51
|
})
|
|
52
|
+
|
|
34
53
|
// try {
|
|
35
54
|
//
|
|
36
55
|
// } catch (err) {
|
package/express/index.js
CHANGED
package/index.js
CHANGED