forked from kaerus-component/arango
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (70 loc) · 2.42 KB
/
Makefile
File metadata and controls
88 lines (70 loc) · 2.42 KB
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
NAME = arango
PKG_VER = `cat package.json | grep version | grep -o '[0-9]\.[0-9]\.[0-9]\+'`
COM_VER = `cat component.json | grep version | grep -o '[0-9]\.[0-9]\.[0-9]\+'`
COMPONENT = @./node_modules/.bin/component
BEAUTIFY = @./node_modules/.bin/js-beautify --config ./code.json
UGLIFYJS = @./node_modules/.bin/uglifyjs
KARMA = @./node_modules/karma/bin/karma
MOCHA = @./node_modules/mocha/bin/mocha
LIB=$(wildcard lib/*.js)
API=$(wildcard lib/api/*.js)
TEST=$(wildcard test/*.js)
ARANGOPORT=8529
build: dependencies component
component:
@echo "Building web component"
$(COMPONENT) build
@echo "Building standalone web component"
$(COMPONENT) build -n $(NAME) -s $(NAME)
dependencies: node_modules components
node_modules:
@echo "Installing v$(PKG_VER) node dependencies"
@npm i -d
components:
@echo "Installing v$(COM_VER) component dependencies"
$(COMPONENT) install
.PHONY: test
test:
$(MAKE) test-browser ARANGOPORT=$(ARANGOPORT)
$(MAKE) test-nodejs ARANGOPORT=$(ARANGOPORT)
.PHONY: test-nodejs
test-nodejs: node_modules
@echo "(function () {if (typeof window !== 'undefined') {window.port = $(ARANGOPORT);} else {exports.port = $(ARANGOPORT);}}());" > test/port.js
@echo "Running tests for nodejs"
$(MOCHA) --require should --reporter spec
@rm test/port.js
.PHONY: test-browser
test-browser: components component
@echo "Running tests for browser"
@npm i karma
@npm i karma-chai
@npm i karma-mocha
@npm i karma-chrome-launcher
@npm i karma-firefox-launcher
@echo "(function () {if (window) {window.port = $(ARANGOPORT);} else {exports.port = $(ARANGOPORT);}}());" > test/port.js
$(KARMA) start --browsers Firefox test/karma/karma.conf.js
$(KARMA) start --browsers Chrome test/karma/karma.conf.js
@rm test/port.js
docs: components component
@echo "Generating docs"
@yuidoc -o ./documentation lib/ -t yuidoctheme
@cp -a yuidoctheme/layouts documentation
@cp -a yuidoctheme/layouts documentation/classes
@cp -a yuidoctheme/layouts documentation/modules
distclean:
@echo "Cleaning up build files"
@rm -rf ./node_modules
@rm -rf ./components
@rm -rf ./build
@rm -rf ./documentation
beautify: $(TEST) $(API) $(LIB)
$(BEAUTIFY) -r $^
uglify: component
$(UGLIFYJS) ./build/$(NAME).js > $(NAME)-$(COM_VER)-min.js
release: component uglify
@cp ./build/$(NAME).js $(NAME)-$(COM_VER).js
@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