mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 11:18:39 +00:00
Call “npm install” automatically if package.json changed (#505)
This adds a stamp file which is used to detect whether the `package.json` file got updated since the last `npm install`. If so, `npm install` is run again to update all modules to the version described in `package.json`. This happens as a dependency of only those modules which actually need some npm-installed module. Setting the corresponding make variable to the empty string disables the feature, which is used by the `make` invocation in the `prepublish` script inside `package.json` to avoid infinite loops. It can also be used by developers working in an environment with reduced connectivity, as long as they know what they are doing.
This commit is contained in:
committed by
Kevin Barabash
parent
ec62ec39d8
commit
e6de31d2d6
23
Makefile
23
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
|
||||
|
Reference in New Issue
Block a user