Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Makefile and migrate to NPM scripts #1135

Merged
merged 5 commits into from Feb 6, 2018
Merged

Remove Makefile and migrate to NPM scripts #1135

merged 5 commits into from Feb 6, 2018

Conversation

ylemkimon
Copy link
Member

Fixes #1121.

@@ -39,6 +39,7 @@
"jspngopt": "^0.2.0",
"less": "~2.7.1",
"less-loader": "^4.0.5",
"mkdirp": "^0.5.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For cross-platform mkdir

@@ -104,7 +104,7 @@ git checkout --detach

# Build generated files and add them to the repository (for bower)
git clean -fdx build dist
make setup dist
npm run dist
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this command run when --dry-run?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. It won't do anything other than echo the command to the shell which is what we want in the dry run.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinbarabash Do you mean it should actually build the KaTeX or not?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the real command should not run, it should jus echo what the command to the console.

git clone https://github.com/Khan/KaTeX-test-fonts test/screenshotter/unicode-fonts
cd test/screenshotter/unicode-fonts && \
git checkout 99fa66a2da643218754c8236b9f9151cac71ba7c && \
cd ../../../
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is included in the dockers/Screenshotter/screenshotter.sh.

TOTAL=`echo $${JSSIZE}+$${CSSSIZE} | bc`; \
printf "Minified, gzipped js: %6d\n" "$${JSSIZE}"; \
printf "Minified, gzipped css: %6d\n" "$${CSSSIZE}"; \
printf "Total: %6d\n" "$${TOTAL}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to do this easily in the NPM scripts.

PYTHON=$(shell python2 --version >/dev/null 2>&1 && echo python2 || echo python)

metrics:
cd metrics && $(PERL) ./mapping.pl | $(PYTHON) ./extract_tfms.py | $(PYTHON) ./extract_ttfs.py | $(PYTHON) ./format_json.py --width > ../src/fontMetricsData.js
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be moved to the fonts repo by #1134.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to hold of on merging this until #1134 has been merged.

package.json Outdated
"test": "npm run prestart && npm run lint && npm run flow && npm run jest",
"screenshots": "npm run prestart && dockers/Screenshotter/screenshotter.sh",
"verify-screenshots": "npm run screenshots -- --verify",
"prestart": "node check-node-version.js && check-dependencies && cd src && node unicodeMake.js >unicodeSymbols.js",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As generating unicodeSymbols.js is cheap, it does before every tests and builds.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One less thing to remember to do. :)

Copy link
Member

@kevinbarabash kevinbarabash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Requesting one change in package.json to break out test into test:jest, test:lint, etc.

.arclint Outdated
@@ -2,7 +2,7 @@
"linters": {
"katex-linter": {
"type": "script-and-regex",
"script-and-regex.script": "make lint || true",
"script-and-regex.script": "npm run lint || true",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating this file. We use phabricator/arcanist internally, but I can't remember the last time I saw a phabricator review for KaTeX.

@@ -104,7 +104,7 @@ git checkout --detach

# Build generated files and add them to the repository (for bower)
git clean -fdx build dist
make setup dist
npm run dist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. It won't do anything other than echo the command to the shell which is what we want in the dry run.

"dist": "npm test && npm run build && npm run dist:copy && npm run dist:zip && npm run dist:dist",
"dist:copy": "cd build && mkdirp katex && cp -r katex.js katex.min.js katex.css katex.min.css contrib fonts ../README.md katex",
"dist:zip": "cd build && tar czf katex.tar.gz katex/ && zip -rq katex.zip katex/",
"dist:dist": "rimraf dist/ && cp -r build/katex/ dist/",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this organization. Could you do something similar for test?

@codecov
Copy link

codecov bot commented Feb 6, 2018

Codecov Report

Merging #1135 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1135   +/-   ##
=======================================
  Coverage   78.95%   78.95%           
=======================================
  Files          59       59           
  Lines        3872     3872           
  Branches      655      655           
=======================================
  Hits         3057     3057           
  Misses        674      674           
  Partials      141      141

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73d80f5...cee7c03. Read the comment docs.

Copy link
Member

@kevinbarabash kevinbarabash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with this as is. We can always split npm test into separate commands later. @ylemkimon I leave it up to you as to whether that change is part of the PR or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants