sheetjs/Makefile

93 lines
2.2 KiB
Makefile
Raw Normal View History

2017-03-12 07:34:36 +00:00
SHELL=/bin/bash
LIB=ssf
CMDS=bin/ssf.njs
HTMLLINT=
ULIB=$(shell echo $(LIB) | tr a-z A-Z)
2017-03-21 07:45:12 +00:00
DEPS=$(sort $(wildcard bits/*.js))
2017-03-12 07:34:36 +00:00
TARGET=$(LIB).js
2017-03-21 07:45:12 +00:00
FLOWTARGET=$(LIB).flow.js
FLOWAUX=$(patsubst %.js,%.flow.js,$(AUXTARGETS))
AUXSCPTS=
FLOWTGTS=$(TARGET) $(AUXTARGETS) $(AUXSCPTS)
UGLIFYOPTS=--support-ie8
2017-03-12 07:34:36 +00:00
## Main Targets
2017-03-21 07:45:12 +00:00
.PHONY: all
all: $(TARGET) $(AUXTARGETS) $(AUXSCPTS) ## Build library and auxiliary scripts
$(FLOWTGTS): %.js : %.flow.js
node -e 'process.stdout.write(require("fs").readFileSync("$<","utf8").replace(/^[ \t]*\/\*[:#][^*]*\*\/\s*(\n)?/gm,"").replace(/\/\*[:#][^*]*\*\//gm,""))' > $@
$(FLOWTARGET): $(DEPS)
cat $^ | tr -d '\15\32' > $@
bits/01_version.js: package.json
echo "$(ULIB).version = '"`grep version package.json | awk '{gsub(/[^0-9a-z\.-]/,"",$$2); print $$2}'`"';" > $@
.PHONY: clean
clean: ## Remove targets and build artifacts
rm -f $(TARGET) $(FLOWTARGET)
2017-03-12 07:34:36 +00:00
2017-03-12 07:34:36 +00:00
## Testing
.PHONY: test mocha
test mocha: ## Run test suite
2017-03-21 14:31:33 +00:00
mocha -R spec -t 30000
2017-03-21 07:45:12 +00:00
.PHONY: test_min
test_min:
MINTEST=1 npm test
2017-03-21 07:45:12 +00:00
.PHONY: travis
travis: ## Run test suite with minimal output
mocha -R dot -t 30000
.PHONY: ctest
ctest:
browserify -t brfs test/{exp,fraction,general,implied,oddities,utilities,comma}.js > ctest/test.js
2017-03-12 07:34:36 +00:00
## Code Checking
.PHONY: lint
2017-03-21 07:45:12 +00:00
lint: $(TARGET) $(AUXTARGETS) ## Run jshint and jscs checks
@jshint --show-non-errors $(TARGET) $(AUXTARGETS)
@jshint --show-non-errors test/
2017-03-12 07:34:36 +00:00
@jshint --show-non-errors $(CMDS)
@jshint --show-non-errors package.json
@jshint --show-non-errors --extract=always $(HTMLLINT)
2017-03-21 07:45:12 +00:00
@jscs $(TARGET) $(AUXTARGETS)
2017-03-12 07:34:36 +00:00
.PHONY: flow
flow: lint ## Run flow checker
@flow check --all --show-all-errors
.PHONY: cov
2017-03-12 07:34:36 +00:00
cov: tmp/coverage.html ## Run coverage test
.PHONY: cov_min
cov_min:
MINTEST=1 make cov
2017-03-21 07:45:12 +00:00
misc/coverage.html: $(TARGET)
2017-03-12 07:34:36 +00:00
mocha --require blanket -R html-cov -t 20000 > $@
.PHONY: full_coveralls
full_coveralls:
mocha --require blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js
2017-03-12 07:34:36 +00:00
.PHONY: coveralls
coveralls: ## Coverage Test + Send to coveralls.io
MINTEST=1 make full_coveralls
2017-03-12 07:34:36 +00:00
.PHONY: help
help:
@grep -hE '(^[a-zA-Z_-][ a-zA-Z_-]*:.*?|^#[#*])' $(MAKEFILE_LIST) | bash misc/help.sh
#* To show a spinner, append "-spin" to any target e.g. cov-spin
%-spin:
@make $* & bash misc/spin.sh $$!