commit 0ebbc256729e77ec40dbc7bf80eae1f0c7d02b07
parent fef5b880572ca6f6e35e67296e3a7c0bc7b4cd3c
Author: Martin von Gagern <Martin.vGagern@gmx.net>
Date: Thu, 3 Nov 2016 02:24:59 +0100
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.
Diffstat:
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
@@ -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
diff --git a/Makefile b/Makefile
@@ -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)