@rpcbase/server 0.64.0 → 0.67.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.
@@ -1,7 +1,13 @@
1
1
  /* @flow */
2
2
  const os = require("os")
3
3
 
4
+ const {FORCE_DOCKER} = process.env
5
+
4
6
  const get_runtime = () => {
7
+ if (FORCE_DOCKER) {
8
+ return "docker"
9
+ }
10
+
5
11
  if (os.platform() === "darwin") {
6
12
  return "native"
7
13
  } else {
package/cli/run_docker.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /* @flow */
2
2
  const {spawn} = require("child_process")
3
3
  const path = require("path")
4
+ const fs = require("fs")
4
5
 
5
6
  const chalk = require("chalk")
6
7
 
@@ -10,15 +11,26 @@ const run_docker = async(infrastructure_dir, proj_prefix, is_native) => {
10
11
  // env
11
12
  const env_path = path.relative(infrastructure_dir, path.join(process.cwd(), "./.env"))
12
13
 
14
+ const exists = (f) => {
15
+ const target_path = path.join(infrastructure_dir, f)
16
+ return fs.existsSync(target_path)
17
+ }
18
+
13
19
  // compose files
14
20
  const compose_files = ["-f", "common.yml"]
15
- if (!is_native) {
21
+ // TODO: which files are loaded and when should be documented
22
+ if (!is_native && exists("native.yml")) {
16
23
  compose_files.push("-f", "native.yml")
17
24
  }
18
- if (is_production) {
25
+ if (!is_native && !is_production && exists("native.dev.yml")) {
26
+ compose_files.push("-f", "native.dev.yml")
27
+ }
28
+ if (is_production && exists("prod.yml")) {
19
29
  compose_files.push("-f", "prod.yml")
20
30
  }
21
- else compose_files.push("-f", "dev.yml")
31
+ if (!is_production && exists("dev.yml")) {
32
+ compose_files.push("-f", "dev.yml")
33
+ }
22
34
 
23
35
  const opts = ["--build", "--remove-orphans"]
24
36
  if (!is_production) opts.push("--abort-on-container-exit")
@@ -29,6 +41,9 @@ const run_docker = async(infrastructure_dir, proj_prefix, is_native) => {
29
41
 
30
42
  console.log(cmd_args.join(" "))
31
43
 
44
+ // trim extra docker spaces
45
+ const fmt_line = (line) => line.replace(" |", "")
46
+
32
47
  const ps = spawn(cmd, cmd_args, {cwd: infrastructure_dir})
33
48
  ps.stdout.on("data", (data) => {
34
49
  const lines = data.toString().split("\n")
@@ -36,7 +51,7 @@ const run_docker = async(infrastructure_dir, proj_prefix, is_native) => {
36
51
  if (line.trim() === "") {
37
52
  return
38
53
  }
39
- process.stdout.write(`${chalk.cyan("docker")}: ${line}\n`)
54
+ process.stdout.write(`${chalk.cyan("docker")}: ${fmt_line(line)}\n`)
40
55
  })
41
56
  })
42
57
 
@@ -46,7 +61,7 @@ const run_docker = async(infrastructure_dir, proj_prefix, is_native) => {
46
61
  if (line.trim() === "") {
47
62
  return
48
63
  }
49
- process.stdout.write(`${chalk.cyan("docker")}: ${chalk.yellow(line)}\n`)
64
+ process.stdout.write(`${chalk.cyan("docker")}: ${chalk.yellow(fmt_line(line))}\n`)
50
65
  })
51
66
  })
52
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.64.0",
3
+ "version": "0.67.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "bin": {