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
+20-23Lines changed: 20 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,48 +6,46 @@ We want this community to be friendly and respectful to each other. Please follo
6
6
7
7
## Development workflow
8
8
9
-
This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:
9
+
This project is a monorepo managed using [NPM workspaces](https://docs.npmjs.com/cli/v11/using-npm/workspaces). It contains the following packages:
10
10
11
11
- A library for loading and hosting Node-API addons in RN: `packages/react-native-node-api-host`.
12
12
- The CLI package in the `packages/react-native-node-api-cli`.
13
13
- A react-native-test-app in the `apps/example-rnta/` directory.
14
14
- An example Node-API addon written in C++ in the `packages/example-cpp-node-api-addon` directory.
15
15
- And exmaple Node-API addon written in Rust in the `packages/example-rust-node-api-addon` directory.
16
16
17
-
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
17
+
To get started with the project, run `npm install` in the root directory to install the required dependencies for each package:
18
18
19
19
```sh
20
-
yarn
20
+
npm install
21
21
```
22
22
23
-
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
24
-
25
23
The [example app](/apps/example-rnta/) demonstrates usage of the library. You need to run it to test any changes you make.
26
24
27
25
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.
28
26
29
-
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/NodeApiHostExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-node-api-host`.
27
+
If you want to use Android Studio or XCode to edit the native code, you can open the `example-rnta/android` or `example-rnta/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example-rnta/ios/NodeApiHostExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-node-api-host`.
30
28
31
-
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-node-api-host` under `Android`.
29
+
To edit the Java or Kotlin files, open `example-rnta/android` in Android studio and find the source files at `react-native-node-api-host` under `Android`.
32
30
33
31
You can use various commands from the root directory to work with the project.
34
32
35
33
To start the packager:
36
34
37
35
```sh
38
-
yarn example start
36
+
npm run example start
39
37
```
40
38
41
39
To run the example app on Android:
42
40
43
41
```sh
44
-
yarn example android
42
+
npm run example android
45
43
```
46
44
47
45
To run the example app on iOS:
48
46
49
47
```sh
50
-
yarn example ios
48
+
npm run example ios
51
49
```
52
50
53
51
To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:
@@ -61,20 +59,20 @@ Note the `"fabric":true` and `"concurrentRoot":true` properties.
61
59
Make sure your code passes TypeScript and ESLint. Run the following to verify:
62
60
63
61
```sh
64
-
yarn typecheck
65
-
yarn lint
62
+
npm run typecheck
63
+
npm run lint
66
64
```
67
65
68
66
To fix formatting errors, run the following:
69
67
70
68
```sh
71
-
yarn lint --fix
69
+
npm run lint --fix
72
70
```
73
71
74
72
Remember to add tests for your change if possible. Run the unit tests by:
75
73
76
74
```sh
77
-
yarntest
75
+
npmtest
78
76
```
79
77
80
78
### Commit message convention
@@ -85,7 +83,7 @@ We follow the [conventional commits specification](https://www.conventionalcommi
85
83
-`feat`: new features, e.g. add new method to the module.
86
84
-`refactor`: code refactor, e.g. migrate from class components to hooks.
87
85
-`docs`: changes into documentation, e.g. add usage example for the module..
88
-
-`test`: adding or updating tests, e.g. add integration tests using detox.
86
+
-`test`: adding or updating tests.
89
87
-`chore`: tooling changes, e.g. change CI config.
90
88
91
89
Our pre-commit hooks verify that your commit message matches this format when committing.
@@ -105,20 +103,19 @@ We use [release-it](https://github.com/release-it/release-it) to make it easier
105
103
To publish new versions, run the following:
106
104
107
105
```sh
108
-
yarn release
106
+
npm run release
109
107
```
110
108
111
109
### Scripts
112
110
113
111
The `package.json` file contains various scripts for common tasks:
114
112
115
-
-`yarn`: setup project by installing dependencies.
116
-
-`yarn typecheck`: type-check files with TypeScript.
117
-
-`yarn lint`: lint files with ESLint.
118
-
-`yarn test`: run unit tests with Jest.
119
-
-`yarn example start`: start the Metro server for the example app.
120
-
-`yarn example android`: run the example app on Android.
121
-
-`yarn example ios`: run the example app on iOS.
113
+
-`npm install`: setup project by installing dependencies.
114
+
-`npm run typecheck`: type-check files with TypeScript.
115
+
-`npm run lint`: lint files with ESLint.
116
+
-`npm run example start`: start the Metro server for the example app.
117
+
-`npm run example android`: run the example app on Android.
118
+
-`npm run example ios`: run the example app on iOS.
0 commit comments