-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
62 lines (46 loc) · 1.34 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
default: help
# The general philosophy and functionality of this makefile is shamelessly stolen from compiler explorer
help: # with thanks to Ben Rady
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
NODE:=node
NPM:=npm
NPX:=npx
SERVER:=x0
.PHONY: prereqs
prereqs: package.json package-lock.json
$(NPM) i
.PHONY: ts-check
ts-check: prereqs ## ts-check
$(NPM) run ts-check
.PHONY: lint
lint: prereqs ## lint
$(NPM) run lint
.PHONY: check
check: ts-check lint ## Ts-check and lint
.PHONY: format
format: prereqs ## Formats source files
$(NPM) run format
.PHONY: test
test: prereqs ## Formats source files
$(NPM) run test
.PHONY: clean
clean: ## Cleans up everything
rm -rf node_modules build
.PHONY: build
build: prereqs ## Cleans up everything
$(NPM) run build
.PHONY: run
run: build ## Runs the bot locally
$(NODE) build/src/main.js
.PHONY: deploy
deploy: ts-check ## Deploys code
./scripts/scp.sh
.PHONY: prod
prod: format deploy ## Deploys code and restarts the bot
ssh $(SERVER) "export NVM_DIR=\"$$HOME/.nvm\"; source $$NVM_DIR/nvm.sh; screen -XS _Wheatley quit; cd projects/wheatley; ./start.sh"
.PHONY: npm-update
npm-update: ## Updates npm packages
./scripts/update_packages.sh
.PHONY: mongo
mongo:
ssh -L 27017:127.0.0.1:27017 x0 -N