Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # get Makefile directory name: http://stackoverflow.com/a/5982798/376773
  2. THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
  3. THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
  4. # BIN directory
  5. BIN := $(THIS_DIR)/node_modules/.bin
  6. # Path
  7. PATH := node_modules/.bin:$(PATH)
  8. SHELL := /bin/bash
  9. # applications
  10. NODE ?= $(shell which node)
  11. YARN ?= $(shell which yarn)
  12. PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
  13. BROWSERIFY ?= $(NODE) $(BIN)/browserify
  14. .FORCE:
  15. all: dist/debug.js
  16. install: node_modules
  17. node_modules: package.json
  18. @NODE_ENV= $(PKG) install
  19. @touch node_modules
  20. lint: .FORCE
  21. eslint browser.js debug.js index.js node.js
  22. test-node: .FORCE
  23. istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
  24. test-browser: .FORCE
  25. mkdir -p dist
  26. @$(BROWSERIFY) \
  27. --standalone debug \
  28. . > dist/debug.js
  29. karma start --single-run
  30. rimraf dist
  31. test: .FORCE
  32. concurrently \
  33. "make test-node" \
  34. "make test-browser"
  35. coveralls:
  36. cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
  37. .PHONY: all install clean distclean