Makefile 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. install: node_modules
  16. node_modules: package.json
  17. @NODE_ENV= $(PKG) install
  18. @touch node_modules
  19. lint: .FORCE
  20. eslint browser.js debug.js index.js node.js
  21. test-node: .FORCE
  22. istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
  23. test-browser: .FORCE
  24. mkdir -p dist
  25. @$(BROWSERIFY) \
  26. --standalone debug \
  27. . > dist/debug.js
  28. karma start --single-run
  29. rimraf dist
  30. test: .FORCE
  31. concurrently \
  32. "make test-node" \
  33. "make test-browser"
  34. coveralls:
  35. cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
  36. .PHONY: all install clean distclean