Skip to content

Latest commit

 

History

History
83 lines (68 loc) · 3.81 KB

CONTRIBUTING.md

File metadata and controls

83 lines (68 loc) · 3.81 KB

👩‍💻 Contributing

Thanks for contributing to the project! Here you can find the instruction about everything you need to properly contribute to the project. We describe package creation, compilation, testing, linting and history management.

🧰 Prerequisite

The only prerequisite we have is that you have your global Yarn keep up to date and updated to the latest, which is "Classic" 1.* version.

Preferred Node.js version is the latest LTS because CI tests will only be running on that versions.

📜 Git Commits

Commit messages MUST fallow Conventional Commits specification, so Lerna could properly determine the correct version bump.

Husky git hook manager is executed on pre-commit and message is validated using commitlint to ensure that commit fallows the basis of conventional commits.

📦 Packages

To make the package part of the workspace, you should locate it under the packages directory. The structure of a single package should be typically made as shown by the layout below:

${package}/
  bin/     # package provided binaries if there is any
  example/ # usage example
  lib/     # compilation output
  src/     # source code
  test/    # unit tests

  package.json    # contains all the necessary configurations for `babel`, `browserlist`, and more
  rollup.config.js # rollup is used for bundling the output `lib` directory
  tsconfig.json    # must extend the root config and set the context to the `src` directory

Every package.json should have the fallowing scripts:

  • start - starts the development of a package
  • compile - compiles the production-ready bundle

There is a clear example of a correctly made package named sum here. You should use it as the boilerplate for your next packages as it already contains everything you will typically need in a package.

🏗️ Development

Code bundling is done by Rollup and configured by our configuration libraries. Scripts that were described before in the Packages section are aliased at the root of the Mono-repository, but now they compile or start the development process not only for one package but for the whole project.

It is recommended to use the root scripts instead of single package scripts to speed up the development. Example of the usage:

$ yarn start

✨ Linting

Code style is fully controlled by ESLint and configured by our configuration libraries. We highly encourage that your IDE is integrated with the linter and could auto-fix the problems if they ever appear.

If git hook manager is installed correctly, we provide commit message linting controlled by commitlint configured by the rules of conventional commits specification.

You can trigger the linter to lint the packages directory manually by executing the lint script at the root of the project. Example of usage:

$ yarn lint # append `--fix` option to auto-fix the warnings

✔️ Testing

Unit testing is done by Jest and configured by ts-jest preset. The placement of unit tests is described in the Packages section.

Start the testing by executing the test script at the root of the project. Example of usage:

$ yarn test # append `--watchAll` option to start Jest in watch mode