Skip to content

Commit 49c21fb

Browse files
authored
Merge pull request #1 from callstackincubator/kh/yarn-to-npm
Migrating from Yarn to NPM
2 parents 5069876 + 00ca3fd commit 49c21fb

7 files changed

Lines changed: 7259 additions & 19518 deletions

File tree

.yarnrc.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,46 @@ We want this community to be friendly and respectful to each other. Please follo
66

77
## Development workflow
88

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:
1010

1111
- A library for loading and hosting Node-API addons in RN: `packages/react-native-node-api-host`.
1212
- The CLI package in the `packages/react-native-node-api-cli`.
1313
- A react-native-test-app in the `apps/example-rnta/` directory.
1414
- An example Node-API addon written in C++ in the `packages/example-cpp-node-api-addon` directory.
1515
- And exmaple Node-API addon written in Rust in the `packages/example-rust-node-api-addon` directory.
1616

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:
1818

1919
```sh
20-
yarn
20+
npm install
2121
```
2222

23-
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
24-
2523
The [example app](/apps/example-rnta/) demonstrates usage of the library. You need to run it to test any changes you make.
2624

2725
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.
2826

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`.
3028

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`.
3230

3331
You can use various commands from the root directory to work with the project.
3432

3533
To start the packager:
3634

3735
```sh
38-
yarn example start
36+
npm run example start
3937
```
4038

4139
To run the example app on Android:
4240

4341
```sh
44-
yarn example android
42+
npm run example android
4543
```
4644

4745
To run the example app on iOS:
4846

4947
```sh
50-
yarn example ios
48+
npm run example ios
5149
```
5250

5351
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.
6159
Make sure your code passes TypeScript and ESLint. Run the following to verify:
6260

6361
```sh
64-
yarn typecheck
65-
yarn lint
62+
npm run typecheck
63+
npm run lint
6664
```
6765

6866
To fix formatting errors, run the following:
6967

7068
```sh
71-
yarn lint --fix
69+
npm run lint --fix
7270
```
7371

7472
Remember to add tests for your change if possible. Run the unit tests by:
7573

7674
```sh
77-
yarn test
75+
npm test
7876
```
7977

8078
### Commit message convention
@@ -85,7 +83,7 @@ We follow the [conventional commits specification](https://www.conventionalcommi
8583
- `feat`: new features, e.g. add new method to the module.
8684
- `refactor`: code refactor, e.g. migrate from class components to hooks.
8785
- `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.
8987
- `chore`: tooling changes, e.g. change CI config.
9088

9189
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
105103
To publish new versions, run the following:
106104

107105
```sh
108-
yarn release
106+
npm run release
109107
```
110108

111109
### Scripts
112110

113111
The `package.json` file contains various scripts for common tasks:
114112

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.
122119

123120
### Sending a pull request
124121

apps/example-rnta/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"@react-native-community/cli-platform-android": "^15.0.0",
2626
"@react-native-community/cli-platform-ios": "^15.0.0",
2727
"@react-native/babel-preset": "^0.76.0",
28-
"@react-native/eslint-config": "0.76.7",
2928
"@react-native/metro-config": "^0.76.0",
3029
"@react-native/typescript-config": "0.76.7",
3130
"@rnx-kit/metro-config": "^2.0.0",

0 commit comments

Comments
 (0)