Skip to content

Commit 520cba1

Browse files
authored
Rename packages (#116)
* Rename cmake package * Update references to "react-native-node-api-cmake" * Rename "react-native-node-api-modules" to "react-native-node-api" * Rename "react-native-node-api-modules" to "react-native-node-api" and move it to "packages/host" * Rename "react-native-node-addon-examples" to "@react-native-node-api/node-addon-examples" * Rename root package
1 parent 4e7d6f7 commit 520cba1

File tree

90 files changed

+306
-251
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+306
-251
lines changed

.github/workflows/check.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
node-version: lts/jod
2929
- run: npm ci
3030
- run: npm run build
31-
- run: npm test --workspace gyp-to-cmake --workspace react-native-node-api-cmake --workspace react-native-node-api-modules
31+
- run: npm test --workspace gyp-to-cmake --workspace cmake-rn --workspace react-native-node-api
3232
test-windows:
3333
name: Run tests on Windows
3434
runs-on: windows-latest
@@ -39,7 +39,7 @@ jobs:
3939
node-version: lts/jod
4040
- run: npm ci
4141
- run: npm run build
42-
- run: npm test --workspace gyp-to-cmake --workspace react-native-node-api-cmake --workspace react-native-node-api-modules
42+
- run: npm test --workspace gyp-to-cmake --workspace cmake-rn --workspace react-native-node-api
4343

4444
test-macos:
4545
name: Run tests which requires MacOS
@@ -56,11 +56,11 @@ jobs:
5656
distribution: "temurin"
5757
- name: Setup Android SDK
5858
uses: android-actions/setup-android@v3
59-
# Version here should match the one in React Native template and packages/react-native-node-api-cmake/src/cli.ts
59+
# Version here should match the one in React Native template and packages/cmake-rn/src/cli.ts
6060
- run: sdkmanager --install "ndk;27.1.12297006"
6161
- run: npm ci
6262
- run: npm run build
63-
- run: npm run copy-node-api-headers --workspace react-native-node-api-modules
64-
- run: npm run build-weak-node-api --workspace react-native-node-api-modules
65-
- run: npm run generate-weak-node-api-injector --workspace react-native-node-api-modules
66-
- run: npm test --workspace react-native-node-addon-examples
63+
- run: npm run copy-node-api-headers --workspace react-native-node-api
64+
- run: npm run build-weak-node-api --workspace react-native-node-api
65+
- run: npm run generate-weak-node-api-injector --workspace react-native-node-api
66+
- run: npm test --workspace @react-native-node-api/node-addon-examples

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<p align="center">
32
<img src="./docs/logo.svg" width="20%" />
43
</p>
@@ -32,7 +31,7 @@ See the document on ["how it works"](./docs/HOW_IT_WORKS.md) for a detailed desc
3231

3332
This mono-repository hosts the development of a few packages:
3433

35-
### `packages/react-native-node-api-modules`
34+
### `packages/react-native-node-api`
3635

3736
Responsible for adding Node-API support to your React Native application:
3837

@@ -49,19 +48,19 @@ Responsible for adding Node-API support to your React Native application:
4948

5049
Note: We'll sometimes refer to this as the "host package", as it can be seen as a host of Node-API modules in React Native apps.
5150

52-
### `packages/react-native-node-api-cmake`
51+
### `packages/cmake-rn`
5352

5453
A wrapper around CMake making it easier to produce [prebuilt binaries](./docs/PREBUILDS.md) targeting iOS and Android matching the [the prebuilt binary specification](./docs/PREBUILDS.md).
5554

5655
Serves the same purpose as `cmake-js` does for the Node.js community and could potentially be upstreamed into `cmake-js` eventually.
5756

5857
### `packages/gyp-to-cmake`
5958

60-
A tool to transform `binding.gyp` files into `CMakeLists.txt` files, intended for `cmake-js` or `react-native-node-api-cmake` to build from.
59+
A tool to transform `binding.gyp` files into `CMakeLists.txt` files, intended for `cmake-js` or `cmake-rn` to build from.
6160

6261
### `packages/node-addon-examples`
6362

64-
A wrapper around the examples in the [nodejs/node-addon-examples](https://github.com/nodejs/node-addon-examples) repo, using `gyp-to-cmake` and `react-native-node-api-cmake` to prepare prebuilds and scaffolding for loading the addons.
63+
A wrapper around the examples in the [nodejs/node-addon-examples](https://github.com/nodejs/node-addon-examples) repo, using `gyp-to-cmake` and `cmake-rn` to prepare prebuilds and scaffolding for loading the addons.
6564

6665
The main purpose is to use these as tests to verify the implementation. We choose to use this as our first signal for compliance, over the [js-native-api tests in the Node.js project](https://github.com/nodejs/node/tree/main/test/js-native-api), because the examples depends much less on Node.js built-in runtime APIs.
6766

apps/test-app/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build/
1111
local.properties
1212
msbuild.binlog
1313

14-
# Ignoring the Podfile.lock as the `react-native-node-api-modules` hash updates too frequently
14+
# Ignoring the Podfile.lock as the `react-native-node-api` hash updates too frequently
1515
Podfile.lock
1616

1717
hermes/

apps/test-app/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { StyleSheet, Text, View, Button } from "react-native";
33

44
/* eslint-disable @typescript-eslint/no-require-imports -- We're using require to defer crashes */
55

6-
// import { requireNodeAddon } from "react-native-node-api-modules";
6+
// import { requireNodeAddon } from "react-native-node-api";
77
import nodeAddonExamples from "react-native-node-addon-examples";
88
// import * as ferricExample from "ferric-example";
99

apps/test-app/babel.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
presets: ['module:@react-native/babel-preset'],
3-
// plugins: [['module:react-native-node-api-modules/babel-plugin', { stripPathSuffix: true }]],
4-
plugins: ['module:react-native-node-api-modules/babel-plugin'],
3+
// plugins: [['module:react-native-node-api/babel-plugin', { stripPathSuffix: true }]],
4+
plugins: ['module:react-native-node-api/babel-plugin'],
55
};

apps/test-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"react": "19.0.0",
2626
"react-native": "0.79.1",
2727
"react-native-node-addon-examples": "*",
28-
"react-native-node-api-modules": "*",
28+
"react-native-node-api": "*",
2929
"react-native-test-app": "^4.3.3"
3030
}
3131
}

apps/test-app/react-native.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const project = (() => {
1212
},
1313
// windows: {
1414
// sourceDir: "windows",
15-
// solutionFile: "windows/react-native-node-api-modules-example.sln",
15+
// solutionFile: "windows/react-native-node-api-example.sln",
1616
// },
1717
});
1818
return {

docs/ANDROID.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Because we're using a version of Hermes patched with Node-API support, we need to build React Native from source.
66

77
```
8-
export REACT_NATIVE_OVERRIDE_HERMES_DIR=`npx react-native-node-api-modules vendor-hermes --silent`
8+
export REACT_NATIVE_OVERRIDE_HERMES_DIR=`npx react-native-node-api vendor-hermes --silent`
99
```
1010

1111
## Cleaning your React Native build folders

docs/AUTO-LINKING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Auto-linking
22

3-
The `react-native-node-api-modules` package (sometimes referred to as "the host package") has mechanisms to automatically find and link prebuilt binaries with Node-API modules.
3+
The `react-native-node-api` package (sometimes referred to as "the host package") has mechanisms to automatically find and link prebuilt binaries with Node-API modules.
44

55
When auto-linking, prebuilt binaries are copied (sometimes referred to as vendored) from dependencies of the app into the host package. As they're copied, they get renamed to avoid conflicts in naming as the library files across multiple dependency packages will be sharing a namespace when building the app.
66

@@ -15,12 +15,12 @@ The name of the library when linked / copied into the host is based on two thing
1515

1616
## How do I link Node-API module libraries into my app?
1717

18-
Linking will run when you `pod install` and as part of building your app with Gradle as long as your app has a dependency on the `react-native-node-api-modules` package.
18+
Linking will run when you `pod install` and as part of building your app with Gradle as long as your app has a dependency on the `react-native-node-api` package.
1919

2020
You can also manually link by running the following in your app directory:
2121

2222
```bash
23-
npx react-native-node-api-modules link --android --apple
23+
npx react-native-node-api link --android --apple
2424
```
2525

2626
> [!NOTE]

docs/CLI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# The `react-native-node-api-modules` command-line interface (CLI)
1+
# The `react-native-node-api` command-line interface (CLI)
22

33
<!-- TODO: Write detailed documentation of each command and their parameters -->

0 commit comments

Comments
 (0)