forked from dobarkod/cookie-banner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (27 loc) · 856 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
MINIFY = npx uglifyjs --lint -c -m toplevel=true
LINT = npx jshint --show-non-errors
ESLINT = npx eslint
UPLOAD = s3cmd put -P
define GetFromPkg
$(shell node -p "require('./package.json').$(1)")
endef
VERSION := $(call GetFromPkg,version)
TITLE := $(call GetFromPkg,title)
HOMEPAGE := $(call GetFromPkg,homepage)
MINILICENSE = "/*! (C) $(TITLE) v$(VERSION) - MIT License - $(HOMEPAGE) */"
.PHONY: all clean license
all: dist/cookiebanner.min.js
lint: src/cookiebanner.js
$(LINT) $<
$(ESLINT) $<
dist/cookiebanner.min.js: src/cookiebanner.js
echo $(MINILICENSE) > $@
$(MINIFY) < $< >> $@
clean:
rm -f dist/cookiebanner.min.js
rm -f src/cookiebanner.min.js
publish: dist/cookiebanner.min.js
$(UPLOAD) dist/cookiebanner.min.js s3://cookiebanner.eu/js/cookiebanner.min.js
test:
$(MAKE) lint
npx phantomjs ./tests/runner.js ./tests/tests.html