First of all, thanks for considering contributing. Contributions are very welcome! Below is some helpful information.
You can report issues in the Issue Tracker. When filing an issue, be sure to provide some basic information for people to work with:
- What version of Citation.js are you using?
- How are you running Citation.js (npm package, browser bundle, self-rolled bundle, webpack)?
- Where are you running Citation.js? * The OS usually will not matter much, but the browser really does.
- What is your input data and code?
- What did you expect to happen, and what actually happened?
For general tips on how to work with Git and making pull requests, check out this guide on how to make pull requests in GitHub.
To install for development, it's probably best to clone this repo:
git clone https://github.com/citation-js/citation-js.git
Then install dependencies:
npm install
lerna bootstrap
Code for the different formats are in the src/
directories of the various packages in packages/
. We use the StandardJS code style. You can check your code with
npm run lint
and autofix some formatting with
npm run lint -- --fix
To install new packages, please use lerna add
instead of npm install
:
lerna add --scope '@citation-js/plugin-...' package-name
Commits follow the Angular commits convention. For examples, take a look in the recent commits.
New test go in the test/
directories of the various packages in packages/
. To run tests in the entire package, run
npm test
If you want to test single packages, run
npm test -- --scope '@citation-js/plugin-...'
If you want to run single test cases, run
npm test -- --scope '@citation-js/plugin-...' -- --grep 'pattern'
@citation-js/cli
depends on all the plugins, and the plugins all depend on @citation-js/core
. To test changes in @citation-js
dependencies on different packages, first run
npm run babel
Examples of this are when you made changes to @citation-js/core
s util.fetchFile
function and you want to see if the DOI plugin still works, or if you added shortDOIs to the DOI plugin and want to check if the CLI still recognizes it properly.
The tests for Wikidata and DOIs use cached data, to save time and take it easier on their APIs. If you want to bypass the caches for Wikidata and DOIs, run
npm run test:live
To update the caches, run
npm run test:update
If you need new Wikidata or DOI data in the cache, check out the scripts in scripts/
. Note that for the Wikidata cache, you would also need to add sub-items such as authors and journals, as the code has to fetch their labels separately.
Additionally, coverage can be checked with
npm run coverage
lerna version
lerna publish from-packages
./tools/update-components.sh
git commit -am "[package] Update deps"
npm version
npm publish
git push
./update-components.sh
git commit -am "..."
git push