Replace yarn run and yarn install with yarn, remove building with npm instructions (#1528)

* Replace `yarn run` with `yarn`

* Replace `yarn install` with `yarn`

* Remove building using `npm` from node.md
This commit is contained in:
ylemkimon
2018-07-30 14:31:25 +09:00
committed by GitHub
parent c88fa70a62
commit c06b36cb6a
10 changed files with 31 additions and 31 deletions

View File

@@ -2,7 +2,7 @@
"linters": {
"katex-linter": {
"type": "script-and-regex",
"script-and-regex.script": "yarn run test:lint || true",
"script-and-regex.script": "yarn test:lint || true",
"script-and-regex.regex": "/^(?P<file>\\S+): line (?P<line>\\d+), col \\d+, (?P<message>.*)$/m"
}
}

View File

@@ -17,7 +17,7 @@ restore_node_modules_cache: &restore_node_modules_cache
yarn_install: &yarn_install
run:
name: Install dependencies
command: yarn install
command: yarn
screenshotter: &screenshotter
steps:
@@ -71,7 +71,7 @@ jobs:
- run:
name: Build KaTeX
command: yarn run build
command: yarn build
- store_artifacts:
path: dist/katex.js

View File

@@ -58,7 +58,7 @@ single file. The goal is to have all functions use this new system.
## Testing
Local testing can be done by running the webpack-dev-server using configuration
`webpack.dev.js`. Run `yarn install` to install dependencies, and then `yarn start`
`webpack.dev.js`. Run `yarn` to install dependencies, and then `yarn start`
to start the server.
This will host an interactive editor at
@@ -74,7 +74,7 @@ by running `yarn add webpack-dev-server@2.7.1`.
The JavaScript parser and some of the HTML and MathML tree
builders are tested with Jest. These tests can be run using node with
`yarn run test:jest`. If you need to debug the tests see
`yarn test:jest`. If you need to debug the tests see
[https://facebook.github.io/jest/docs/troubleshooting.html](https://facebook.github.io/jest/docs/troubleshooting.html)
The interactive editor can also be used for debugging tests in the browser by
@@ -88,9 +88,9 @@ tests when you submit a pull request, in case you forget.
If you make any changes to Parser.js, add Jest tests to ensure they work.
Some tests verify the structure of the output tree using [snapshot testing](https://facebook.github.io/jest/docs/en/snapshot-testing.html).
Those snapshots can be updated by running `yarn run test:jest:update`.
Those snapshots can be updated by running `yarn test:jest:update`.
Also, test code coverage can be collected by `yarn run test:jest:coverage`.
Also, test code coverage can be collected by `yarn test:jest:coverage`.
You can view the report in `coverage/lcov-report/index.html`.
#### Screenshot tests
@@ -126,7 +126,7 @@ try to test in IE 9, using [modern.ie](http://modern.ie) VMs.
## Building
KaTeX is built using webpack with configuration `webpack.config.js`. Run
`yarn run build` to build the project.
`yarn build` to build the project.
## Style guide
@@ -141,12 +141,12 @@ Code
In general, try to make your code blend in with the surrounding code.
The code can be linted by running `yarn run test:lint`, which lints JavaScript
The code can be linted by running `yarn test:lint`, which lints JavaScript
files using ESLint and stylesheets using stylelint. They must pass to commit
the changes.
Some files have flowtype annotations and can be checked for type errors using
Flow by running `yarn run test:flow`. See [Flow](https://flow.org/) for more details.
Flow by running `yarn test:flow`. See [Flow](https://flow.org/) for more details.
## Pull Requests
@@ -160,7 +160,7 @@ Flow by running `yarn run test:flow`. See [Flow](https://flow.org/) for more det
The fonts for KaTeX live in a submodule stored in `submodules/katex-fonts`.
When you first clone the KaTeX repository, use
`git submodule update --init --recursive` to download the corresponding
fonts repository. After running `yarn install`, you should have Git hooks that
fonts repository. After running `yarn`, you should have Git hooks that
will automatically run this command after switching to branches
where `submodules/katex-fonts` point to different commits.

4
cli.js
View File

@@ -2,7 +2,7 @@
// Simple CLI for KaTeX.
// Reads TeX from stdin, outputs HTML to stdout.
// To run this from the repository, you must first build KaTeX by running
// `yarn install` and `yarn run build`.
// `yarn` and `yarn build`.
/* eslint no-console:0 */
@@ -12,7 +12,7 @@ try {
} catch (e) {
console.error(
"KaTeX could not import, likely because dist/katex.js is missing.");
console.error("Please run 'yarn install' and 'yarn run build' before running");
console.error("Please run 'yarn' and 'yarn build' before running");
console.error("cli.js from the KaTeX repository.");
console.error();
throw e;

View File

@@ -8,7 +8,7 @@ installed and running.
If all you want is (re)create
all the snapshots for all the browsers, then you can do so by:
yarn run test:screenshots:update
yarn test:screenshots:update
It will fetch all required selenium docker images, and use them to
take screenshots.
@@ -69,7 +69,7 @@ Examples:
You can verify screenshots by running:
yarn run test:screenshots
yarn test:screenshots
or passing `--verify` option to `screenshotter.js` or `screenshotter.sh`.
See above for more details.

View File

@@ -30,7 +30,7 @@ the even larger overhead of setting up docker and creating the initial
image, then you may instead execute the commands
cd dockers/texcmp
yarn install
yarn
node texcmp.js
from the root of your KaTeX directory tree. Required tools include the

View File

@@ -36,7 +36,7 @@ Based on this information and what you want to support with your website, you mi
For example, if you wanted to create a trimmed down version of KaTeX, you could only include the `woff` files and gain the most support with the least number of files. To do this:
1. Set `@use-ttf`, and `@use-woff2` to `false` at the top of [fonts.less](https://github.com/KaTeX/katex-fonts/blob/master/fonts.less).
2. Rebuild KaTeX by running `yarn run build` from the top-level directory.
2. Rebuild KaTeX by running `yarn build` from the top-level directory.
3. Include only the `build/fonts/*.woff` files in your distribution.
## Location of font files
@@ -44,5 +44,5 @@ For example, if you wanted to create a trimmed down version of KaTeX, you could
The default build of KaTeX expects the KaTeX fonts to be located in a directory called `fonts` which is a sibling of the `katex.min.css` stylesheet. This can be changed as follows:
1. At the top of the [fonts.less](https://github.com/KaTeX/katex-fonts/blob/master/fonts.less) file, set `@font-folder` to the location of your fonts. You can use relative or absolute paths, so setting it to `"/fonts"` would cause it to search for the fonts in a root `fonts` folder, while `"../fonts"` would search in a `fonts` directory one level above the `katex.min.css` file.
2. Rebuild KaTeX by running `yarn run build` from the top-level directory.
2. Rebuild KaTeX by running `yarn build` from the top-level directory.
3. Use the newly generated `build/katex.min.css` file, and place the fonts where you indicated.

View File

@@ -22,7 +22,7 @@ yarn global add katex
## Building from Source
To build you will need Git, Node.js 6.9 or later, and npm or Yarn.
To build you will need Git, Node.js 6.9 or later, and Yarn.
Clone a copy of the GitHub source repository:
```bash
@@ -32,8 +32,8 @@ cd KaTeX
Then install dependencies and run `build` script:
```bash
npm install # or yarn install
npm run build # or yarn build
yarn
yarn build
```
> You can manually download the package and source code from

View File

@@ -62,24 +62,24 @@
},
"bin": "cli.js",
"scripts": {
"test": "yarn run prestart && yarn run test:lint && yarn run test:flow && yarn run test:jest",
"test": "yarn prestart && yarn test:lint && yarn test:flow && yarn test:jest",
"test:lint": "eslint katex.js katex.webpack.js cli.js webpack.*.js src static test contrib dockers website && stylelint src/katex.less",
"test:flow": "flow",
"test:jest": "jest",
"test:jest:watch": "jest --watch",
"test:jest:update": "jest --updateSnapshot",
"test:jest:coverage": "jest --coverage",
"test:screenshots": "yarn run test:screenshots:update --verify",
"test:screenshots:update": "yarn run prestart && dockers/Screenshotter/screenshotter.sh",
"test:perf": "yarn run prestart && NODE_ENV=test node test/perf-test.js",
"test:screenshots": "yarn test:screenshots:update --verify",
"test:screenshots:update": "yarn prestart && dockers/Screenshotter/screenshotter.sh",
"test:perf": "yarn prestart && NODE_ENV=test node test/perf-test.js",
"clean": "rm -rf dist/ node_modules/",
"clean-install": "yarn run clean && yarn install",
"clean-install": "yarn clean && yarn",
"prestart": "node check-node-version.js && check-dependencies && node src/unicodeMake.js > src/unicodeSymbols.js",
"start": "webpack-dev-server --hot --config webpack.dev.js",
"analyze": "webpack --config webpack.analyze.js",
"build": "yarn run prestart && rimraf dist/ && mkdirp dist && cp README.md dist && webpack",
"watch": "yarn run build --watch",
"dist": "yarn test && yarn run build && yarn run dist:zip",
"build": "yarn prestart && rimraf dist/ && mkdirp dist && cp README.md dist && webpack",
"watch": "yarn build --watch",
"dist": "yarn test && yarn build && yarn dist:zip",
"dist:zip": "cd dist && tar czf ../katex.tar.gz * && zip -rq ../katex.zip *"
},
"dependencies": {
@@ -87,7 +87,7 @@
},
"husky": {
"hooks": {
"pre-commit": "yarn run test:lint",
"pre-commit": "yarn test:lint",
"post-merge": "git submodule update --init --recursive",
"post-checkout": "git submodule update --init --recursive"
}

View File

@@ -106,7 +106,7 @@ rm -f package.json.bak
# Build generated files and add them to the repository (for bower)
git clean -fdx dist
yarn run dist
yarn dist
sed -i.bak -E '/^\/dist\/$/d' .gitignore
rm -f .gitignore.bak
git add .gitignore dist/