From 21b54f74b1b99c99996b3fb0fada5a27f118503d Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 23 Jun 2022 12:19:46 +0100 Subject: [PATCH] clean site/out and enforce make bin --- Makefile | 3 +++ scripts/develop.sh | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 51e1b6a707371..2ae20987ddf10 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,9 @@ bin: $(shell find . -not -path './vendor/*' -type f -name '*.go') go.mod go.sum mkdir -p ./dist rm -rf ./dist/coder-slim_* + rm -f ./site/out/bin/coder* ./scripts/build_go_slim.sh \ + --compress 6 \ --version "$(VERSION)" \ --output ./dist/ \ linux:amd64,armv7,arm64 \ @@ -31,6 +33,7 @@ bin: $(shell find . -not -path './vendor/*' -type f -name '*.go') go.mod go.sum build: site/out/index.html $(shell find . -not -path './vendor/*' -type f -name '*.go') go.mod go.sum $(shell find ./examples/templates) rm -rf ./dist mkdir -p ./dist + rm -f ./site/out/bin/coder* # build slim artifacts and copy them to the site output directory ./scripts/build_go_slim.sh \ diff --git a/scripts/develop.sh b/scripts/develop.sh index d8a5808223072..e0b26e06814c5 100755 --- a/scripts/develop.sh +++ b/scripts/develop.sh @@ -17,8 +17,15 @@ dependencies curl git go make yarn curl --fail http://127.0.0.1:3000 >/dev/null 2>&1 && echo '== ERROR: something is listening on port 3000. Kill it and re-run this script.' && exit 1 curl --fail http://127.0.0.1:8080 >/dev/null 2>&1 && echo '== ERROR: something is listening on port 8080. Kill it and re-run this script.' && exit 1 -echo '== Run "make build" before running this command to build binaries.' -echo '== Without these binaries, workspaces will fail to start!' +if [[ ! -e ./site/out/bin/coder.sha1 && ! -e ./site/out/bin/coder.tar.zst ]]; then + log + log "=======================================================================" + log "== Run 'make bin' before running this command to build binaries. ==" + log "== Without these binaries, workspaces will fail to start! ==" + log "=======================================================================" + log + exit 1 +fi # Run yarn install, to make sure node_modules are ready to go "$PROJECT_ROOT/scripts/yarn_install.sh" @@ -28,7 +35,7 @@ echo '== Without these binaries, workspaces will fail to start!' # https://stackoverflow.com/questions/3004811/how-do-you-run-multiple-programs-in-parallel-from-a-bash-script ( SCRIPT_PID=$$ - cd "${PROJECT_ROOT}" + cdroot CODERV2_HOST=http://127.0.0.1:3000 INSPECT_XSTATE=true yarn --cwd=./site dev || kill -INT -${SCRIPT_PID} & go run -tags embed cmd/coder/main.go server --address 127.0.0.1:3000 --in-memory --tunnel || kill -INT -${SCRIPT_PID} &