Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hmr script #50

Merged
merged 17 commits into from
Jun 27, 2024
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"postinstall": "syncpack list-mismatches",
"pretest": "playwright install",
"test": "turbo test",
"test:rust": "turbo test:rust"
"test:rust": "turbo test:rust",
"watch-and-repack": "./watch-and-repack.sh"
},
"dependencies": {
"@buf/cosmos_ibc.bufbuild_es": "1.10.0-20240606104028-442292b00c16.1",
Expand Down
31 changes: 31 additions & 0 deletions watch-and-repack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Relative paths to the web repositories
PENUMBRA_ZONE_WEB_PATH="../../web"
TalDerei marked this conversation as resolved.
Show resolved Hide resolved
PRAX_REPO_PATH="."

# Repack the packages in penumbra-zone/web
repack() {
(cd "$PENUMBRA_ZONE_WEB_PATH" && ./pack-public.sh)
TalDerei marked this conversation as resolved.
Show resolved Hide resolved
}

# Install dependencies in prax-wallet/web
install_prax() {
(cd "$PRAX_REPO_PATH" && pnpm install)
}

# Reload webpack
reload_webpack() {
pkill -f "pnpm run dev" # Stop any existing webpack dev server
(cd "$PRAX_REPO_PATH" && pnpm run dev &)
}

# Watch for changes in penumbra-zone/web and trigger repack and reload
while true; do
fswatch -1 -o "$PENUMBRA_ZONE_WEB_PATH/packages" | while read -r; do
repack
install_prax
reload_webpack
break
done
done
Loading