From 0ebbc256729e77ec40dbc7bf80eae1f0c7d02b07 Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Thu, 3 Nov 2016 02:24:59 +0100 Subject: [PATCH] Add build artifacts to .gitignore and allow installing dependencies without building KaTeX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- .gitignore | 2 ++ Makefile | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ddaaa93..1c6a787 100644 --- 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 index 4d36dbf..71a95ac 100644 --- 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)