mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-25 00:17:21 +02:00
Use locally-installed Gulp over globally-installed one
parent
20f3b6c4be
commit
f6c741bb91
@ -15,9 +15,8 @@ Below is an overview of how to contribute code to the PDF.js project. The basic
|
|||||||
### Prerequisites
|
### Prerequisites
|
||||||
* Git client
|
* Git client
|
||||||
* GitHub account
|
* GitHub account
|
||||||
* [Node.js](https://nodejs.org/)
|
* [Node.js](https://nodejs.org/) with NPM
|
||||||
* Gulp (via `npm install -g gulp-cli`)
|
* Modern browser
|
||||||
* An ES6 compatible browser
|
|
||||||
|
|
||||||
If you develop on Windows, read [[Setting up pdf.js Development Environment for Windows]]. For font testing you will need [Python](https://www.python.org/download).
|
If you develop on Windows, read [[Setting up pdf.js Development Environment for Windows]]. For font testing you will need [Python](https://www.python.org/download).
|
||||||
|
|
||||||
@ -64,13 +63,13 @@ If the branch contains lot of small commits, you might be asked to squash the co
|
|||||||
To make sure that your code follows our [[Style Guide]], run the following command from the PDF.js folder:
|
To make sure that your code follows our [[Style Guide]], run the following command from the PDF.js folder:
|
||||||
|
|
||||||
```
|
```
|
||||||
gulp lint
|
npx gulp lint
|
||||||
```
|
```
|
||||||
|
|
||||||
If there are errors, some of them can be fixed automatically by the linting tool. To do so, run the following command:
|
If there are errors, some of them can be fixed automatically by the linting tool. To do so, run the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
gulp lint --fix
|
npx gulp lint --fix
|
||||||
```
|
```
|
||||||
|
|
||||||
_Protip_: If you are a Vim user, then install [Syntastic](https://www.vim.org/scripts/script.php?script_id=2736), install ESLint globally using `npm install -g eslint` and add the following line to your `.vimrc`:
|
_Protip_: If you are a Vim user, then install [Syntastic](https://www.vim.org/scripts/script.php?script_id=2736), install ESLint globally using `npm install -g eslint` and add the following line to your `.vimrc`:
|
||||||
@ -102,13 +101,13 @@ The browser tests are split into the following types of tests:
|
|||||||
The reference tests require you to generate original snapshots for comparison. The snapshots should be generated before you make any changes. If you have already made some changes, either `git stash` your work or checkout the master branch. Now we can generate the reference images:
|
The reference tests require you to generate original snapshots for comparison. The snapshots should be generated before you make any changes. If you have already made some changes, either `git stash` your work or checkout the master branch. Now we can generate the reference images:
|
||||||
|
|
||||||
```
|
```
|
||||||
gulp makeref
|
npx gulp makeref
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then run the test suite from the PDF.js root folder after unstashing any changes or going back to your feature branch:
|
You can then run the test suite from the PDF.js root folder after unstashing any changes or going back to your feature branch:
|
||||||
|
|
||||||
```
|
```
|
||||||
gulp test
|
npx gulp test
|
||||||
```
|
```
|
||||||
|
|
||||||
If you wish to add a reference test for your patch, you can place the file (`foo.pdf` in this example) in the `test/pdfs` directory and run the following script from the PDF.js root folder to add it to the suite:
|
If you wish to add a reference test for your patch, you can place the file (`foo.pdf` in this example) in the `test/pdfs` directory and run the following script from the PDF.js root folder to add it to the suite:
|
||||||
@ -121,10 +120,10 @@ Note that this script only supports adding `eq` tests for all pages of the PDF f
|
|||||||
|
|
||||||
**Running unit tests separately**
|
**Running unit tests separately**
|
||||||
|
|
||||||
Unit tests are run when `gulp test` is run, but they can also be run separately using:
|
Unit tests are run when `npx gulp test` is run, but they can also be run separately using:
|
||||||
|
|
||||||
```
|
```
|
||||||
gulp unittest
|
npx gulp unittest
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5. Push changes to your fork/branch
|
### 5. Push changes to your fork/branch
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user