@rpcbase/cli 0.48.0 → 0.57.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.
@@ -0,0 +1 @@
1
+ {"fullyTracked":false,"platform":"linux","arch":"x64","nodeVersion":"v18.19.0","command":"node ../../scripts/prflow/apply-prerelease-versions.js $BRANCH_NAME","extraArgs":[],"clean":true,"files":{},"output":[],"dependencies":{},"env":{}}
File without changes
File without changes
package/bin.js CHANGED
@@ -13,6 +13,7 @@ const print_versions = require("./src/print_versions")
13
13
  const start_command = require("./src/start_command")
14
14
  const sync_dotenv = require("./src/sync-dotenv")
15
15
  const update = require("./src/update")
16
+ const wait_for = require("./src/wait-for")
16
17
 
17
18
 
18
19
  yargs(hideBin(process.argv))
@@ -81,6 +82,10 @@ yargs(hideBin(process.argv))
81
82
  if (argv.version) return print_versions()
82
83
  await sync_dotenv(argv.source_env, argv.dest_env)
83
84
  })
85
+ // wait-for
86
+ .command("wait-for", "", () => {}, (argv) => {
87
+ wait_for()
88
+ })
84
89
  // Ping
85
90
  .command("ping", "Ping", () => {}, (argv) => {
86
91
  if (argv.version) return print_versions()
package/package.json CHANGED
@@ -1,13 +1,38 @@
1
1
  {
2
2
  "name": "@rpcbase/cli",
3
- "version": "0.48.0",
3
+ "version": "0.57.0",
4
4
  "license": "SSPL-1.0",
5
5
  "bin": {
6
6
  "rb": "./bin.js"
7
7
  },
8
+ "publishConfig": {
9
+ "registry": "https://registry.npmjs.org/"
10
+ },
8
11
  "scripts": {
9
12
  "test": "echo \"no test specified exiting with code 0\" && exit 0"
10
13
  },
14
+ "wireit": {
15
+ "apply-version": {
16
+ "command": "node ../../scripts/prflow/apply-prerelease-versions.js $BRANCH_NAME"
17
+ },
18
+ "release": {
19
+ "command": "npm publish --tag $NPM_RELEASE_CHANNEL | tee publish-output.txt",
20
+ "dependencies": [
21
+ "apply-version"
22
+ ],
23
+ "files": [
24
+ "package.json"
25
+ ],
26
+ "output": [
27
+ "publish-output.txt"
28
+ ],
29
+ "env": {
30
+ "NPM_RELEASE_CHANNEL": {
31
+ "external": true
32
+ }
33
+ }
34
+ }
35
+ },
11
36
  "dependencies": {
12
37
  "bluebird": "3.7.2",
13
38
  "concurrently": "8.2.1",
File without changes
@@ -52,6 +52,7 @@ const get_run_configs = (args) => {
52
52
  ]
53
53
  } else {
54
54
  console.log("TODO: server get_run_configs:handle edge case here")
55
+ console.log("process.cwd:", process.cwd())
55
56
  }
56
57
  }
57
58
 
@@ -105,6 +105,9 @@ const increment_pkg = async(args) => {
105
105
  if (semver.lt(local_version, bumped_version)) {
106
106
  local_pack.version = bumped_version,
107
107
  fs.writeFileSync(local_pack_path, JSON.stringify(local_pack, null, 2) + "\n")
108
+
109
+ console.log("bumped", local_pack.name, "to", bumped_version)
110
+
108
111
  execSync(`git add ${local_pack_path}`)
109
112
  }
110
113
 
@@ -118,7 +121,7 @@ const increment_pkg = async(args) => {
118
121
  //
119
122
  // // if (next_version && semver.neq(remote_version, next_version)) {
120
123
  // if (next_version && semver.neq(local_version, next_version)) {
121
- // console.log("bumped", local_pack.name, "to", next_version)
124
+ //
122
125
  //
123
126
  // local_pack.version = next_version
124
127
  //
@@ -0,0 +1,21 @@
1
+ /* @flow */
2
+ const path = require("path")
3
+ const {execSync} = require("child_process");
4
+
5
+ const wait_for = () => {
6
+ process.title = "rb-wait-for"
7
+
8
+ const args = process.argv.slice(3).join(" ")
9
+
10
+ const script_path = path.join(__dirname, "./wait-for.sh")
11
+
12
+ const command = `${script_path} ${args}`
13
+
14
+ try {
15
+ execSync(command, {stdio: "inherit"})
16
+ } catch (error) {
17
+ console.error(`wait-for execution failed: ${error}`)
18
+ }
19
+ }
20
+
21
+ module.exports = wait_for
@@ -0,0 +1,81 @@
1
+ #!/bin/sh
2
+
3
+ # original script: https://github.com/eficode/wait-for/blob/master/wait-for
4
+
5
+ TIMEOUT=120
6
+ QUIET=0
7
+
8
+ echoerr() {
9
+ if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
10
+ }
11
+
12
+ usage() {
13
+ exitcode="$1"
14
+ cat << USAGE >&2
15
+ Usage:
16
+ $cmdname host:port [-t timeout] [-- command args]
17
+ -q | --quiet Do not output any status messages
18
+ -t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
19
+ -- COMMAND ARGS Execute command with args after the test finishes
20
+ USAGE
21
+ exit "$exitcode"
22
+ }
23
+
24
+ wait_for() {
25
+ for i in `seq $TIMEOUT` ; do
26
+ nc -z "$HOST" "$PORT" > /dev/null 2>&1
27
+
28
+ result=$?
29
+ if [ $result -eq 0 ] ; then
30
+ if [ $# -gt 0 ] ; then
31
+ exec "$@"
32
+ fi
33
+ exit 0
34
+ fi
35
+ sleep 1
36
+ done
37
+ echo "wait-for::Operation timed out" >&2
38
+ exit 1
39
+ }
40
+
41
+ while [ $# -gt 0 ]
42
+ do
43
+ case "$1" in
44
+ *:* )
45
+ HOST=$(printf "%s\n" "$1"| cut -d : -f 1)
46
+ PORT=$(printf "%s\n" "$1"| cut -d : -f 2)
47
+ shift 1
48
+ ;;
49
+ -q | --quiet)
50
+ QUIET=1
51
+ shift 1
52
+ ;;
53
+ -t)
54
+ TIMEOUT="$2"
55
+ if [ "$TIMEOUT" = "" ]; then break; fi
56
+ shift 2
57
+ ;;
58
+ --timeout=*)
59
+ TIMEOUT="${1#*=}"
60
+ shift 1
61
+ ;;
62
+ --)
63
+ shift
64
+ break
65
+ ;;
66
+ --help)
67
+ usage 0
68
+ ;;
69
+ *)
70
+ echoerr "Unknown argument: $1"
71
+ usage 1
72
+ ;;
73
+ esac
74
+ done
75
+
76
+ if [ "$HOST" = "" -o "$PORT" = "" ]; then
77
+ echoerr "Error: you need to provide a host and port to test."
78
+ usage 2
79
+ fi
80
+
81
+ wait_for "$@"
@@ -1,8 +0,0 @@
1
- /* @flow */
2
-
3
- const {syncEnv} = require("./index")
4
-
5
-
6
- const res = syncEnv(".env", ".env.sample")
7
-
8
- // console.log("FNDE", res)