Skip to content

Commit

Permalink
move air install to make setup
Browse files Browse the repository at this point in the history
  • Loading branch information
lime-green committed Nov 30, 2022
1 parent a76f53a commit 59f70c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ If you want to develop on Windows, we recommend setting up a Ubuntu virtual mach
We use a makefile for our build system. These commands will usually be all you need while developing for this project:
```sh
# Installs a pre-commit git hook so that your go code is automatically formatted (if you don't use an IDE that supports that). If you want to manually format go code you can run make fmt.
# Also installs `air` to reload the dev servers automatically
make setup

# Run all the tests. Currently only the backend sim has tests.
Expand All @@ -92,6 +93,9 @@ make update-tests
# Recompiles the entire client before launching using `make dist/wotlk`
make host

# With file-watching so the server auto-restarts and recompiles on Go or TS changes:
WATCH=1 make host

# Delete all generated files (.pb.go and .ts proto files, and dist/)
make clean

Expand All @@ -103,6 +107,9 @@ make host_$spec
# To rebuild client for a spec just do 'make $spec' and refresh browser.
make rundevserver

# With file-watching so the server auto-restarts and recompiles on Go or TS changes:
WATCH=1 make rundevserver

# Creates the 'wowsimwotlk' binary that can host the UI and run simulations natively (instead of with wasm).
# Builds the UI and the compiles it into the binary so that you can host the sim as a server instead of wasm on the client.
# It does this by first doing make dist/wotlk and then copying all those files to binary_dist/wotlk and loading all the files in that directory into its binary on compile.
Expand Down
18 changes: 10 additions & 8 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,16 @@ devserver: sim/core/proto/api.pb.go sim/web/main.go binary_dist/dist.go
.PHONY: air
air:
ifeq ($(WATCH), 1)
@ ! command -v air && curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin || true
@if ! command -v air; then \
echo "Missing air dependency. Please run \`make setup\`"; \
exit 1; \
fi
endif

rundevserver: devserver air
rundevserver: air devserver
ifeq ($(WATCH), 1)
ulimit -n 10240
air -tmp_dir "/tmp" -build.include_ext "go,ts,js,html" -build.bin "true" -build.cmd "make" -build.exclude_dir "dist,node_modules,sim,tools" &
air -tmp_dir "/tmp" -build.args_bin "--usefs=true --launch=false" -build.bin "./wowsimwotlk" -build.cmd "make devserver" -build.exclude_dir "assets,dist,node_modules,ui,tools"
ulimit -n 10240 && air -tmp_dir "/tmp" -build.include_ext "go,ts,js,html" -build.bin "true" -build.cmd "make" -build.exclude_dir "dist,node_modules,sim,tools" &
ulimit -n 10240 && air -tmp_dir "/tmp" -build.args_bin "--usefs=true --launch=false" -build.bin "./wowsimwotlk" -build.cmd "make devserver" -build.exclude_dir "assets,dist,node_modules,ui,tools"
else
./wowsimwotlk --usefs=true --launch=false
endif
Expand Down Expand Up @@ -209,13 +211,13 @@ tsfmt:
setup:
cp pre-commit .git/hooks
chmod +x .git/hooks/pre-commit
! command -v air && curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin || true

# Host a local server, for dev testing
.PHONY: host
host: $(OUT_DIR)/.dirstamp node_modules air
host: air $(OUT_DIR)/.dirstamp node_modules
ifeq ($(WATCH), 1)
ulimit -n 10240
air -tmp_dir "/tmp" -build.include_ext "go,ts,js,html" -build.bin "npx" -build.args_bin "http-server $(OUT_DIR)/.." -build.cmd "make" -build.exclude_dir "dist,node_modules,tools"
ulimit -n 10240 && air -tmp_dir "/tmp" -build.include_ext "go,ts,js,html" -build.bin "npx" -build.args_bin "http-server $(OUT_DIR)/.." -build.cmd "make" -build.exclude_dir "dist,node_modules,tools"
else
# Intentionally serve one level up, so the local site has 'wotlk' as the first
# directory just like github pages.
Expand Down

0 comments on commit 59f70c4

Please sign in to comment.