From 5797d54117d7431c3d68251d30e34acb005cd53c Mon Sep 17 00:00:00 2001 From: sukanvisapearyoo Date: Thu, 11 Apr 2024 10:01:40 -0700 Subject: [PATCH 1/6] docs(contributing): changed the contributing file --- CONTRIBUTING.md | 163 ++++++++---------- examples/objectdetection/ios/Podfile.lock | 8 +- .../objectdetection.xcodeproj/project.pbxproj | 12 +- 3 files changed, 82 insertions(+), 101 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index be2f93e..5c963e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,122 +1,111 @@ # Contributing -Contributions are always welcome, no matter how large or small! +## Guidelines -We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md). +1. Have fun. +2. Don't waste anyone's time. -## Development workflow +## Get started -This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages: +1. Fork & clone the repository +2. Install dependencies + ``` + cd path/to/your/directory + git clone + cd package -- The library package in the root directory. -- An example app in the `example/` directory. + Dependcies for IOS and Andriod: -To get started with the project, run `yarn` in the root directory to install the required dependencies for each package: + IOS: + XCode + Node & Watchman using Homebrew. + - brew install node + - brew install watchman + Cocopod + - $ sudo gem install cocoapods. -```sh -yarn -``` - -> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development. - -The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make. - -It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app. - -If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/MediapipeExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-mediapipe`. - -To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-mediapipe` under `Android`. - -You can use various commands from the root directory to work with the project. - -To start the packager: - -```sh -yarn example start -``` + Andriod: + Android development environment. + Java Development Kit - Zulu using Homebrew. -To run the example app on Android: -```sh -yarn example android -``` + ``` -To run the example app on iOS: +Read the READMEs in [`android/`](android/README.md) and [`ios/`](ios/README.md) for a quick overview of the native development workflow. -```sh -yarn example ios -``` +> You can also open React Native Mediapipe in [a quick online editor (github1s)](https://github.com/cdiddy77/react-native-mediapipe) -Make sure your code passes TypeScript and ESLint. Run the following to verify: +### JS/TS -```sh -yarn typecheck -yarn lint -``` +1. Open the entire folder in Visual Studio Code +2. Start the metro bundler in the `example/` directory using `yarn start` +3. Run either the iOS `yarn ios` or Android `yarn andriod` project to test changes -To fix formatting errors, run the following: - -```sh -yarn lint --fix -``` +> Run `yarn check-js` to validate codestyle -Remember to add tests for your change if possible. Run the unit tests by: +### iOS -```sh -yarn test -``` +1. Open the `react-native-mediapipe/example/ios/MediapipeExample.xcworkspace` file with Xcode +2. Change signing configuration to your developer account +3. Select your device in the devices drop-down +4. Hit run -### Commit message convention +> Run `yarn check-ios` to validate codestyle -We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: +### Android -- `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`: changes into documentation, 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. +1. Open the `example/android/` folder with Android Studio +2. Start the metro bundler in the `example/` directory using `yarn start` +3. Select your device in the devices drop-down +4. Once your device is connected, make sure it can find the metro bundler's port: + ``` + adb reverse tcp:8081 tcp:8081 + ``` +6. Hit run -Our pre-commit hooks verify that your commit message matches this format when committing. +> Run `yarn check-android` to validate codestyle -### Linting and tests +### Docs -[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) +1. Edit the relevant file, it may be easiest to search for what you're editing to find the right file +2. Install all dependencies by running `yarn` inside the `docs` folder -We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. +> Run `yarn start` to generate the docs, you can then view them in your browser to confirm your changes -Our pre-commit hooks verify that the linter and tests pass when committing. +## Committing -### Publishing to npm +### Codestyle -We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc. +Great code produces great products. That's why we love to keep our codebases clean, and to achieve that, we use linters and formatters which output errors when something isn't formatted the way we like it to be. -To publish new versions, run the following: +Before pushing your changes, you can verify that everything is still correctly formatted by running all linters: -```sh -yarn release +``` +yarn check-all ``` -### Scripts - -The `package.json` file contains various scripts for common tasks: - -- `yarn`: setup project by installing dependencies. -- `yarn typecheck`: type-check files with TypeScript. -- `yarn lint`: lint files with ESLint. -- `yarn test`: run unit tests with Jest. -- `yarn example start`: start the Metro server for the example app. -- `yarn example android`: run the example app on Android. -- `yarn example ios`: run the example app on iOS. +This validates Swift, Kotlin, C++ and JS/TS code: + +```bash +$ yarn check-all + yarn run v1.22.10 + Formatting Swift code.. + Linting Swift code.. + Linting Kotlin code.. + Linting C++ code.. + Linting JS/TS code.. + All done! + ✨ Done in 8.05s. +``` -### Sending a pull request +### PR messages -> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github). +When creating a pull-request, make sure to use the [conventional changelog](https://github.com/conventional-changelog/conventional-changelog) format for it's title: -When you're sending a pull request: +* ✨ For new features or enhancements, use `feat`. Example: `feat: Support ultra-wide-angle cameras` +* 🐛 For bugfixes or build improvements, use `fix`. Example: `fix: Fix iOS 13 crash when switching cameras` +* 💨 For performance improvements, use `perf`. Example: `perf: Improve takePhoto() performance by re-using file-session` +* 🛠️ When upgrading dependencies, use `chore(deps)`. Example: `chore(deps): Upgrade react-native to 0.70` +* 📚 When changing anything in the documentation, use `docs`. Example: `docs: Fix typo in installation instructions` -- 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. +Pull-requests will be squash-committed, so no need to prefix your individual commits with the conventional changelog format as long as the commit messages are descriptive. \ No newline at end of file diff --git a/examples/objectdetection/ios/Podfile.lock b/examples/objectdetection/ios/Podfile.lock index b83e73c..ef0ae2d 100644 --- a/examples/objectdetection/ios/Podfile.lock +++ b/examples/objectdetection/ios/Podfile.lock @@ -1124,7 +1124,7 @@ PODS: - React-jsi (= 0.73.6) - React-logger (= 0.73.6) - React-perflogger (= 0.73.6) - - ReactNativeMediaPipe (0.1.0): + - ReactNativeMediaPipe (0.2.0): - glog - MediaPipeTasksVision (= 0.10.5) - RCT-Folly (= 2022.05.16.00) @@ -1406,11 +1406,11 @@ SPEC CHECKSUMS: React-runtimescheduler: 9636eee762c699ca7c85751a359101797e4c8b3b React-utils: d16c1d2251c088ad817996621947d0ac8167b46c ReactCommon: 2aa35648354bd4c4665b9a5084a7d37097b89c10 - ReactNativeMediaPipe: 094adc68f6cdcdbe1fd52a9917ca8fb4f5b0ef28 + ReactNativeMediaPipe: 92850eb7623b4bb0d6e8fe90c5e5781b42ccba00 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 VisionCamera: 6c8ca7d04fc62fafccd8f8ad584e96f5303671f5 - Yoga: 805bf71192903b20fc14babe48080582fee65a80 + Yoga: d17d2cc8105eed528474683b42e2ea310e1daf61 PODFILE CHECKSUM: 106c37d775a4ea3a9fa9744362f0af5ba16aac0e -COCOAPODS: 1.14.3 +COCOAPODS: 1.15.2 diff --git a/examples/objectdetection/ios/objectdetection.xcodeproj/project.pbxproj b/examples/objectdetection/ios/objectdetection.xcodeproj/project.pbxproj index 749986f..d844346 100644 --- a/examples/objectdetection/ios/objectdetection.xcodeproj/project.pbxproj +++ b/examples/objectdetection/ios/objectdetection.xcodeproj/project.pbxproj @@ -586,11 +586,7 @@ "-DFOLLY_USE_LIBCPP=1", "-DFOLLY_CFG_NO_COROUTINES=1", ); - OTHER_LDFLAGS = ( - "$(inherited)", - "-Wl", - "-ld_classic", - ); + OTHER_LDFLAGS = "$(inherited)"; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; USE_HERMES = true; @@ -658,11 +654,7 @@ "-DFOLLY_USE_LIBCPP=1", "-DFOLLY_CFG_NO_COROUTINES=1", ); - OTHER_LDFLAGS = ( - "$(inherited)", - "-Wl", - "-ld_classic", - ); + OTHER_LDFLAGS = "$(inherited)"; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; USE_HERMES = true; From 0873de7e3d4991ca6f8132c387b564a949a9accb Mon Sep 17 00:00:00 2001 From: sukanvisapearyoo Date: Sat, 13 Apr 2024 22:06:19 -0700 Subject: [PATCH 2/6] docs(contributing): update contribution file --- CONTRIBUTING.md | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5c963e6..2132526 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,24 +10,6 @@ 1. Fork & clone the repository 2. Install dependencies ``` - cd path/to/your/directory - git clone - cd package - - Dependcies for IOS and Andriod: - - IOS: - XCode - Node & Watchman using Homebrew. - - brew install node - - brew install watchman - Cocopod - - $ sudo gem install cocoapods. - - Andriod: - Android development environment. - Java Development Kit - Zulu using Homebrew. - ``` @@ -38,10 +20,9 @@ Read the READMEs in [`android/`](android/README.md) and [`ios/`](ios/README.md) ### JS/TS 1. Open the entire folder in Visual Studio Code -2. Start the metro bundler in the `example/` directory using `yarn start` -3. Run either the iOS `yarn ios` or Android `yarn andriod` project to test changes +2. Start the metro bundler in the `examples/objectdetection` directory using `yarn start` +3. Run either the iOS `yarn ios` or Android `yarn android` project to test changes -> Run `yarn check-js` to validate codestyle ### iOS @@ -50,11 +31,10 @@ Read the READMEs in [`android/`](android/README.md) and [`ios/`](ios/README.md) 3. Select your device in the devices drop-down 4. Hit run -> Run `yarn check-ios` to validate codestyle ### Android -1. Open the `example/android/` folder with Android Studio +1. Open the `examples/objectdetection/android` folder with Android Studio 2. Start the metro bundler in the `example/` directory using `yarn start` 3. Select your device in the devices drop-down 4. Once your device is connected, make sure it can find the metro bundler's port: @@ -63,12 +43,10 @@ Read the READMEs in [`android/`](android/README.md) and [`ios/`](ios/README.md) ``` 6. Hit run -> Run `yarn check-android` to validate codestyle - ### Docs 1. Edit the relevant file, it may be easiest to search for what you're editing to find the right file -2. Install all dependencies by running `yarn` inside the `docs` folder +2. Install all dependencies by running `yarn` inside the `docsite` folder > Run `yarn start` to generate the docs, you can then view them in your browser to confirm your changes @@ -81,7 +59,8 @@ Great code produces great products. That's why we love to keep our codebases cle Before pushing your changes, you can verify that everything is still correctly formatted by running all linters: ``` -yarn check-all +yarn typecheck +yarn lint ``` This validates Swift, Kotlin, C++ and JS/TS code: From 6250636b01b2da5c3dc5b26f519fa9a80844c0e5 Mon Sep 17 00:00:00 2001 From: sukanvisapearyoo Date: Fri, 19 Apr 2024 18:50:04 -0700 Subject: [PATCH 3/6] feat: modified the Get Started section --- CONTRIBUTING.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2132526..45e6868 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,6 +10,17 @@ 1. Fork & clone the repository 2. Install dependencies ``` + iOS: + XCode + Node & Watchman using Homebrew. + - brew install node + - brew install watchman + Cocopod + - $ sudo gem install cocoapods. + + Andriod: + Android development environment. + Java Development Kit - Zulu using Homebrew. ``` From e6911f0cbe68ccfab58fa5e8774d8cf7eed0e146 Mon Sep 17 00:00:00 2001 From: sukanvisapearyoo Date: Tue, 23 Apr 2024 11:07:56 -0700 Subject: [PATCH 4/6] chore: updated dependencies and iOS configurations --- CONTRIBUTING.md | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 45e6868..d364ed0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,20 +9,7 @@ 1. Fork & clone the repository 2. Install dependencies - ``` - iOS: - XCode - Node & Watchman using Homebrew. - - brew install node - - brew install watchman - Cocopod - - $ sudo gem install cocoapods. - - Andriod: - Android development environment. - Java Development Kit - Zulu using Homebrew. - ``` Read the READMEs in [`android/`](android/README.md) and [`ios/`](ios/README.md) for a quick overview of the native development workflow. @@ -37,7 +24,7 @@ Read the READMEs in [`android/`](android/README.md) and [`ios/`](ios/README.md) ### iOS -1. Open the `react-native-mediapipe/example/ios/MediapipeExample.xcworkspace` file with Xcode +1. Open the `react-native-mediapipe/examples/ios/MediapipeExample.xcworkspace` file with Xcode 2. Change signing configuration to your developer account 3. Select your device in the devices drop-down 4. Hit run From 6142af0ee829eeb7a91026ccab68d2ef978d0de7 Mon Sep 17 00:00:00 2001 From: sukanvisapearyoo Date: Tue, 23 Apr 2024 20:20:42 -0700 Subject: [PATCH 5/6] chore: updated iOS path --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d364ed0..a589a54 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ Read the READMEs in [`android/`](android/README.md) and [`ios/`](ios/README.md) ### iOS -1. Open the `react-native-mediapipe/examples/ios/MediapipeExample.xcworkspace` file with Xcode +1. Open the `react-native-mediapipe/examples/ios/objectdetection.xcworkspace` file with Xcode 2. Change signing configuration to your developer account 3. Select your device in the devices drop-down 4. Hit run From 239b707c5e6090ec616f6bb7ff6edfcbd5e18bce Mon Sep 17 00:00:00 2001 From: sukanvisapearyoo Date: Tue, 23 Apr 2024 20:26:16 -0700 Subject: [PATCH 6/6] chore: updated iOS path. making sure ios file is in the right path way --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a589a54..44c83ae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ Read the READMEs in [`android/`](android/README.md) and [`ios/`](ios/README.md) ### iOS -1. Open the `react-native-mediapipe/examples/ios/objectdetection.xcworkspace` file with Xcode +1. Open the `react-native-mediapipe/examples/objectdetection/ios/objectdetection.xcworkspace` file with Xcode 2. Change signing configuration to your developer account 3. Select your device in the devices drop-down 4. Hit run