From 9441f98a48dd08d4d059b306a118c0c09650556a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 13 Sep 2018 21:08:17 +0200 Subject: [PATCH] added `prettier` pretty-printing/reformatting make target, which should help us produce better readable & debuggable MathJax library files, thanks to One Statement Per Line and other very sensible formattings... --- .gitignore | 2 ++ Makefile | 14 +++++++++++++- package-lock.json | 13 +++++++++++-- package.json | 7 +++++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 8b13789..4119516 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ +node_modules/ + diff --git a/Makefile b/Makefile index 4b74138..93995f5 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,15 @@ help: @echo "make pack" @echo " Run MathJax packer" @echo "" + @echo "make combine" + @echo " Run MathJax combiner, which combines the packed library source files" + @echo "" + @echo "make prettier" + @echo " Run MathJax prettifier, which pretty-prints the combined library files" + @echo "" + @echo "make all" + @echo " Regenerate the MathJax library files (pack, combine & prettify)" + @echo "" @echo "make clean" @echo " Remove temporary directories and files." @echo "" @@ -64,6 +73,9 @@ pack: config combine: config $(MAKE) -C combiner all +prettier: + prettier --write --print-width 120 $(MATHJAXDIR)/mathjax/MathJax.js $(MATHJAXDIR)/mathjax/config/*.js + misc: operator-dictionary MML-entities MML-entities: config @@ -80,5 +92,5 @@ clean-destination: config # this assumes MATHJAXDIR is a *relative path* for the perl tools in combiner and packer: -rm -rf $(MATHJAXDIR)/mathjax/config/ $(MATHJAXDIR)/mathjax/localization/ $(MATHJAXDIR)/mathjax/extensions/ $(MATHJAXDIR)/mathjax/jax/ -.PHONY: help fonts config pack combine clean clean-destination all +.PHONY: help fonts config pack combine clean clean-destination prettier misc operator-dictionary MML-entities all diff --git a/package-lock.json b/package-lock.json index e2f391b..fd5bdb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,14 @@ { "name": "@gerhobbelt/mathjax-dev", - "version": "1.0.1-6", - "lockfileVersion": 1 + "version": "1.0.1-7", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "prettier": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.2.tgz", + "integrity": "sha512-McHPg0n1pIke+A/4VcaS2en+pTNjy4xF+Uuq86u/5dyDO59/TtFZtQ708QIRkEZ3qwKz3GVkVa6mpxK/CpB8Rg==", + "dev": true + } + } } diff --git a/package.json b/package.json index ff2413b..0a9fc7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/mathjax-dev", - "version": "1.0.1-6", + "version": "1.0.1-7", "description": "development environment for MathJax", "repository": "git@github.com:GerHobbelt/MathJax-dev.git", "scripts": { @@ -11,5 +11,8 @@ "mathjax" ], "author": "mathjax.org", - "license": "MIT" + "license": "MIT", + "devDependencies": { + "prettier": "1.14.2" + } }