| title | Contributing |
|---|---|
| hide_title | true |
WatermelonDB is an open-source project and it needs your help to thrive!
If there's a missing feature, a bug, or other improvement you'd like, we encourage you to contribute! Feel free to open an issue to get some guidance and see Contributing guide for details about project setup, testing, etc.
If you're just getting started, see good first issues that are easy to contribute to. If you make a non-trivial contribution, email me, and I'll send you a nice 🍉 sticker!
If you make or are considering making an app using WatermelonDB, please let us know!
-
Did you add or changed some functionality?
Add (or modify) tests!
-
Check if the automated tests pass
yarn ci:check
-
Format the files you changed
yarn prettier
-
Mark your changes in CHANGELOG
Put a one-line description of your change under Added/Changed section. See Keep a Changelog.
git clone https://github.com/Nozbe/WatermelonDB.git
cd WatermelonDB
yarnTo work on Watermelon code in the sandbox of your app:
yarn devThis will create a dev/ folder in Watermelon and observe changes to source files (only JavaScript files) and recompile them as needed.
Then in your app:
cd node_modules/@nozbe
rm -fr watermelondb
ln -s path-to-watermelondb/dev watermelondbThis will work in Webpack but not in Metro (React Native). Metro doesn't follow symlinks. Instead, you can compile WatermelonDB directly to your project:
DEV_PATH="/path/to/your/app/node_modules/@nozbe/watermelondb" yarn devThis runs Jest, ESLint and Flow:
yarn ci:checkYou can also run them separately:
yarn test
yarn eslint
yarn flowWe recommend VS Code with ESLint, Flow, and Prettier (with prettier-eslint enabled) plugins for best development experience. (To see lint/type issues inline + have automatic reformatting of code)
In native/ios and native/android you'll find the native bridge code for React Native.
It's recommended to use the latest stable version of Xcode / Android Studio to work on that code.
If you change native bridge code or adapter/sqlite code, it's recommended to run integration tests that run the entire Watermelon code with SQLite and React Native in the loop:
yarn test:ios
yarn test:android- For iOS open the
native/iosTest/WatermelonTester.xcworkspaceproject and hit Cmd+U. - For Android open
native/androidTestin AndroidStudio navigate toapp/src/androidTest/java/com.nozbe.watermelonTest/BridgeTestand click green arrow nearclass BridgeTest
Make sure the native code you're editing conforms to Watermelon standards:
yarn swiftlint
yarn ktlint- If
test:iosfails in terminal:
- Run tests in Xcode first before running from terminal
- Make sure you have the right version of Xcode CLI tools set in Preferences -> Locations
- Make sure you're on the most recent stable version of Xcode / Android Studio
- Remove native caches:
- Xcode:
~/Library/Developer/Xcode/DerivedData: - Android:
.gradleandbuildfolders innative/androidandnative/androidTest node_modules(because of React Native precompiled third party libraries)
