Skip to content

Commit

Permalink
fix: local-pkgsite
Browse files Browse the repository at this point in the history
Signed-off-by: thediveo <thediveo@gmx.eu>
  • Loading branch information
thediveo committed Jan 5, 2025
1 parent 6e12649 commit 8654ded
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/local-pkgsite/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Local Go Pkgsite",
"id": "local-pkgsite",
"version": "0.1.1",
"version": "0.1.2",
"description": "A local Go pkgsite serving the module documentation",
"options": {
"port": {
Expand Down
7 changes: 5 additions & 2 deletions src/local-pkgsite/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ PKGSITE_BIN=$(which pkgsite)
npm -g install browser-sync
npm -g install nodemon

source /usr/local/share/nvm/nvm.sh
NPMBINS="/usr/local/share/nvm/versions/node/$(nvm current)/bin"

tee "${PKGSITE_SERVE_PATH}" > /dev/null \
<< EOF
#!/usr/bin/env sh
INT_PORT=$(comm -23 <(seq 49152 65535 | sort) \
<(netstat -ntl | awk '/LISTEN/ {split($4,a,":"); print a[2]}' | sort -u) 2>/dev/null \
| shuf | head -n 1)
nohup bash -c "browser-sync start --port ${PORT} --proxy localhost:\${INT_PORT} --reload-delay ${RELOAD_DELAY} --reload-debounce ${RELOAD_DEBOUNCE} --no-ui --no-open &" >/tmp/nohup-browser-sync.log 2>&1
nohup bash -c "nodemon --signal SIGTERM --watch './**/*' -e go --watch 'go.mod' --exec \"browser-sync --port ${PORT} reload && ${PKGSITE_BIN} -http=localhost:\${INT_PORT} .\" &" >/tmp/nohup.log 2>&1
nohup bash -c "${NPMBINS}/browser-sync start --port ${PORT} --proxy localhost:\${INT_PORT} --reload-delay ${RELOAD_DELAY} --reload-debounce ${RELOAD_DEBOUNCE} --no-ui --no-open &" >/tmp/nohup-browser-sync.log 2>&1
nohup bash -c "${NPMBINS}/nodemon --signal SIGTERM --watch './**/*' -e go --watch 'go.mod' --exec \"browser-sync --port ${PORT} reload && ${PKGSITE_BIN} -http=localhost:\${INT_PORT} .\" &" >/tmp/nohup.log 2>&1
EOF
chmod 0755 "${PKGSITE_SERVE_PATH}"

0 comments on commit 8654ded

Please sign in to comment.