-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (53 loc) · 1.49 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
SHELL := /bin/bash
export BASE := $(shell /bin/pwd)
export PATH := var:$(PATH):$(BASE)/node_modules/.bin
.DEFAULT_GOAL := install
NVM_DIR := $(if $(NVM_DIR),$(NVM_DIR),$(shell echo $$HOME)/.nvm)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
SED_I := sed -E -i
endif
ifeq ($(UNAME_S),Darwin)
SED_I := sed -E -i ""
endif
# local
# -----
.PHONY: install
install: var node_modules/.bin/yarn
source "$(NVM_DIR)/nvm.sh"; nvm use --lts; \
nvm exec --lts node_modules/.bin/yarn install
.PHONY: dev.run
dev.run: install
source "$(NVM_DIR)/nvm.sh"; \
nvm exec --lts node_modules/.bin/yarn run serve
.PHONY: test.unit
test.unit:
source "$(NVM_DIR)/nvm.sh"; \
nvm exec --lts node_modules/.bin/yarn unit
.PHONY: test.e2e
test.e2e:
source "$(NVM_DIR)/nvm.sh"; \
nvm exec --lts node_modules/.bin/yarn e2e
.PHONY: test
test: install test.unit test.e2e
dist:
mkdir -p dist
# Clean
# -----
node_modules/.bin/yarn:
@which yarn || ([ -e "$(BASE)/node_modules/.bin/yarn" ] ||\
source "$(NVM_DIR)/nvm.sh"; \
npm install --no-package-lock --no-save [email protected] \
)
node_modules/.bin/get-project-version: node_modules/.bin/yarn
@which get-project-version || ([ -e "node_modules/.bin/get-project-version" ] ||\
source "$(NVM_DIR)/nvm.sh"; \
npm install --no-package-lock --no-save get-project-version \
)
logs:
mkdir -p "$(BASE)/logs"
var: logs
mkdir -p "$(BASE)/var"
.PHONY: clean
clean:
rm -rf yarn-error.log yarn.lock "$(BASE)/var/node_modules" "$(BASE)/dist" "$(BASE)/node_modules"