@rpcbase/cli 0.6.0 → 0.9.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
@@ -20,6 +20,12 @@ const args = yargs(hideBin(process.argv))
20
20
  is_command = true
21
21
  console.log("PING")
22
22
  })
23
+ .option("coverage", {
24
+ alias: "c",
25
+ type: "boolean",
26
+ default: false,
27
+ description: "Adds coverage instrumentation (always disabled in production)"
28
+ })
23
29
  // .option("version", {
24
30
  // alias: "v",
25
31
  // type: "boolean",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/cli",
3
- "version": "0.6.0",
3
+ "version": "0.9.0",
4
4
  "license": "SSPL-1.0",
5
5
  "bin": {
6
6
  "rb": "./bin.js"
@@ -11,11 +11,11 @@
11
11
  "dependencies": {
12
12
  "bluebird": "3.7.2",
13
13
  "chalk": "4.1.2",
14
- "concurrently": "7.0.0",
14
+ "concurrently": "7.2.1",
15
15
  "debug": "4.3.4",
16
- "dotenv": "16.0.0",
17
- "semver": "7.3.5",
16
+ "dotenv": "16.0.1",
17
+ "semver": "7.3.7",
18
18
  "validator": "13.7.0",
19
- "yargs": "17.4.0"
19
+ "yargs": "17.5.1"
20
20
  }
21
21
  }
@@ -5,16 +5,19 @@ const fs = require("fs")
5
5
  const chalk = require("chalk")
6
6
  const concurrently = require("concurrently")
7
7
 
8
+ const docker_runtime_check = require("./helpers/docker_runtime_check")
8
9
  const exit_with_message = require("./helpers/exit_with_message")
9
10
  const get_run_configs = require("./helpers/get_run_configs")
10
- const docker_runtime_check = require("./helpers/docker_runtime_check")
11
11
  const verify_project = require("./verify_project")
12
12
 
13
-
13
+ // TODO: nuke this
14
+ // server native + docker + docker-native is way too complex
15
+ // either everything is native, or everything is in docker
14
16
  const default_command = async(args) => {
15
17
  const run_configs = get_run_configs()
16
18
 
17
- const run_commands = run_configs.map((cfg) => {
19
+ const run_commands = []
20
+ run_configs.forEach((cfg) => {
18
21
  let name
19
22
  let command
20
23
  let prefixColor
@@ -36,15 +39,21 @@ const default_command = async(args) => {
36
39
  prefixColor = "#4DB33D"
37
40
  }
38
41
 
39
- // command, name, prefixColor, env, cwd
40
- return {
42
+ // pass through coverage arg to client and server
43
+ if (["client", "server"].includes(cfg.type) && args.coverage) {
44
+ command = `${command} --coverage`
45
+ }
46
+
47
+ // add command
48
+ run_commands.push({
41
49
  name,
42
50
  command,
43
51
  prefixColor,
44
52
  cwd: cfg.working_dir
45
- }
53
+ })
46
54
  })
47
55
 
56
+ // check if docker is running
48
57
  if (run_configs.filter((c) => c.type === "server").length > 0) {
49
58
  docker_runtime_check()
50
59
  }
@@ -1,8 +1,17 @@
1
1
  /* @flow */
2
2
  const {execSync} = require("child_process")
3
+ const os = require("os")
3
4
  const chalk = require("chalk")
4
5
 
6
+ const {FORCE_DOCKER} = process.env
7
+
5
8
  const docker_runtime_check = () => {
9
+ // skip check on osx except when forcing docker
10
+ if (os.platform() === "darwin" && !FORCE_DOCKER) {
11
+ return
12
+ }
13
+
14
+
6
15
  try {
7
16
  execSync("docker version -f json")
8
17
  } catch (err) {
@@ -5,11 +5,11 @@ const fs = require("fs")
5
5
  const ERRORS = require("../errors")
6
6
  const exit_with_message = require("./exit_with_message")
7
7
 
8
-
9
8
  // run type is client | server | both
10
9
  const get_run_configs = () => {
11
10
  const cwd = process.cwd()
12
11
 
12
+
13
13
  // check if running parent of rb project
14
14
  const dir_contents = fs.readdirSync(cwd)
15
15
  const is_parent_dir = dir_contents.includes("client") && dir_contents.includes("server")
@@ -57,6 +57,8 @@ const get_run_configs = () => {
57
57
  working_dir: path.join(cwd, "../infrastructure")
58
58
  },
59
59
  ]
60
+ } else {
61
+ console.log("TODO: server get_run_configs:handle edge case here")
60
62
  }
61
63
  }
62
64