Skip to content

Commit 49ea1d3

Browse files
authored
node-env clean-up (#22)
* Update build commands and clean node-env script * fix node-envv * clean up * update doc * fixes * rm tests files * rm * fix example * fix * improvements to scripts * lint * add lint * fix * fixes * fixes * fixes * add doc * fixes * lint fixes * fixes * update
1 parent bf93f54 commit 49ea1d3

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

scripts/node-env.sh

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,6 @@ function dev-node() {
244244
pkill -f mitmproxy
245245
start_mitmproxy "9944:8844"
246246

247-
if [ -n "$TMUX" ]; then
248-
tmux rename-window "dev-node"
249-
fi
250-
251247
# Add --chain argument if --retester is passed
252248
if [ "$retester_spec" = "true" ]; then
253249
args+=("--chain" "$HOME/.revive/revive-dev-node-chainspec.json")
@@ -259,18 +255,22 @@ function dev-node() {
259255
{ set +x; } 2>/dev/null
260256
;;
261257
run)
262-
if [ -n "$TMUX" ]; then
263-
tmux rename-window "dev-node"
264-
fi
265258

266259
# Add --chain argument if --retester is passed
267260
if [ "$retester_spec" = "true" ]; then
268261
args+=("--chain" "$HOME/.revive/revive-dev-node-chainspec.json")
269262
fi
270263

271-
set -x
272-
"$POLKADOT_SDK_DIR/target/$bin_folder/revive-dev-node" --log="$RUST_LOG" --network-backend libp2p --no-prometheus --dev "${args[@]}"
273-
{ set +x; } 2>/dev/null
264+
# Check if lnav is installed and pipe output to it if available
265+
if command -v lnav &>/dev/null; then
266+
set -x
267+
"$POLKADOT_SDK_DIR/target/$bin_folder/revive-dev-node" --log="$RUST_LOG" --network-backend libp2p --no-prometheus --dev "${args[@]}" 2>&1 | lnav
268+
{ set +x; } 2>/dev/null
269+
else
270+
set -x
271+
"$POLKADOT_SDK_DIR/target/$bin_folder/revive-dev-node" --log="$RUST_LOG" --network-backend libp2p --no-prometheus --dev "${args[@]}"
272+
{ set +x; } 2>/dev/null
273+
fi
274274
;;
275275
*)
276276
set -x
@@ -364,12 +364,9 @@ function eth-rpc() {
364364
pkill -f mitmproxy
365365
start_mitmproxy "8545:8546"
366366

367-
if [ -n "$TMUX" ]; then
368-
tmux rename-window "eth-rpc"
369-
fi
370-
371367
# Build and execute command with optional output redirection
372368
if [ "$record_mode" = "true" ]; then
369+
echo "recording requests to $record_path"
373370
set -x
374371
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
375372
--log="$RUST_LOG" \
@@ -430,6 +427,7 @@ function eth-rpc() {
430427

431428
# Build and execute command with optional output redirection
432429
if [ "$record_mode" = "true" ]; then
430+
echo "recording requests to $record_path"
433431
set -x
434432
"$POLKADOT_SDK_DIR/target/$bin_folder/eth-rpc" \
435433
--log="$RUST_LOG" \
@@ -534,6 +532,8 @@ function revive_dev_stack() {
534532

535533
# Kill existing 'servers' window if it exists
536534
tmux kill-window -t servers 2>/dev/null
535+
# Kill existing 'mitmproxy' window if it exists
536+
tmux kill-window -t mitmproxy 2>/dev/null
537537

538538
# Parse arguments
539539
use_proxy="false"
@@ -588,6 +588,12 @@ function revive_dev_stack() {
588588
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
589589
"$eth_rpc_url" >/dev/null 2>&1; then
590590
echo "eth-rpc is ready!"
591+
592+
# Check if dunst is installed and send notification
593+
if command -v notify-send &>/dev/null; then
594+
notify-send -t 3000 "eth-rpc is ready!"
595+
fi
596+
591597
return 0
592598
fi
593599
attempt=$((attempt + 1))
@@ -901,6 +907,8 @@ function geth-proxy() {
901907
function geth_stack() {
902908
# Kill existing 'servers' window if it exists
903909
tmux kill-window -t servers 2>/dev/null
910+
# Kill existing 'mitmproxy' window if it exists
911+
tmux kill-window -t mitmproxy 2>/dev/null
904912

905913
# Create new 'servers' window in detached mode
906914
# Source shell config and run geth-proxy with default ports (8545->8546)
@@ -916,6 +924,8 @@ function geth_stack() {
916924
function passet_stack() {
917925
# Kill existing 'servers' window if it exists
918926
tmux kill-window -t servers 2>/dev/null
927+
# Kill existing 'mitmproxy' window if it exists
928+
tmux kill-window -t mitmproxy 2>/dev/null
919929

920930
# Parse arguments
921931
use_proxy="false"
@@ -951,6 +961,8 @@ function passet_stack() {
951961
function westend_stack() {
952962
# Kill existing 'servers' window if it exists
953963
tmux kill-window -t servers 2>/dev/null
964+
# Kill existing 'mitmproxy' window if it exists
965+
tmux kill-window -t mitmproxy 2>/dev/null
954966

955967
# Parse arguments
956968
use_proxy="false"

0 commit comments

Comments
 (0)