forked from reactjs/react-modal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
124 lines (94 loc) · 3.03 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
NODE=$(shell which node)
NPM=$(shell which npm)
YARN=$(shell which yarn)
JQ=$(shell which jq)
COVERALLS=./node_modules/coveralls/bin/coveralls.js
REMOTE="[email protected]:reactjs/react-modal"
VERSION=$(shell jq ".version" package.json)
COVERAGE?=true
help: info
@echo
@echo "Current version: $(VERSION)"
@echo
@echo "List of commands:"
@echo
@echo " make info - display node, npm and yarn versions..."
@echo " make deps - install all dependencies."
@echo " make serve - start the server."
@echo " make tests - run tests."
@echo " make tests-single-run - run tests (used by continuous integration)."
@echo " make coveralls - show coveralls."
@echo " make lint - run lint."
@echo " make docs - build and serve the docs."
@echo " make build - build project artifacts."
@echo " make publish - build and publish version on npm."
@echo " make publish-docs - build the docs and publish to gh-pages."
@echo " make publish-all - publish version and docs."
info:
@echo node version: `$(NODE) --version` "($(NODE))"
@echo npm version: `$(NPM) --version` "($(NPM))"
@echo yarn version: `$(YARN) --version` "($(YARN))"
@echo jq version: `$(JQ) --version` "($(JQ))"
deps: deps-project deps-docs
deps-project:
@[[ ! -z "$(YARN)" ]] && $(YARN) install || $(NPM) install
deps-docs:
@gitbook install
# Rules for development
serve:
@npm start
tests:
@npm run test
tests-single-run:
@npm run test -- --single-run
coveralls:
-cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js 2>/dev/null
tests-ci: clean lint
@COVERAGE=$(COVERAGE) make tests-single-run coveralls
lint:
@npm run lint
docs: build-docs
gitbook serve
# Rules for build and publish
build:
@echo "[Building dists]"
@./node_modules/.bin/webpack --config webpack.dist.config.js
build-docs:
@echo "[Building documentation]"
@rm -rf _book
@gitbook build -g reactjs/react-modal
.version:
@echo "[Updating react-modal version]"
@sh ./scripts/version $(VERSION)
@$(JQ) '.version' package.json | cut -d\" -f2 > .version
.branch:
@echo "[Release from branch]"
@git branch | grep '^*' | awk '{ print $$2 }' > .branch
@echo "Current branch: `cat .branch`"
release-commit:
git commit --allow-empty -m "Release v`cat .version`."
git add .
git commit --amend -m "`git log -1 --format=%s`"
release-tag:
git tag "v`cat .version`"
publish-version: release-commit release-tag
@echo "[Publishing]"
git push $(REMOTE) "`cat .branch`" "v`cat .version`"
npm publish
publish-finished: clean
pre-publish: clean .branch .version deps-project tests-ci build
publish: pre-publish publish-version publish-finished
publish-docs: deps-docs build-docs
@echo "[Publishing docs]"
git init _book
cd _book
git commit --allow-empty -m 'update book'
git checkout -b gh-pages
touch .nojekyll
git add .
git commit -am 'update book'
git push [email protected]:reactjs/react-modal gh-pages --force
cd ..
publish-all: publish publish-docs
clean:
@rm -rf .version .branch ./coverage/*