github.com/thediveo/gons@v0.9.9/scripts/pkgsite.sh (about) 1 #!/bin/bash 2 set -e 3 4 if ! command -v pkgsite &>/dev/null; then 5 export PATH="$(go env GOPATH)/bin:$PATH" 6 if ! command -v pkgsite &>/dev/null; then 7 go install golang.org/x/pkgsite/cmd/pkgsite@latest 8 fi 9 fi 10 11 # In case the user hasn't set an explicit installation location, avoid polluting 12 # our own project... 13 NPMBIN=$(cd $HOME && npm root)/.bin 14 export PATH="$NPMBIN:$PATH" 15 if ! command -v browser-sync &>/dev/null; then 16 (cd $HOME && npm install browser-sync) 17 fi 18 19 if ! command -v nodemon &>/dev/null; then 20 (cd $HOME && npm install nodemon) 21 fi 22 23 # https://stackoverflow.com/a/2173421 24 trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT 25 26 # https://mdaverde.com/posts/golang-local-docs 27 browser-sync start --port 6060 --proxy localhost:6061 --reload-delay 2000 --reload-debounce 5000 --no-ui --no-open & 28 PKGSITE=$(which pkgsite) 29 nodemon --signal SIGTERM --watch './**/*' -e go --exec "browser-sync --port 6060 reload && $PKGSITE -http=localhost:6061 ."