This guide attempts to make it easy for volunteer contributors and the core team to contribute to and publish Capacitor. Please let us know if there's something missing!
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.
For any large changes, make sure you've consulted with the team first. One way to do this would be to create a draft PR for discussion, or bringing up the discussion in the Capacitor slack.
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.
The ionic-team/capacitor
repo is a monorepo containing all of the standard Capacitor components. The current directory structure looks like this:
app-template
: The default app template used duringcreate
cli
: Capacitor CLI/Build scriptscore
: Capacitor Core JS libraryios
: Capacitor iOS Runtimeios-template
: Default iOS App installed by the CLIandroid
: Capacitor Android Runtimeandroid-template
: Default Android App installed by the CLIexample
: Example project for developmente2e
: An end-to-end testing appplugin-template
: The default plugin template when creating a new pluginscripts
: deploy and task scriptssite
: Website and documentation
- Check out this repository.
- Read and follow
example/README.md
The publish
npm task runs lerna to update and publish JS dependencies, and then uses that version number to deploy the Android and iOS runtimes.
Additionally, it updates the master branch of the capacitor-starter mirror, which contains an exported starter project for easy project creation, based on the code in the starter
folder in this monorepo.
Before deploying, you must set the following environment variables:
BINTRAY_USER
: your username from bintray.comBINTRAY_KEY
: your API key from Bintray, found in the "Edit Profile" section of the site.
Finally, to deploy Capacitor, in the root of the project run
npm run publish
Note: if you don't have any JS updates that cause lerna to increment the version, just increment it yourself in lerna.json
and you're golden.