-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (63 loc) · 2.99 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
63
64
65
66
67
68
69
70
71
72
73
# Get the workspace url without https://
export WORKSPACE_HOST := $(shell echo $$GITPOD_WORKSPACE_URL | cut -c9- | rev | rev)
# Get local urls or gitpod urls
export DIRECTUS_URL := $(if $(GITPOD_WORKSPACE_URL),https://8055-$(WORKSPACE_HOST),http://localhost:8055)
export NUXT_URL := $(if $(GITPOD_WORKSPACE_URL),https://3000-$(WORKSPACE_HOST),http://localhost:3000)
export WEAR_URL := $(if $(GITPOD_WORKSPACE_URL),https://8080-$(WORKSPACE_HOST),http://localhost:8080)
export DOCS_URL := $(if $(GITPOD_WORKSPACE_URL),https://5173-$(WORKSPACE_HOST),http://localhost:5173)
# HELP
# Display target ## comments as help: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## This help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: start-debug
start-debug: # start apps and show docker logs
docker compose -f server/docker-compose.yaml up
.PHONY: start-barebones
start-barebones:
docker compose -f server/docker-compose.yaml up -d
pnpm exec pm2 --name packages start pnpm -- run watch
cd examples/nuxt && pnpm exec pm2 --name nuxt-example start pnpm -- run dev
cd examples/wear && pnpm exec pm2 --name wear-example start pnpm -- run start
pnpm exec pm2 --name docs start pnpm -- run docs:dev
.PHONY: start
start: ## Start developing the app
@make start-barebones
@clear
@echo "Watching \033[32m/packages/**\033[0m and starting example app."
@echo "⚠️ On Gitpod? These URLs are \033[31mpublicly\033[0m available as long as this workspace is running!\n"
@echo "Not on Gitpod? Https is not setup."
@echo "\033[34mNuxt App:\033[0m ${NUXT_URL}"
@echo "\033[34mWear App:\033[0m ${WEAR_URL}"
@echo "\033[34mDirectus:\033[0m ${DIRECTUS_URL}"
@echo "\033[34mDocs:\033[0m ${DOCS_URL}"
@echo "Login for Directus: [email protected], password: admin\n"
.PHONY: init-local
init-local: ## Start a local dev env, as opposed to using gitpod. Requires node, nvm & pnpm
@pnpm i --shamefully-hoist
@make start
.PHONY: stop
stop: ## Stop directus and dev server
@docker compose -f server/docker-compose.yaml down
@pnpm exec pm2 kill
@echo "Dev Servers stopped."
.PHONY: reset
reset: ## Prune volumes and clean built packages and examples
@docker volume prune -f
@pnpm run clean
@rm -rf ./examples/nuxt/.nuxt
.PHONY: logs
logs: ## Show logs of packages
@pnpm exec pm2 logs packages --lines 100
.PHONY: ssh
ssh: ## Connect to gitpod env with SSH.
ifeq ($(GITPOD_WORKSPACE_URL),)
@echo "Failed, because you're not using gitpod."
@echo "This command would otherwise return a shell command to connect to the gitpod env from your local machine."
else
@$(eval HOST_URL := $(shell echo "${GITPOD_WORKSPACE_URL}" | sed 's#.*${GITPOD_WORKSPACE_ID}\(\)#\1#'))
@echo "Paste the next line into your local shell (SSH key required):"
@echo "ssh '${GITPOD_WORKSPACE_ID}@${GITPOD_WORKSPACE_ID}.ssh${HOST_URL}'"
@echo "\nIf you're having problems, see: https://www.gitpod.io/docs/references/ides-and-editors/command-line\n"
endif
.DEFAULT_GOAL := help