Add build artifacts to .gitignore and allow installing dependencies without building KaTeX

* Let git ignore .npm-install.stamp and dist

The former is created for most makefile targets after dependencies have been
retrieved.  The latter is created by typical operations like “make” without
arguments or “npm install”.  Having these around is to be expected.

Adding this to .gitignore should NOT affect npm packaging, since that is
based on a whitelist in package.json which does mention dist.

* Allow installing dependencies without actually building KaTeX

We have been using “npm install” to install dependencies, but since that
also does build KaTeX itself, it may fail if e.g. there are any style guide
violations.  Now we only fetch dependencies but do not build KaTeX itself.

The make conditionals used here are not part of POSIX make but a GNU
extension.  But we already use functionality not mandated by POSIX (namely
many of the functions like “wildcard”), so this should not make portability
any worse than it already is.
This commit is contained in:
Martin von Gagern 2016-11-03 02:24:59 +01:00 committed by Kevin Barabash
parent fef5b88057
commit 0ebbc25672
2 changed files with 11 additions and 1 deletions

2
.gitignore vendored
View File

@ -3,6 +3,8 @@ node_modules
npm-debug.log
last.png
diff.png
/.npm-install.stamp
/dist/
/test/screenshotter/tex/
/test/screenshotter/diff/
/test/symgroups.tex

View File

@ -1,10 +1,18 @@
.PHONY: build dist lint setup copy serve clean metrics test zip contrib
build: lint build/katex.min.js build/katex.min.css contrib zip compress
ifeq ($(KATEX_DIST),skip)
dist:
else
dist: build
rm -rf dist/
cp -R build/katex/ dist/
endif
# Export these variables for use in contrib Makefiles
export BUILDDIR = $(realpath build)
export BROWSERIFY = $(realpath ./node_modules/.bin/browserify)
@ -18,7 +26,7 @@ export UGLIFYJS = $(realpath ./node_modules/.bin/uglifyjs) \
NIS = .npm-install.stamp
$(NIS) setup: package.json
npm install
KATEX_DIST=skip npm install # dependencies only, don't build
@touch $(NIS)
lint: $(NIS) katex.js server.js cli.js $(wildcard src/*.js) $(wildcard test/*.js) $(wildcard contrib/*/*.js) $(wildcard dockers/*/*.js)