-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathMakefile
55 lines (42 loc) · 1.72 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
# inspired by: https://gist.github.com/rgrove/1116056
# PLAYERS = playem-dailymotion.js playem-soundcloud.js playem-youtube.js playem-audiofile.js playem-deezer.js playem-vimeo.js
PLAYERS = playem.js
PLAYERS += $(filter-out %-TODO.js,$(wildcard \
./playem-*.js \
))
GIT_COMMIT_HASH = `git rev-parse HEAD`
PACKAGE_VERSION=`node -p "require('./package.json').version"`
.PHONY: build docs test
default: build
publish:
npm publish
build: clean dist/playem-all.js dist/playem-min.js docs
clean:
rm -rf dist/
docs: dist/playem-all.js
node_modules/.bin/documentation build dist/playem-all.js -f html -o docs
node_modules/.bin/documentation build dist/playem-all.js -f md -o docs/docs.md
test: $(PLAYERS) dist/playem-all.js dist/playem-min.js
node_modules/.bin/mocha --exit
@echo "Run 'make test-web' to run additional tests in the browser."
test-web: $(PLAYERS) dist/playem-all.js dist/playem-min.js
@echo "👉 Start tests from http://localhost:8000/test"
@echo " Press Ctrl-C when done"
@npx http-server --port 8000
dist/playem-all.js: $(PLAYERS) node_modules
@echo '==> Compiling: $(PLAYERS)'
@mkdir -p ./dist
@echo "/* playemjs $(PACKAGE_VERSION), commit: $(GIT_COMMIT_HASH) */\n" > ./dist/playem-all.js
@cat $(PLAYERS) >> ./dist/playem-all.js
@echo
dist/playem-min.js: dist/playem-all.js node_modules
@echo '==> Minifying $<'
@echo "/* playemjs $(PACKAGE_VERSION), commit: $(GIT_COMMIT_HASH) */ " > ./dist/playem-min.js
npm exec terser ./dist/playem-all.js >> ./dist/playem-min.js
@echo
@echo Finished producing ./dist/playem-all.js and ./dist/playem-min.js
@echo Playemjs $(PACKAGE_VERSION), commit: $(GIT_COMMIT_HASH)
@echo
node_modules:
@echo "Run 'nvm use' to use the version of Node.js specified in .nvmrc"
npm install