-
Notifications
You must be signed in to change notification settings - Fork 68
/
Makefile
51 lines (40 loc) · 980 Bytes
/
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
MKDIR := mkdir -p
RM := rm -rf
GIT = $(shell command -v git || { echo "git not found." >&2; exit 1; })
NPM = $(shell command -v npm || { echo "npm not found." >&2; exit 1; })
YARN = $(shell command -v yarn || { echo "yarn not found." >&2; exit 1; })
MODULES_DIR := node_modules
BIN_DIR := $(MODULES_DIR)/.bin
BABEL := $(BIN_DIR)/babel
SRC_DIR := src
SRC_FILE := $(SRC_DIR)/index.js
LIB_FILE := react-c3js.js
INFO = "\\033[34m[+] $@\\033[0m"
.PHONY: all
all: build
.PHONY: clean
clean:
@echo $(INFO)
@$(RM) $(LIB_FILE)
.PHONY: distclean
distclean: clean
@echo $(INFO)
@$(RM) $(MODULES_DIR)
.PHONY: install
install: package.json
@echo $(INFO)
@$(YARN)
.PHONY: build
build: $(SRC_FILE) clean install
@echo $(INFO)
@NODE_ENV=production $(BABEL) $(SRC_FILE) -o $(LIB_FILE)
.PHONY: dist
dist: package.json
@echo $(INFO)
@$(NPM) version patch
@$(GIT) push origin
@$(GIT) push origin --tags
.PHONY: publish
publish: $(LIB_FILE) dist
@echo $(INFO)
@$(NPM) publish