You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:
37
+
-`compileSdkVersion = 35`
38
+
-`targetSdkVersion = 35` in `example`
39
+
-`minSdkVersion = 24`
40
+
-`buildToolsVersion = 35.0.0`
41
+
-`ndkVersion = 27.1.12297006`
8
42
9
-
- The library package in the root directory.
10
-
- An example app in the `example/` directory.
43
+
### Verify toolchain
11
44
12
-
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
45
+
Run these once after installation:
13
46
14
47
```sh
15
-
yarn
48
+
node -v
49
+
yarn -v
50
+
java -version
51
+
ruby -v
52
+
bundle -v
16
53
```
17
54
18
-
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
55
+
For CocoaPods (after Bundler is installed):
19
56
20
-
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
57
+
```sh
58
+
cd example
59
+
bundle exec pod --version
60
+
cd ..
61
+
```
62
+
63
+
> Do not use npm for this repository. It depends on Yarn workspaces.
21
64
22
-
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.
65
+
## First-time setup
23
66
24
-
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/MoyasarSdkExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-moyasar-sdk`.
67
+
1. Clone the repository and move into it.
68
+
2. Ensure Node.js `v20.19.0` is active.
69
+
3. Install JavaScript dependencies from the repo root.
25
70
26
-
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-moyasar-sdk` under `Android`.
71
+
```sh
72
+
yarn install
73
+
```
27
74
28
-
You can use various commands from the root directory to work with the project.
75
+
### iOS setup (macOS only)
29
76
30
-
To start the packager:
77
+
Install Ruby gems and pods from `example`:
78
+
79
+
```sh
80
+
cd example
81
+
bundle install
82
+
bundle exec pod install --project-directory=ios
83
+
cd ..
84
+
```
85
+
86
+
Notes:
87
+
88
+
-`example/react-native.config.js` enables automatic pods installation for some flows, but `bundle exec pod install --project-directory=ios` is still the reliable manual step for first-time setup and pod changes.
89
+
- Open the workspace file (not the project file) when using Xcode:
90
+
-`example/ios/MoyasarSdkExample.xcworkspace`
91
+
92
+
### Android setup
93
+
94
+
Install Android SDK components required by the project:
95
+
96
+
1. Android SDK Platform 35
97
+
2. Android SDK Build-Tools 35.0.0
98
+
3. Android NDK 27.1.12297006
99
+
100
+
Set your SDK path for Gradle if needed:
101
+
102
+
- File: `example/android/local.properties`
103
+
- Example value:
104
+
105
+
```properties
106
+
sdk.dir=/Users/<your-user>/Library/Android/sdk
107
+
```
108
+
109
+
Also ensure `JAVA_HOME` points to JDK 17.
110
+
111
+
## Run the project
112
+
113
+
Run commands from the repository root.
114
+
115
+
1. Start Metro in terminal 1:
31
116
32
117
```sh
33
118
yarn example start
34
119
```
35
120
36
-
To run the example app on Android:
121
+
2. Start one platform in terminal 2:
122
+
123
+
Android:
37
124
38
125
```sh
39
126
yarn example android
40
127
```
41
128
42
-
To run the example app on iOS:
129
+
iOS:
43
130
44
131
```sh
45
132
yarn example ios
46
133
```
47
134
48
-
To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:
135
+
### Build-only commands
136
+
137
+
Use these when you want explicit platform build commands:
49
138
50
139
```sh
51
-
Running "MoyasarSdkExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
140
+
yarn example build:android
141
+
yarn example build:ios
52
142
```
53
143
54
-
Note the `"fabric":true` and `"concurrentRoot":true` properties.
144
+
### Verify New Architecture is active
55
145
56
-
Make sure your code passes TypeScript and ESLint. Run the following to verify:
146
+
In Metro logs, confirm a line similar to:
57
147
58
-
```sh
59
-
yarn typecheck
60
-
yarn lint
148
+
```text
149
+
Running "MoyasarSdkExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
61
150
```
62
151
63
-
To fix formatting errors, run the following:
152
+
`"fabric":true` and `"concurrentRoot":true` indicate New Architecture is running.
153
+
154
+
## Development workflow
155
+
156
+
- JavaScript and TypeScript changes usually reflect via Fast Refresh.
157
+
- Native Android/iOS changes require rebuilding the app.
158
+
- The example app is the primary place to validate your local library changes.
159
+
160
+
Native IDE entry points:
161
+
162
+
- Android Studio: open `example/android`.
163
+
- Xcode: open `example/ios/MoyasarSdkExample.xcworkspace`.
164
+
165
+
## Quality checks before opening a PR
166
+
167
+
Run all checks from the repository root:
64
168
65
169
```sh
66
-
yarn lint --fix
170
+
yarn lint
171
+
yarn typecheck
172
+
yarn test
173
+
yarn prepare
67
174
```
68
175
69
-
Remember to add tests for your change if possible. Run the unit tests by:
176
+
To auto-fix lint formatting where possible:
70
177
71
178
```sh
72
-
yarn test
179
+
yarn lint --fix
73
180
```
74
181
75
-
###Commit message convention
182
+
## Commit message convention
76
183
77
-
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
184
+
This repository follows [Conventional Commits](https://www.conventionalcommits.org/en).
78
185
79
186
-`fix`: bug fixes, e.g. fix crash due to deprecated method.
80
187
-`feat`: new features, e.g. add new method to the module.
81
188
-`refactor`: code refactor, e.g. migrate from class components to hooks.
82
-
-`docs`: changes into documentation, e.g. add usage example for the module..
189
+
-`docs`: changes into documentation, e.g. add usage example for the module.
83
190
-`test`: adding or updating tests, e.g. add integration tests using detox.
84
191
-`chore`: tooling changes, e.g. change CI config.
85
192
86
-
Our pre-commit hooks verify that your commit message matches this format when committing.
193
+
Commit hooks are configured through `lefthook.yml`.
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.
199
+
Symptom:
93
200
94
-
Our pre-commit hooks verify that the linter and tests pass when committing.
201
+
- Xcode build fails with sandbox or pods manifest mismatch.
202
+
203
+
Fix:
204
+
205
+
```sh
206
+
cd example
207
+
bundle install
208
+
bundle exec pod install --project-directory=ios
209
+
cd ..
210
+
```
211
+
212
+
If you use a custom Node installation manager and Xcode cannot find Node:
213
+
214
+
- Update `example/ios/.xcode.env.local` so `NODE_BINARY` points to your current `node` binary.
215
+
216
+
### Android SDK path errors
217
+
218
+
Symptom:
219
+
220
+
- Gradle cannot find Android SDK.
95
221
96
-
### Publishing to npm
222
+
Fix:
97
223
98
-
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.
224
+
- Ensure `example/android/local.properties` exists and `sdk.dir` points to your SDK.
225
+
- Ensure required SDK/NDK versions are installed.
99
226
100
-
To publish new versions, run the following:
227
+
### Java errors (`JAVA_HOME` invalid or missing)
228
+
229
+
Symptom:
230
+
231
+
- Gradle reports no Java runtime or invalid `JAVA_HOME`.
232
+
233
+
Fix:
234
+
235
+
- Install JDK 17.
236
+
- Set `JAVA_HOME` to that installation.
237
+
- Re-open your terminal and retry.
238
+
239
+
### Clean re-install when local environment drifts
101
240
102
241
```sh
103
-
yarn release
242
+
rm -rf node_modules example/node_modules
243
+
yarn install
244
+
cd example
245
+
bundle install
246
+
bundle exec pod install --project-directory=ios
247
+
cd ..
104
248
```
105
249
250
+
## Sending a pull request
251
+
252
+
Before opening your PR:
253
+
254
+
1. Keep PRs focused on one logical change.
255
+
2. Ensure lint, typecheck, tests, and build preparation pass.
256
+
3. Update docs/tests when behavior changes.
257
+
4. Use Conventional Commits.
258
+
5. If changing public API or major behavior, open an issue or discuss with maintainers first.
259
+
260
+
## Publishing to npm (maintainers)
261
+
262
+
Create a Github release with a version tag vX.X.X (e.g. v0.12.0) and the CD pipeline will handle the rest.
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.
269
+
270
+
Our pre-commit hooks verify that the linter and tests pass when committing.
271
+
106
272
### Scripts
107
273
108
274
The `package.json` file contains various scripts for common tasks:
@@ -114,12 +280,3 @@ The `package.json` file contains various scripts for common tasks:
114
280
-`yarn example start`: start the Metro server for the example app.
115
281
-`yarn example android`: run the example app on Android.
116
282
-`yarn example ios`: run the example app on iOS.
117
-
118
-
### Sending a pull request
119
-
120
-
When you're sending a pull request:
121
-
122
-
- Prefer small pull requests focused on one change.
123
-
- Verify that linters and tests are passing.
124
-
- Review the documentation to make sure it looks good.
125
-
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
0 commit comments