forked from cyclejs/cyclejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
214 lines (187 loc) · 5.28 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
.PHONY: lint docs dom history html http isolate jsonp most-run run rxjs-run
BINDIR=node_modules/.bin
TSLINT=$(BINDIR)/tslint
TSC=$(BINDIR)/tsc
MOCHA=$(BINDIR)/mocha
BROWSERIFY=$(BINDIR)/browserify
BUMP=$(BINDIR)/bump
JASE=$(BINDIR)/jase
TESTEM=$(BINDIR)/testem
ARG=$(filter-out $@,$(MAKECMDGOALS))
help :
@echo "Available commands in the Cycle.js monorepo:"
@echo ""
@echo " make setup\t\t\tyarn install everything"
@echo " make commit\t\t\tgit commit following our format"
@echo " make lint\t\t\tlint all packages"
@echo " make lint <package>\t\tlint just <package> (e.g. 'make lint dom')"
@echo " make lib\t\t\tcompile all packages"
@echo " make lib <package>\t\tcompile just <package> (e.g. 'make lib dom')"
@echo " make test\t\t\ttest everything"
@echo " make test <package>\t\ttest just <package>"
@echo " make test-ci\t\t\ttest everything for continuous integration"
@echo " make test-ci <package>\ttest just <package> for CI"
@echo " make dist <package>\t\tbuild dist for <package> only"
@echo " make docs\t\t\tbuild the whole docs website"
@echo " make docs <package>\t\tbuild the docs for <package> only"
@echo " make changelog <package>\tupdate changelog file for <package> only"
@echo " make check-release\t\treport what versions should we release next"
@echo " make release-all\t\trelease exactly what 'make check-release' reported"
@echo " make release-minor <package>\trelease a new minor version of <package>"
@echo " make release-major <package>\trelease a new major version of <package>"
@echo ""
setup :
@echo "(root): yarn install"
@yarn install
@echo ""
@while read d ; do \
echo "$$d: yarn install" ;\
cd $$d ; yarn install ; cd .. ;\
echo "" ;\
done < .scripts/RELEASABLE_PACKAGES
@make lib
prettier-all :
@echo "Formatting all source files using prettier"
@while read d ; do \
$(BINDIR)/prettier --write \
--single-quote --no-bracket-spacing --trailing-comma=all \
"$$d/{src,test}/**/*.ts" ;\
done < .scripts/RELEASABLE_PACKAGES
commit :
.scripts/commit.sh
lint :
@if [ "$(ARG)" = "" ]; then \
while read d ; do \
echo "Linting $$d ..." ; \
make lint $$d ; \
done < .scripts/RELEASABLE_PACKAGES; \
else \
$(TSLINT) --config tslint.json --project $(ARG)/tsconfig.json &&\
echo "✓ $(ARG) passed lint\n" ;\
fi
lib :
@if [ "$(ARG)" = "" ]; then \
while read d ; do \
echo "Compiling $$d" ; \
make lib $$d ; \
done < .scripts/RELEASABLE_PACKAGES; \
else \
rm -rf $(ARG)/lib/ ;\
mkdir -p $(ARG)/lib ;\
$(TSC) --project $(ARG) --module commonjs --outDir $(ARG)/lib ;\
$(TSC) --project $(ARG) --module es6 --outDir $(ARG)/lib/es6 ;\
echo "✓ Compiled TypeScript to lib\n" ;\
fi
# Example: `make docs dom`
docs :
@if [ "$(ARG)" = "" ]; then \
make docs-all ;\
else \
node .scripts/make-api-docs.js $(ARG) ;\
echo "✓ Docs for $(ARG)" ;\
fi
docs-index :
node ./docs/.scripts/make-index.js
docs-documentation :
node ./docs/.scripts/make-documentation.js
docs-releases :
node ./docs/.scripts/make-releases.js
docs-api :
node ./docs/.scripts/make-api-index.js
@while read d ; do make docs $$d ; echo "" ; done < .scripts/RELEASABLE_PACKAGES
docs-all : docs-index docs-documentation docs-releases docs-api
changelog :
@if [ "$(ARG)" = "" ]; then \
echo "Error: please call 'make changelog' with an argument, like 'make changelog dom'" ;\
else \
node .scripts/update-changelogs.js $(ARG) ;\
echo "✓ Updated changelog for $(ARG)" ;\
fi
dist :
@if [ "$(ARG)" = "" ]; then \
echo "Error: please call 'make dist' with an argument, like 'make dist dom'" ;\
else \
rm -rf $(ARG)/dist ;\
mkdir -p $(ARG)/dist/ ;\
make lib $(ARG) ;\
cd $(ARG) ; npm run browserify ; npm run minify ; cd .. ;\
echo "✓ Built dist for $(ARG)" ;\
fi
test :
@if [ "$(ARG)" = "" ]; then \
make test-all ;\
else \
make lib $(ARG) &&\
cd $(ARG) && npm run test && cd .. &&\
make lint $(ARG) &&\
echo "✓ Tested $(ARG)" ;\
fi
test-ci :
@if [ "$(ARG)" = "" ]; then \
make setup &&\
make test-ci-all ;\
else \
make lib $(ARG) &&\
cd $(ARG) && npm run test-ci && cd .. &&\
make lint $(ARG) &&\
echo "✓ Tested CI $(ARG)" ;\
fi
test-all :
.scripts/test-all.sh
test-ci-all :
.scripts/test-ci-all.sh
check-release :
.scripts/pre-check-release.sh
release-all :
.scripts/release-whatever-needs-release.sh
prebump :
make test $(ARG)
postbump :
make dist $(ARG)
make docs $(ARG)
make changelog $(ARG)
git add -A
git commit -m "release($(ARG)): $(shell cat $(ARG)/package.json | $(JASE) version)"
git push origin master
cd $(ARG) ; npm publish ; cd ..
release-minor :
@if [ "$(ARG)" = "" ]; then \
echo "Error: please call 'make release-minor' with an argument, like 'make release-minor dom'" ;\
else \
make prebump $(ARG) ;\
$(BUMP) $(ARG)/package.json --quiet --minor ;\
make postbump $(ARG) ;\
echo "✓ Released new minor for $(ARG)" ;\
fi
release-major :
@if [ "$(ARG)" = "" ]; then \
echo "Error: please call 'make release-major' with an argument, like 'make release-major dom'" ;\
else \
make prebump $(ARG) ;\
$(BUMP) $(ARG)/package.json --quiet --major ;\
make postbump $(ARG) ;\
echo "✓ Released new major for $(ARG)" ;\
fi
# catch anything and do nothing
dom :
@:
history :
@:
html :
@:
http :
@:
isolate :
@:
jsonp :
@:
most-run :
@:
run :
@:
rxjs-run :
@:
%:
@:
.DEFAULT :
@: