-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile
108 lines (80 loc) · 2.87 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#MAKEFLAGS = -j1
NODE_BIN := node
NPM_MOD_DIR := $(CURDIR)/node_modules
NPM_BIN_DIR := $(NPM_MOD_DIR)/.bin
WEBCOMPONENTS_DIR := $(NPM_MOD_DIR)/@webcomponents/webcomponentsjs
DIST_DIR := ./dist
.DEFAULT_GOAL := help
# Self-Documented Makefile
# ref. https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@exit 1 ## I'd like to notice to fail if user call 'make' without any target.
# Dev
.PHONY: build
build: format clean rollup postcss theme-default copy-webcomponentsjs ## Build All
.PHONY: dev
dev: ## Incremental Build All
$(MAKE) copy-webcomponentsjs
$(MAKE) -j rollup-watch postcss-watch theme-default-watch serve
.PHONY: serve
serve: ## Serve file
python -m SimpleHTTPServer
# Build
.PHONY: rollup
rollup:
$(NPM_BIN_DIR)/rollup --config ./rollup.config.js
.PHONY: rollup-watch
rollup-watch:
$(NPM_BIN_DIR)/rollup --config ./rollup.config.js --watch
.PHONY: copy-webcomponentsjs
copy-webcomponentsjs:
cp $(WEBCOMPONENTS_DIR)/webcomponents-hi.js ./dist
cp $(WEBCOMPONENTS_DIR)/webcomponents-hi-ce.js ./dist
cp $(WEBCOMPONENTS_DIR)/webcomponents-hi-sd.js ./dist
cp $(WEBCOMPONENTS_DIR)/webcomponents-hi-sd-ce.js ./dist
cp $(WEBCOMPONENTS_DIR)/webcomponents-lite.js ./dist
cp $(WEBCOMPONENTS_DIR)/webcomponents-loader.js ./dist
cp $(WEBCOMPONENTS_DIR)/webcomponents-sd-ce.js ./dist
.PHONY: postcss
postcss:
$(NPM_BIN_DIR)/postcss --output ./dist/talkie.css ./src/style/index.css --verbose
.PHONY: postcss-watch
postcss-watch:
$(NPM_BIN_DIR)/postcss --output ./dist/talkie.css ./src/style/index.css --verbose --watch
.PHONY: theme-default
theme-default:
$(NPM_BIN_DIR)/postcss --output ./dist/talkie.theme-default.css ./src/theme/default/index.css --verbose
.PHONY: theme-default-watch
theme-default-watch:
$(NPM_BIN_DIR)/postcss --output ./dist/talkie.theme-default.css ./src/theme/default/index.css --verbose --watch
# Utilities
.PHONY: test
test:
$(NPM_BIN_DIR)/wct
.PHONY: format
format: ## Auto formatting
$(MAKE) -j lint-fix prettier
.PHONY: lint
lint:
$(NPM_BIN_DIR)/tslint --project ./tsconfig.json -t stylish
.PHONY: lint-fix
lint-fix:
$(NPM_BIN_DIR)/tslint --project ./tsconfig.json -t stylish --fix
.PHONY: prettier
prettier: ## Auto formatting
$(NPM_BIN_DIR)/prettier --config ./prettier.config.js --write './**/*.+(ts|js)'
.PHONY: clean
clean: ## Clean distribution dir
rm -rf $(DIST_DIR)
# Release
.PHONY: release-patch
release-patch: ## Release as patch version up
$(NPM_BIN_DIR)/release-it patch -c release.json --preRelease=beta
.PHONY: release-minor
release-minor: ## Release as minor version up
$(NPM_BIN_DIR)/release-it minor -c release.json --preRelease=beta
.PHONY: release-major
release-major: ## Release as major version up
$(NPM_BIN_DIR)/release-it major -c release.json --preRelease=beta