-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (41 loc) · 1.41 KB
/
Copy pathMakefile
File metadata and controls
55 lines (41 loc) · 1.41 KB
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
DENO ?= deno
HOME ?= ~
CACHE_DIR ?= $(HOME)/.cache/justbot
PKG_DIR ?= $(HOME)/.cache/deno/npm
CONFIG_FILE ?= bot/config.js
DATABASES ?= bot.db,bot.db-journal
-include local.mk
ZAPBOX_PATH ?= zapbox
DENO_IO_PERMS_FLAGS = --allow-read=$(CONFIG_FILE),tests,.env,$(DATABASES),$(CACHE_DIR),$(PKG_DIR),. \
--allow-write=$(CONFIG_FILE),$(DATABASES),$(CACHE_DIR),$(PKG_DIR),.
DENO_PERMISSION_FLAGS = $(DENO_IO_PERMS_FLAGS) --allow-net --allow-sys --allow-ffi \
--allow-env --allow-run=cdecl,chmod,git,make,$(ZAPBOX_PATH)
DENO_FLAGS = --no-prompt --env-file $(DENO_PERMISSION_FLAGS)
.PHONY: all run dev check
.PHONY: format fmt lint test tests
.PHONY: hook-register
all: compile
CMD_FILES = $(shell find src/cmd -name "*.ts" -not -name "list.ts")
INCLUDE_FLAGS = $(foreach file,$(CMD_FILES),--include $(file))
compile: check lint
@$(DENO) compile $(DENO_FLAGS) $(INCLUDE_FLAGS) --output justbot src/main.ts
run: check lint
@$(DENO) run $(DENO_FLAGS) src/main.ts
dev: check lint
@$(DENO) run $(DENO_FLAGS) --watch src/main.ts
check:
@$(DENO) check src/main.ts
@$(DENO) check src/cmd/**/*.ts
lint:
@$(DENO) lint src/**/*
format:
@echo "human is the best formatter,"
@echo "go and format code yourself"
@echo "you can do it, we all believe in you!"
test:
@$(DENO) test $(DENO_FLAGS) tests/main.ts
tests: test
fmt: format
hook-register:
chmod +x scripts/git/pre-commit
git config core.hooksPath scripts/git