@rpcbase/cli 0.31.0 → 0.32.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/cli",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "license": "SSPL-1.0",
5
5
  "bin": {
6
6
  "rb": "./bin.js"
@@ -9,9 +9,12 @@ const get_root_dir = require("./get_root_dir")
9
9
 
10
10
  const TAILSCALE_PATH = "/Applications/Tailscale.app/Contents/MacOS/Tailscale"
11
11
 
12
+ const has_tailscale = process.platform === "darwin" && fs.existsSync(TAILSCALE_PATH)
13
+
12
14
  const get_port = (run_configs) => {
13
15
  const project_root_dir = get_root_dir(run_configs)
14
16
 
17
+ // TODO: should join w/ .env.base
15
18
  const server_env_path = path.join(project_root_dir, "./server/server/.env")
16
19
 
17
20
  const server_env_buf = fs.readFileSync(server_env_path)
@@ -25,6 +28,8 @@ const get_port = (run_configs) => {
25
28
 
26
29
 
27
30
  const start = (run_configs) => {
31
+ if (!has_tailscale) return
32
+
28
33
  const {server_port, wss_port} = get_port(run_configs)
29
34
  try {
30
35
  execSync(`${TAILSCALE_PATH} serve https:443 /wss http://127.0.0.1:${wss_port}`, {stdio: "inherit"})
@@ -37,6 +42,8 @@ const start = (run_configs) => {
37
42
 
38
43
 
39
44
  const stop = (run_configs) => {
45
+ if (!has_tailscale) return
46
+
40
47
  const {server_port, wss_port} = get_port(run_configs)
41
48
  try {
42
49
  execSync(`${TAILSCALE_PATH} serve https:443 /wss http://127.0.0.1:${wss_port} off`, {stdio: "inherit"})