Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub
Documentation uses Sphinx and reStructuredText. Source inside the docs directory.
-
Go to the
docs
directory -
Run
pipenv install
to setup Python environemnt (requires Python 3.6). If you encounterValueError('unknown locale: %s' % localename)
, runexport LC_ALL=en_US.UTF-8 && export LANG=en_US.UTF-8
and try again. -
Run
pipenv run make livehtml
to build the docs, watch for changes and preview documentation locally at http://127.0.0.1:8000. -
It's also possible to run
pipenv run make html
for single build. Incremental builds are much faster than the first one as only changed files are built.
This project uses yarn package manager. Please follow official docs to install it.
-
Clone project
git clone https://github.com/lingui/js-lingui.git cd js-lingui
-
Install development packages. This project uses yarn workspaces instead of Lerna, so running
yarn
installs all development packages and also dependencies for all workspaces (insidepackages/*
).yarn
-
Run tests
# Watch mode yarn watch # Single run yarn test
NOTE: if you are using an IDE to run test make sure to use the right Jest config. For unit tests use
-c scripts/jest/config.unit.js
. Integration tests use build packages (created usingyarn release:build
) and config-c scripts/jest/config.integration.js
. See package.json for more info.If you run tests manually instead of using
yarn watch
oryarn test
commands and your tests fail due to missing locale data (typically you'll get wrong number and currency formating) make sure you haveNODE_ICU_DATA
variable set:NODE_ICU_DATA=node_modules/full-icu
.
After you successfully fix a bug or add a new feature, you most probably want to test it in your project as soon as possible.
jsLingui
uses verdaccio, a lightweight local NPM registry, to install
local build of packages in examples. You can do the same in your project:
-
Run
verdaccio
locally in docker (follow verdaccio guide if you don't want to run it in Docker):docker run -d -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
Make sure that your verdaccio user is the same that appears in verdacio-release.js script.
-
Publish local build of packages to registry. Run local release script:
node ./scripts/verdaccio-release.js
-
If you enter inside http://0.0.0.0:4873 (verdaccio instance), you will see your packages published, so you're ready to install them.
-
Inside your project, run:
# Install a small package to update all lingui packages
npm i -g update-by-scope
# Point to your local registry
npm config set registry http://0.0.0.0:4873/
# Run update-by-scope will update all @lingui packages
update-by-scope @lingui
-
After you make some changes, you need to run the same process. (Releasing + yarn upgrade)
-
When finished testing, restore default registry
npm config set registry https://registry.npmjs.org/
Please make sure that all tests pass and linter doesn't report any error before submitting a PR (Don't worry though! If you can't figure out the problem, create a PR anyway and we'll help you).
yarn lint:all
- Linting & Type testingyarn test
- Quick test suite (sufficient)yarn release:test
- Full test suite (recommended)
yarn release:test
builds all packages, simulates creating packages for NPM, runs unit
tests and finally runs integration tests using production build.
Note: Don't commit scripts/build/results.json
created by yarn release:test
.
Now you can create PR and let CI service do their work!
If you need any help, just raise an issue or submit an working draft of PR.