@rpcbase/cli 0.38.0 → 0.39.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
@@ -23,6 +23,11 @@ yargs(hideBin(process.argv))
23
23
  default: false,
24
24
  description: "Adds coverage instrumentation (always disabled in production)"
25
25
  })
26
+ .option("docker", {
27
+ type: "boolean",
28
+ default: false,
29
+ description: "Run in docker"
30
+ })
26
31
  .option("verbose", {
27
32
  type: "boolean",
28
33
  default: false,
@@ -34,7 +39,6 @@ yargs(hideBin(process.argv))
34
39
  description: "Run with debug logging"
35
40
  })
36
41
  }, (argv) => {
37
- console.log("IS start")
38
42
  if (argv.version) return print_versions()
39
43
  start_command(argv)
40
44
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/cli",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "license": "SSPL-1.0",
5
5
  "bin": {
6
6
  "rb": "./bin.js"
@@ -3,14 +3,8 @@ const {execSync} = require("child_process")
3
3
  const os = require("os")
4
4
  const colors = require("picocolors")
5
5
 
6
- const {CONTAINER_MODE} = process.env
7
6
 
8
7
  const docker_runtime_check = () => {
9
- // skip check on osx except when forcing docker
10
- if (os.platform() === "darwin" && CONTAINER_MODE !== "docker") {
11
- return
12
- }
13
-
14
8
  try {
15
9
  execSync("docker version -f json")
16
10
  } catch (err) {
@@ -5,13 +5,8 @@ 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
  // run type is client | server | both
11
- const get_run_configs = () => {
12
- if (!["docker", "native"].includes(CONTAINER_MODE.trim()))
13
- throw new Error("expected CONTAINER_MODE to be native|docker")
14
-
9
+ const get_run_configs = (args) => {
15
10
  const cwd = process.cwd()
16
11
 
17
12
  // check if running parent of rb project
@@ -62,8 +57,9 @@ const get_run_configs = () => {
62
57
 
63
58
  if (run_configs) {
64
59
  // check if there is server we add agent but in native mode only
60
+ // in docker mode, the agent is a container
65
61
  const server = run_configs.find((rc) => rc.type === "server")
66
- if (server && CONTAINER_MODE === "native") {
62
+ if (server && !args.docker) {
67
63
  run_configs.push({
68
64
  type: "agent",
69
65
  working_dir: server.working_dir,
@@ -35,7 +35,7 @@ const start = (run_configs) => {
35
35
  execSync(`${TAILSCALE_PATH} serve https:443 / http://127.0.0.1:${server_port}`, {stdio: "inherit"})
36
36
  execSync(`${TAILSCALE_PATH} funnel 443 on`, {stdio: "inherit"})
37
37
  } catch (err) {
38
- console.log("TAILSCALE ERR", err)
38
+ console.log("error starting tailscale, is the tailscale app running ?")
39
39
  }
40
40
  }
41
41
 
@@ -49,7 +49,8 @@ const stop = (run_configs) => {
49
49
  execSync(`${TAILSCALE_PATH} serve https:443 / http://127.0.0.1:${server_port} off`, {stdio: "inherit"})
50
50
  execSync(`${TAILSCALE_PATH} funnel 443 off`, {stdio: "inherit"})
51
51
  } catch (err) {
52
- console.log("TAILSCALE ERR", err)
52
+ // console.log("TAILSCALE ERR", err)
53
+ console.log("error stopping tailscale, it probably wasn't initally running. you can probably ignore it")
53
54
  }
54
55
  }
55
56
 
@@ -18,7 +18,7 @@ const verify_project = require("./verify_project")
18
18
  // server native + docker + docker-native is way too complex
19
19
  // either everything is native, or everything is in docker
20
20
  const start_command = async(args) => {
21
- const run_configs = get_run_configs()
21
+ const run_configs = get_run_configs(args)
22
22
 
23
23
  const run_commands = []
24
24
 
@@ -49,7 +49,6 @@ const start_command = async(args) => {
49
49
  command = `${command} ${hideBin(process.argv).join(" ")}`
50
50
  }
51
51
 
52
-
53
52
  // add command
54
53
  run_commands.push({
55
54
  name,
@@ -62,9 +61,8 @@ const start_command = async(args) => {
62
61
 
63
62
  const has_server = run_configs.findIndex((c) => c.type === "server") > -1
64
63
 
65
- // TODO: we shouldnt check in native mode
66
64
  // check if docker is running
67
- if (has_server) {
65
+ if (args.docker) {
68
66
  docker_runtime_check()
69
67
  }
70
68