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
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+17-49Lines changed: 17 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,19 +11,21 @@ This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/f
11
11
- The library package in the root directory.
12
12
- An example app in the `example/` directory.
13
13
14
-
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
14
+
To get started with the project, make sure you have the correct version of [Node.js](https://nodejs.org/) installed. See the [`.nvmrc`](./.nvmrc) file for the version used in this project.
15
+
16
+
Run `yarn` in the root directory to install the required dependencies for each package:
15
17
16
18
```sh
17
19
yarn
18
20
```
19
21
20
-
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
22
+
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development without manually migrating.
21
23
22
24
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
23
25
24
26
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.
25
27
26
-
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/ScreenshotAwareExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-screenshot-aware`.
28
+
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/ScreenshotAwareExample.xcworkspace` in Xcode and find the source files at `Pods > Development Pods > react-native-screenshot-aware`.
27
29
28
30
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-screenshot-aware` under `Android`.
29
31
@@ -47,29 +49,6 @@ To run the example app on iOS:
47
49
yarn example ios
48
50
```
49
51
50
-
By default, the example is configured to build with the old architecture. To run the example with the new architecture, you can do the following:
51
-
52
-
1. For Android, run:
53
-
54
-
```sh
55
-
ORG_GRADLE_PROJECT_newArchEnabled=true yarn example android
56
-
```
57
-
58
-
2. For iOS, run:
59
-
60
-
```sh
61
-
cd example/ios
62
-
RCT_NEW_ARCH_ENABLED=1 pod install
63
-
cd -
64
-
yarn example ios
65
-
```
66
-
67
-
If you are building for a different architecture than your previous build, make sure to remove the build folders first. You can run the following command to cleanup all build folders:
68
-
69
-
```sh
70
-
yarn clean
71
-
```
72
-
73
52
To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:
74
53
75
54
```sh
@@ -78,7 +57,13 @@ Running "ScreenshotAwareExample" with {"fabric":true,"initialProps":{"concurrent
78
57
79
58
Note the `"fabric":true` and `"concurrentRoot":true` properties.
80
59
81
-
Make sure your code passes Biome. Run the following to verify:
60
+
Make sure your code passes TypeScript:
61
+
62
+
```sh
63
+
yarn typecheck
64
+
```
65
+
66
+
To check for linting errors, run the following:
82
67
83
68
```sh
84
69
yarn lint
@@ -87,7 +72,7 @@ yarn lint
87
72
To fix formatting errors, run the following:
88
73
89
74
```sh
90
-
yarn lint:fix
75
+
yarn lint --fix
91
76
```
92
77
93
78
Remember to add tests for your change if possible. Run the unit tests by:
@@ -96,33 +81,16 @@ Remember to add tests for your change if possible. Run the unit tests by:
96
81
yarn test
97
82
```
98
83
99
-
### Commit message convention
100
-
101
-
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
102
-
103
-
-`fix`: bug fixes, e.g. fix crash due to deprecated method.
104
-
-`feat`: new features, e.g. add new method to the module.
105
-
-`refactor`: code refactor, e.g. migrate from class components to hooks.
106
-
-`docs`: changes into documentation, e.g. add usage example for the module..
107
-
-`test`: adding or updating tests, e.g. add integration tests using detox.
108
-
-`chore`: tooling changes, e.g. change CI config.
109
-
110
-
Our pre-commit hooks verify that your commit message matches this format when committing.
111
-
112
-
### Linting and tests
113
-
114
-
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [Biome](https://biomejs.dev/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
115
84
116
-
Our pre-commit hooks verify that the linter and tests pass when committing.
117
85
118
86
### Scripts
119
87
120
88
The `package.json` file contains various scripts for common tasks:
121
89
122
90
-`yarn`: setup project by installing dependencies.
123
-
-`yarn lint`: lint files with Biome.
124
-
-`yarn lint:fix`: lint fix files with Biome.
125
-
-`yarn test`: run unit tests with Jest.
91
+
-`yarn typecheck`: type-check files with TypeScript.
92
+
-`yarn lint`: lint files with [ESLint](https://eslint.org/).
93
+
-`yarn test`: run unit tests with [Jest](https://jestjs.io/).
126
94
-`yarn example start`: start the Metro server for the example app.
127
95
-`yarn example android`: run the example app on Android.
128
96
-`yarn example ios`: run the example app on iOS.
@@ -137,4 +105,4 @@ When you're sending a pull request:
137
105
- Verify that linters and tests are passing.
138
106
- Review the documentation to make sure it looks good.
139
107
- Follow the pull request template when opening a pull request.
140
-
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
108
+
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
0 commit comments