|
| 1 | +# Development Guide |
| 2 | + |
| 3 | +Before contributing to this open source project, read our [CONTRIBUTING](../CONTRIBUTING.md). We gratefully welcome improvements to documentation as well as to code. |
| 4 | + |
| 5 | +The code base is a monorepo. We use [Lerna](https://lerna.js.org/) for managing inter-module dependencies, which makes it easier to develop coordinated changes between the modules. Instead of running lerna directly, the commands are wrapped with `yarn`; |
| 6 | + |
| 7 | +### Requirements |
| 8 | + |
| 9 | +Since this project supports multiple Node versions, using a version |
| 10 | +manager such as [nvm](https://github.com/creationix/nvm) is recommended. |
| 11 | + |
| 12 | +We use [yarn](https://yarnpkg.com/) for its workspace functionality, so make sure to install that as well. |
| 13 | + |
| 14 | +To get started once you have Node and yarn installed, run: |
| 15 | + |
| 16 | +```sh |
| 17 | +$ yarn |
| 18 | +``` |
| 19 | + |
| 20 | +This will install all the necessary modules. |
| 21 | + |
| 22 | +### Testing |
| 23 | + |
| 24 | +#### Unit Tests |
| 25 | + |
| 26 | +To run the all unit tests, use: |
| 27 | + |
| 28 | +```sh |
| 29 | +$ yarn test |
| 30 | +``` |
| 31 | + |
| 32 | +To run the unit tests continuously in watch mode while developing, use: |
| 33 | + |
| 34 | +```sh |
| 35 | +$ yarn tdd |
| 36 | +``` |
| 37 | + |
| 38 | +### Linting |
| 39 | + |
| 40 | +We use [gts](https://www.npmjs.com/package/gts) to make sure that new code is conform to our coding standards. |
| 41 | + |
| 42 | +Before raising a pull request, make sure there are no lint problems. |
| 43 | + |
| 44 | +To check the linter, use: |
| 45 | +```sh |
| 46 | +$ yarn run check |
| 47 | +``` |
| 48 | + |
| 49 | +To fix the linter, use: |
| 50 | +```sh |
| 51 | +$ yarn fix |
| 52 | +``` |
| 53 | + |
| 54 | +### Continuous Integration |
| 55 | + |
| 56 | +We rely on CircleCI 2.0 for our tests. If you want to test how the CI behaves |
| 57 | +locally, you can use the CircleCI Command Line Interface as described here: |
| 58 | +https://circleci.com/docs/2.0/local-jobs/ |
| 59 | + |
| 60 | +After installing the `circleci` CLI, simply run one of the following: |
| 61 | + |
| 62 | +```sh |
| 63 | +$ circleci build --job lint |
| 64 | +$ circleci build --job node8 |
| 65 | +$ circleci build --job node10 |
| 66 | +$ circleci build --job node11 |
| 67 | +$ circleci build --job node12 |
| 68 | +$ circleci build --job node12-browsers |
| 69 | +``` |
| 70 | + |
| 71 | +### Docs |
| 72 | + |
| 73 | +We use [typedoc](https://www.npmjs.com/package/typedoc) to generate the api documentation. |
| 74 | + |
| 75 | +To generate the docs, use: |
| 76 | +```sh |
| 77 | +$ yarn docs |
| 78 | +``` |
| 79 | + |
| 80 | +The document will be available under `packages/opentelemetry-types/docs/out` path. |
0 commit comments