diff --git a/src/local-pkgsite/devcontainer-feature.json b/src/local-pkgsite/devcontainer-feature.json index 609f3e2..0379104 100644 --- a/src/local-pkgsite/devcontainer-feature.json +++ b/src/local-pkgsite/devcontainer-feature.json @@ -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": { diff --git a/src/local-pkgsite/install.sh b/src/local-pkgsite/install.sh index 279eca2..58b2ca8 100644 --- a/src/local-pkgsite/install.sh +++ b/src/local-pkgsite/install.sh @@ -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}"