Skip to content

Latest commit

 

History

History
115 lines (76 loc) · 5.17 KB

CONTRIBUTING.md

File metadata and controls

115 lines (76 loc) · 5.17 KB

Contributing to Capacitor

This guide provides instructions for contributing to Capacitor through issues & discussions and code.

Issues & Discussions

The Capacitor repo uses GitHub issues and discussions to track bugs and feature requests, as well as to provide a place for community questions, ideas, and discussions.

  • When to use issues:
  • When to use discussions:
    • To ask for help.
    • To ask general questions.
    • To show off cool stuff.
    • To propose ideas for improvement.
    • If you think you found a bug, but may need help to further uncover it.
    • Anything else! 🌈

Creating a Code Reproduction

When reporting bugs, we ask you to provide a minimal sample application that demonstrates the issue. Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

To create a code reproduction:

  • Create a new application using npm init @capacitor/app (or ionic start --capacitor).
  • Add the minimum amount of code necessary to recreate the issue you're experiencing.
  • Push the code reproduction to a public GitHub repository and include a link when you create a bug report.
  • Be sure to include steps to reproduce the issue.

Developing Capacitor

Repositories

Design Philosophy

Before working on Capacitor, it's important to understand the philosophy behind the project to avoid investing time in things that won't fit into the goals of the project.

Please read @maxlynch's essay How Capacitor Works for a deep dive into the project and its goals.

Consult with the team

For any large changes, make sure you've consulted with the team first. You can open a discussion to bring up your idea.

About Third Party Libraries

To achieve Capacitor's goal of being stable and easy to upgrade, we would like to avoid unnecessary third party libraries as much as possible. Before embarking on Capacitor contributions, make sure you aren't planning on introducing third party libraries without consulting with the team first.

On native, that means avoid adding any new Cocoapod or Gradle dependencies without explicit approval. If you just need a small bit of functionality from that library, consider adding an implementation to the codebase directly.

On web, this means do not add any third party libraries such as Firebase or Lodash. Strive for implementations that use pure Web APIs even if it means more work.

Local Setup

  1. Fork and clone the repo.

  2. Install the monorepo dependencies.

    npm install
  3. Install SwiftLint if you're on macOS. Contributions to iOS code will be linted in CI if you don't have macOS.

    brew install swiftlint
  4. Install package dependencies. Lerna can automatically install each package's dependencies.

    npx lerna bootstrap

Branches

  • main: Latest Capacitor development branch
  • 2.x: Capacitor 2 (bug and security fixes only)
  • 1.x: Capacitor 1 (not maintained)

Directory Structure

This monorepo contains core Capacitor components. The current directory structure looks like this:

  • cli: Capacitor CLI/Build scripts
  • core: Capacitor Core JS library
  • ios: Capacitor iOS Runtime
  • ios-template: Default iOS App installed by the CLI
  • android: Capacitor Android Runtime
  • android-template: Default Android App installed by the CLI

Publishing Capacitor

Capacitor packages are published using Lerna with fixed versioning.

During Capacitor 3 development, the following workflow is used to create dev releases:

  1. Create the next development version. The following command will:

    • Create a release commit with a generated changelog
    • Create a git tag
    • Push to the main branch
    • Create a GitHub release

    npx lerna version prerelease --force-publish
    
  2. Wait for CI to publish the new tagged version.