Skip to main content

Contributing

This project is a monorepo managed using Yarn workspaces. It contains the following packages:

  • An example app in the apps/sample-app/ directory.
  • The core library in the packages/core/ directory.
  • Provider packages in the packages/*/ directories.

To get started with the project, run the following command in the root directory to install the required dependencies for each package:

yarn install

Since the project relies on Yarn workspaces, you cannot use npm for development.

Sample App

The Sample App demonstrates usage of the library. To run the application, follow the instructions here.

Linting

We use TypeScript for type checking, and ESLint with Prettier for linting and formatting the code.

Make sure your code passes TypeScript and ESLint. Run the following to verify:

yarn lint
yarn typecheck

To fix formatting errors, run the following:

yarn lint --fix

Creating a new plugin

You can create a new plugin by following the existing plugin structure:

All providers should inherit the IStorageClient from the @openmobilehub/storage-core, to ensure consistency across different providers.

Writing documentation

Documentation is located under the /docs directory. We use Docusaurus to generate the documentation website, and docusaurus-plugin-typedoc to generate API documentation from TypeScript docstrings. The API documentation is built automatically with GitHub Actions and published on GitHub Pages upon merging to the main branch with this workflow file.

Remember to document your code according to the JSDoc reference and to manually write proper Markdown documentation when needed in the /docs/docs/ directory.

To run the documentation locally, from the root directory, run the following command:

yarn docs start

Publishing to npm

To publish a new version to npm, we use lerna. Packages are published automatically after merging a commit that contains a version bump.

  1. Run yarn create-release
  2. After merging the PR with the version bump, the package will be released automatically, and a corresponding git tag and release will be created by the GitHub Actions workflow.

Commit message convention

We follow the conventional commits specification for our commit messages:

  • fix: Bug fixes, e.g. fix crash due to deprecated method.
  • feat: New features, e.g. add new method to the module.
  • refactor: Code refactor, e.g. migrate from class components to hooks.
  • docs: Documentation changes, e.g. add usage example for the module.
  • test: Adding or updating tests, e.g. add integration tests using Detox.
  • chore: Tooling changes, e.g. change CI config.

Our pre-commit hooks verify that your commit message matches this format when committing.

Sending a pull request

Working on your first pull request? You can learn how from this free series: How to Contribute to an Open Source Project on GitHub.

When you're sending a pull request:

  • Prefer small pull requests focused on one change.
  • Verify that linters and tests are passing.
  • Review the documentation to make sure it looks good.
  • Follow the pull request template when opening a pull request.
  • For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.