See CONTRIBUTING.md
in the Capacitor repo for more general contribution guidelines.
-
Fork and clone this repo.
-
Install the monorepo dependencies.
npm install
-
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
Sometimes, it may be necessary to work on Capacitor in parellel with the plugin(s). In this case, a few extra steps are necessary:
-
Follow the Capacitor repo's local setup instructions.
-
Toggle each plugin to use your local copy of Capacitor.
npm install npm run toggle-local
💡 Remember not to commit unnecessary changes to
package.json
andpackage-lock.json
. -
Make sure your app is using local copies of the Capacitor plugin and Capacitor core.
cd my-app/ npm install ../path/to/capacitor-plugins/<plugin> npm install ../path/to/capacitor/core npm install ../path/to/capacitor/android npm install ../path/to/capacitor/ios
To aid in managing these plugins, this repo has a variety of scripts (located in scripts/
) that can be run with npm
.
This script is for setting the version (or version range) of Capacitor packages in each plugin's package.json
. It will also run lerna bootstrap
for you.
📝 Requires Capacitor to be cloned in a sibling directory.
This script is for switching between Capacitor packages from npm and Capacitor packages installed locally. It will also run lerna bootstrap
for you.
If you get npm errors, you can try installing from scratch:
Reset the changes in
package.json
files.Clear out all
node_modules
.npx lerna exec 'rm -fr package-lock.json && rm -fr node_modules' rm -fr node_modulesInstall with local dependencies:
npm run toggle-local
This script is for copying git changes from one plugin to all plugins.
To use:
- Make sure your staging area is clean, e.g.
git reset
- Stage the changes from (and only from) your package, e.g.
git add -p -- text-zoom/
- Run the script with
<package>
being the npm name of your package, e.g.npm run apply-patches @capacitor/text-zoom