Makefile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. SRC = lib/lunr.js \
  2. lib/utils.js \
  3. lib/field_ref.js \
  4. lib/set.js \
  5. lib/idf.js \
  6. lib/token.js \
  7. lib/tokenizer.js \
  8. lib/pipeline.js \
  9. lib/vector.js \
  10. lib/stemmer.js \
  11. lib/stop_word_filter.js \
  12. lib/trimmer.js \
  13. lib/token_set.js \
  14. lib/token_set_builder.js \
  15. lib/index.js \
  16. lib/builder.js \
  17. lib/match_data.js \
  18. lib/query.js \
  19. lib/query_parse_error.js \
  20. lib/query_lexer.js \
  21. lib/query_parser.js \
  22. YEAR = $(shell date +%Y)
  23. VERSION = $(shell cat VERSION)
  24. NODE ?= $(shell which node)
  25. NPM ?= $(shell which npm)
  26. UGLIFYJS ?= ./node_modules/.bin/uglifyjs
  27. MOCHA ?= ./node_modules/.bin/mocha
  28. MUSTACHE ?= ./node_modules/.bin/mustache
  29. ESLINT ?= ./node_modules/.bin/eslint
  30. JSDOC ?= ./node_modules/.bin/jsdoc
  31. NODE_STATIC ?= ./node_modules/.bin/static
  32. all: test lint docs
  33. release: lunr.js lunr.min.js bower.json package.json component.json docs
  34. lunr.js: $(SRC)
  35. cat build/wrapper_start $^ build/wrapper_end | \
  36. sed "s/@YEAR/${YEAR}/" | \
  37. sed "s/@VERSION/${VERSION}/" > $@
  38. lunr.min.js: lunr.js
  39. ${UGLIFYJS} --compress --mangle --comments < $< > $@
  40. %.json: build/%.json.template
  41. cat $< | sed "s/@VERSION/${VERSION}/" > $@
  42. size: lunr.min.js
  43. @gzip -c lunr.min.js | wc -c
  44. server: test/index.html
  45. ${NODE_STATIC} -a 0.0.0.0 -H '{"Cache-Control": "no-cache, must-revalidate"}'
  46. lint: $(SRC)
  47. ${ESLINT} $^
  48. perf/*_perf.js:
  49. ${NODE} -r ./perf/perf_helper.js $@
  50. benchmark: perf/*_perf.js
  51. test: node_modules lunr.js
  52. ${MOCHA} test/*.js -u tdd -r test/test_helper.js -R dot -C
  53. test/inspect: node_modules lunr.js
  54. ${MOCHA} test/*.js -u tdd -r test/test_helper.js -R dot -C --inspect-brk=0.0.0.0:9292
  55. test/env/file_list.json: $(wildcard test/*test.js)
  56. ${NODE} -p 'JSON.stringify({test_files: process.argv.slice(1)})' $^ > $@
  57. test/index.html: test/env/file_list.json test/env/index.mustache
  58. ${MUSTACHE} $^ > $@
  59. docs: $(SRC)
  60. ${JSDOC} -R README.md -d docs -c build/jsdoc.conf.json $^
  61. clean:
  62. rm -f lunr{.min,}.js
  63. rm -rf docs
  64. rm *.json
  65. reset:
  66. git checkout lunr.* *.json
  67. node_modules: package.json
  68. ${NPM} -s install
  69. .PHONY: test clean docs reset perf/*_perf.js test/inspect