diff --git a/Makefile b/Makefile index 03d3d959..0360b331 100644 --- a/Makefile +++ b/Makefile @@ -13,19 +13,24 @@ export UGLIFYJS = $(realpath ./node_modules/.bin/uglifyjs) \ --beautify \ ascii_only=true,beautify=false -setup: +# The prepublish script in package.json will override the following variable, +# setting it to the empty string and thereby avoiding an infinite recursion +NIS = .npm-install.stamp + +$(NIS) setup: package.json npm install + @touch $(NIS) -lint: katex.js server.js cli.js $(wildcard src/*.js) $(wildcard test/*.js) $(wildcard contrib/*/*.js) $(wildcard dockers/*/*.js) - ./node_modules/.bin/eslint $^ +lint: $(NIS) katex.js server.js cli.js $(wildcard src/*.js) $(wildcard test/*.js) $(wildcard contrib/*/*.js) $(wildcard dockers/*/*.js) + ./node_modules/.bin/eslint $(filter-out *.stamp,$^) -build/katex.js: katex.js $(wildcard src/*.js) +build/katex.js: katex.js $(wildcard src/*.js) $(NIS) $(BROWSERIFY) $< --standalone katex > $@ build/katex.min.js: build/katex.js $(UGLIFYJS) < $< > $@ -build/katex.less.css: static/katex.less $(wildcard static/*.less) +build/katex.less.css: static/katex.less $(wildcard static/*.less) $(NIS) ./node_modules/.bin/lessc $< $@ build/katex.min.css: build/katex.less.css @@ -78,10 +83,10 @@ compress: build/katex.min.js build/katex.min.css @printf "Minified, gzipped css: %6d\n" "${CSSSIZE}" @printf "Total: %6d\n" "${TOTAL}" -serve: +serve: $(NIS) node server.js -test: +test: $(NIS) JASMINE_CONFIG_PATH=test/jasmine.json node_modules/.bin/jasmine PERL=perl @@ -94,7 +99,7 @@ extended_metrics: cd metrics && $(PERL) ./mapping.pl | $(PYTHON) ./extract_tfms.py | $(PYTHON) ./extract_ttfs.py | $(PYTHON) ./format_json.py --width > ../src/fontMetricsData.js clean: - rm -rf build/* + rm -rf build/* $(NIS) -screenshots: test/screenshotter/unicode-fonts +screenshots: test/screenshotter/unicode-fonts $(NIS) dockers/Screenshotter/screenshotter.sh diff --git a/package.json b/package.json index 9542271e..0752bbca 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "bin": "cli.js", "scripts": { "test": "make lint test", - "prepublish": "make dist" + "prepublish": "make NIS= dist" }, "dependencies": { "match-at": "^0.1.0"