-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (38 loc) · 1.36 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
#!make
PROJECT ?= $(shell node -p "require('./package.json').name")
NVM = v0.39.3
NODE ?= $(shell cat $(PWD)/.nvmrc 2> /dev/null || echo v16.18.1)
.PHONY: help all build install nvm test lint typecheck git-hooks tags task
default: help
# show this help
help:
@echo 'usage: make [target] ...'
@echo ''
@echo 'targets:'
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
run: ## NPM install
. $(NVM_DIR)/nvm.sh && nvm use $(NODE) && $(CMD)
all: ## Run build, lint, typecheck and test for all packages
make lint typecheck test build
install: ## Install node version
. $(NVM_DIR)/nvm.sh && nvm install $(NODE)
make run CMD="npm install"
build: ## Compile typescript
make run CMD="npm run build"
test: ## Run tests
make run CMD="npm test"
lint: ## Run linter
make run CMD="npm run lint"
typecheck: ## Run typecheck
make run CMD="npm run typecheck"
git-hooks: ## Install git hooks
make run CMD="npx simple-git-hooks"
## Tasks
## ex: make task lint
task: ## Run task
make run CMD="npm run $(filter-out $@,$(MAKECMDGOALS))"
nvm: ## Install nvm: restart your terminal after nvm install
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM}/install.sh | bash
tags: # Npm version with push
make run CMD="npm version $(filter-out $@,$(MAKECMDGOALS))"
git push --follow-tags