-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
71 lines (55 loc) · 1.86 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
NAME = postrest
PKG_VER = `cat package.json | grep version | grep -o '[0-9]\.[0-9]\.[0-9]\+'`
PKG_INFO = `cat package.json | grep -e '"version"' -e '"description"' -e '"logo"'`
LICENSE = `cat LICENSE`
BEAUTIFY = @./node_modules/.bin/js-beautify --config ./style.json
UGLIFYJS = @./node_modules/uglify-js/bin/uglifyjs
KARMA = @./node_modules/karma/bin/karma
MOCHA = @./node_modules/mocha/bin/mocha --timeout 5000 --require should --reporter spec
DUO = @./node_modules/duo/bin/duo
LIB = $(wildcard lib/*.js) $(wildcard lib/*/*.js)
TEST = $(wildcard test/*.js)
build: node_modules component
@echo "${NAME} v${PKG_VER}"
node_modules:
@echo "Installing node dependencies"
@npm i -d
component: index.js
@echo "Building web component"
@mkdir -p build
$(DUO) $< > build/build.js
test-component: index.js
@echo "Building test component"
@mkdir -p build
$(DUO) $< -g Arango --copy > build/test.js
test: test-nodejs
test-nodejs: node_modules
@echo "Running tests for nodejs"
$(MOCHA)
test-browser: test-component
@echo "Running tests for browser"
$(KARMA) start ./test/karma/karma.conf.js
unit-test:
@echo "testing module: $(module)"
$(MOCHA) -g "module:${module}"
distclean:
@echo "Cleaning up build files"
@rm -rf ./node_modules
@rm -rf ./components
@rm -rf ./build
@rm -rf ./documentation
format: $(LIB) $(TEST)
$(BEAUTIFY) -r $^
dist: component
@echo "Beautify -> dist/$(NAME).js"
$(UGLIFYJS) build/build.js --beautify --preamble "${LICENSE}" -o dist/$(NAME).js
@echo "Uglify -> dist/$(NAME)-min.js"
$(UGLIFYJS) dist/$(NAME).js --preamble "${LICENSE}" --prefix relative --source-map dist/$(NAME)-min.map.js -o dist/$(NAME)-min.js
@echo "Compress -> dist/$(NAME)-min.js.gz"
@gzip -9 -kf dist/$(NAME)-min.js
Release: dist
@git tag -a $(PKG_VER) -m "v$(PKG_VER)" -f
@echo "You may now push this release with: git push --tags"
publish:
@npm publish
.PHONY: build