|
1 | | -BROWSERS=Firefox,ChromeCanary,Opera,Safari |
| 1 | +SHELL := /bin/bash |
| 2 | +PATH := node_modules/.bin:./node_modules/karma/bin:$(PATH) |
2 | 3 |
|
3 | | -test: build/jshint.xml |
4 | | - @NODE_ENV=test ./node_modules/karma/bin/karma start --single-run --browsers $(BROWSERS) |
| 4 | +sources := error-stack-parser.js |
| 5 | +minified := $(sources:%.js=%.min.js) |
| 6 | +source_map := $(sources:%.js=%.js.map) |
| 7 | +specs := $(wildcard spec/*-spec.js) |
| 8 | +build_files := build/jshint.xml |
| 9 | +coveralls := node_modules/coveralls/bin/coveralls.js |
5 | 10 |
|
6 | | -build/jshint.xml: build |
7 | | - ./node_modules/.bin/jshint --reporter checkstyle ./spec/error-stack-parser-spec.js ./error-stack-parser.js > build/jshint.xml |
| 11 | +build/jshint.xml: $(sources) $(specs) |
| 12 | + mkdir -p $(dir $@) |
| 13 | + node_modules/.bin/jshint $^ |
| 14 | + jshint --reporter checkstyle $^ > $@ |
8 | 15 |
|
9 | | -test-ci: build/jshint.xml |
| 16 | +test: $(build_files) |
| 17 | + @NODE_ENV=test karma start --single-run |
| 18 | + |
| 19 | +test-ci: $(build_files) |
10 | 20 | @echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID) |
11 | | - @NODE_ENV=test ./node_modules/karma/bin/karma start karma.conf.ci.js --single-run && \ |
12 | | - cat ./coverage/IE\ 7*/lcov.info | ./node_modules/coveralls/bin/coveralls.js --verbose |
| 21 | + @NODE_ENV=test karma start karma.conf.ci.js --single-run && \ |
| 22 | + cat ./coverage/Chrome*/lcov.info | $(coveralls) --verbose |
13 | 23 |
|
14 | 24 | clean: |
15 | 25 | rm -fr build coverage dist *.log |
16 | 26 |
|
17 | | -build: |
18 | | - mkdir build |
| 27 | +dist: $(build_files) $(sources) |
| 28 | + mkdir $@ |
| 29 | + uglifyjs2 $(sources) -o $(minified) --source-map $(source_map) |
| 30 | + mv $(minified) $(source_map) $@ |
| 31 | + cp $(sources) $@ |
| 32 | + |
| 33 | +ci: clean test-ci |
19 | 34 |
|
20 | | -dist: |
21 | | - mkdir dist |
22 | | - ./node_modules/.bin/uglifyjs2 node_modules/stackframe/stackframe.js error-stack-parser.js \ |
23 | | - -o error-stack-parser.min.js --source-map error-stack-parser.js.map |
24 | | - mv error-stack-parser.min.js error-stack-parser.js.map dist/ |
25 | | - cp error-stack-parser.js dist/ |
| 35 | +all: clean test dist |
26 | 36 |
|
27 | | -.PHONY: clean test dist |
| 37 | +.PHONY: all |
0 commit comments