|
| 1 | +# Introduction |
| 2 | + |
| 3 | +> Thanks for your contribution to Lodestar. It's people like you that push the Ethereum ecosystem forward. |
| 4 | +
|
| 5 | +# Prerequisites |
| 6 | +- [Lerna](https://github.com/lerna/lerna) |
| 7 | +- [Yarn](https://yarnpkg.com/) |
| 8 | + |
| 9 | +# Getting Started |
| 10 | +- Run `lerna bootstrap` or `yarn install` to install dependencies |
| 11 | +- NOTE: By default the spec tests (5GB) will be installed with other dependencies. If you would like to avoid downloading the spec tests, instead run `yarn install --ignore-optional`. |
| 12 | + |
| 13 | +# Tests |
| 14 | +- Run `lerna run test:spec-min` for minimal spec tests |
| 15 | +- Run `lerna run test:spec-main` for mainnet spec tests |
| 16 | +- Run `lerna run test:unit` for unit tests |
| 17 | +- Run `lerna run test:e2e` for end-to-end tests |
| 18 | +- Run `lerna run test` to run all tests |
| 19 | + |
| 20 | +# First-time Contributor? |
| 21 | +Unsure where to begin contributing to Lodestar? Here are some ideas! |
| 22 | + |
| 23 | +- See any typos? See any verbiage that should be changed or updated? Go for it! Github makes it easy to make contributions right from the browser. |
| 24 | +- Look through our [outstanding unassigned issues](https://github.com/ChainSafe/lodestar/issues?q=is%3Aopen+is%3Aissue+no%3Aassignee). (hint: look for issues labeled "good first issue") |
| 25 | +- Join our [discord chat](https://discord.gg/aMxzVcr)! |
| 26 | + |
| 27 | +# Reporting a bug? |
| 28 | +[Create a new issue!](https://github.com/ChainSafe/lodestar/issues/new/choose) Select the type of issue that best fits, and please fill out as much of the information as you can. |
| 29 | + |
| 30 | +# Contribution process |
| 31 | + |
| 32 | +1. Make sure you're familiar with our contribution guidelines (this document!) |
| 33 | +2. Create your [own fork](https://github.com/ChainSafe/lodestar/fork) of this repo |
| 34 | +3. Make your changes in your local fork |
| 35 | +4. If you've made a code change, make sure to lint and test your changes (`yarn lint` and `yarn test:unit`) |
| 36 | +5. Make a pull request! We review PRs on a regular basis. |
| 37 | +6. You may be asked to sign a Contributor License Agreement (CLA). We make it relatively painless with CLA-bot. |
| 38 | + |
| 39 | +# Lodestar Monorepo |
| 40 | + |
| 41 | +We're currently experimenting with hosting the majority of lodestar packages and support packages in this repository as a [monorepo](https://en.wikipedia.org/wiki/Monorepo). We're using [Lerna](https://lerna.js.org/) to manage the packages. |
| 42 | +See [packages/](https://github.com/ChainSafe/lodestar/tree/master/packages) for a list of packages hosted in this repo. |
| 43 | + |
| 44 | +# Style Guide |
| 45 | + |
| 46 | +- PRs should usually only update a single package (in our monorepo) at a time |
| 47 | +- Many module class constructors have the following signature: `(options, dependencies)` |
| 48 | + - eg: `public constructor(opts: IExampleOptions, {db, logger}: IExampleModules)` |
| 49 | +- Modules should be designed to "do one thing and do it well" |
| 50 | + - Consider the interface of a module -- events included, and make sure it is coherent |
| 51 | +- Make sure your code is properly linted |
| 52 | + - use an IDE that will show linter errors/warnings |
| 53 | + - run `yarn lint` from the command line |
| 54 | + - common rules: |
| 55 | + - Functions and variables should be [`camelCase`](https://en.wikipedia.org/wiki/Camel_case), classes should be [`PascalCase`](http://wiki.c2.com/?PascalCase), constants should be `UPPERCASE_WITH_UNDERSCORES`. |
| 56 | + - Use `"` instead of `'` |
| 57 | + - All functions should have types declared for all parameters and return value |
| 58 | + - All interfaces should be prefixed with a `I` |
| 59 | + - eg: `IMyInterface` |
| 60 | + - You probably shouldn't be using Typescript's `any` |
| 61 | + - Private class properties should not be prefixed with a `_` |
| 62 | + - eg: `private dirty;`, not `private _dirty;` |
| 63 | +- Make sure that your code is properly type checked: |
| 64 | + - use an IDE that will show type errors |
| 65 | + - run `yarn check-types` from the command line |
| 66 | +- Make sure that the tests are still passing: |
| 67 | + - run `yarn test:unit` from the command line |
| 68 | + |
| 69 | +# Community |
| 70 | + |
| 71 | +Come chat with us on [discord](https://discord.gg/aMxzVcr)! |
0 commit comments