File: Makefile

package info (click to toggle)
node-lunr 2.3.5~dfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 584 kB
  • sloc: makefile: 84; sh: 67
file content (94 lines) | stat: -rw-r--r-- 2,256 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

SRC = lib/lunr.js \
	lib/utils.js \
	lib/field_ref.js \
	lib/set.js \
	lib/idf.js \
	lib/token.js \
	lib/tokenizer.js \
	lib/pipeline.js \
	lib/vector.js \
	lib/stemmer.js \
	lib/stop_word_filter.js \
	lib/trimmer.js \
	lib/token_set.js \
	lib/token_set_builder.js \
	lib/index.js \
	lib/builder.js \
	lib/match_data.js \
	lib/query.js \
	lib/query_parse_error.js \
	lib/query_lexer.js \
	lib/query_parser.js \

ifdef SOURCE_DATE_EPOCH
YEAR = $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" +%Y 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" +%Y 2>/dev/null || date -u +%Y)
else
YEAR = $(shell date +%Y)
endif
VERSION = $(shell cat VERSION)

NODE ?= $(shell which node)
NPM ?= $(shell which npm)
UGLIFYJS ?= ./node_modules/.bin/uglifyjs
MOCHA ?= ./node_modules/.bin/mocha
MUSTACHE ?= ./node_modules/.bin/mustache
ESLINT ?= ./node_modules/.bin/eslint
JSDOC ?= ./node_modules/.bin/jsdoc
NODE_STATIC ?= ./node_modules/.bin/static

all: test lint docs
release: lunr.js lunr.min.js bower.json package.json component.json docs

lunr.js: $(SRC)
	cat build/wrapper_start $^ build/wrapper_end | \
	sed "s/@YEAR/${YEAR}/" | \
	sed "s/@VERSION/${VERSION}/" > $@

lunr.min.js: lunr.js
	${UGLIFYJS} --compress --mangle --comments < $< > $@

%.json: build/%.json.template
	cat $< | sed "s/@VERSION/${VERSION}/" > $@

size: lunr.min.js
	@gzip -c lunr.min.js | wc -c

server: test/index.html
	${NODE_STATIC} -a 0.0.0.0 -H '{"Cache-Control": "no-cache, must-revalidate"}'

lint: $(SRC)
	${ESLINT} $^

perf/*_perf.js:
	${NODE} -r ./perf/perf_helper.js $@

benchmark: perf/*_perf.js

test: node_modules lunr.js
	${MOCHA} test/*.js -u tdd -r test/test_helper.js -R dot -C

test/inspect: node_modules lunr.js
	${MOCHA} test/*.js -u tdd -r test/test_helper.js -R dot -C --inspect-brk=0.0.0.0:9292

test/env/file_list.json: $(wildcard test/*test.js)
	${NODE} -p 'JSON.stringify({test_files: process.argv.slice(1)})' $^ > $@

test/index.html: test/env/file_list.json test/env/index.mustache
	${MUSTACHE} $^ > $@

docs: $(SRC)
	${JSDOC} -R README.md -d docs -c build/jsdoc.conf.json $^

clean:
	rm -f lunr{.min,}.js
	rm -rf docs
	rm *.json

reset:
	git checkout lunr.* *.json

node_modules: package.json
#	${NPM} -s install

.PHONY: test clean docs reset perf/*_perf.js test/inspect