Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 9 additions & 23 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,20 @@ jobs:
node-version: lts/jod
- run: npm ci
- run: npm run lint
test-simple:
name: Run tests which doesn't require MacOS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/jod
- run: npm ci
- run: npm run build
- run: npm test --workspace gyp-to-cmake --workspace cmake-rn --workspace react-native-node-api
test-windows:
name: Run tests on Windows
runs-on: windows-latest
simple-tests:
strategy:
matrix:
runner: [ubuntu-latest, windows-latest]
name: Run simple tests (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/jod
- run: npm ci
- run: npm run build
- run: npm test --workspace gyp-to-cmake --workspace cmake-rn --workspace react-native-node-api

test-macos:
- run: npx nx run-many -t test --exclude @react-native-node-api/node-addon-examples
macos-tests:
name: Run tests which requires MacOS
runs-on: macos-latest
steps:
Expand All @@ -59,8 +49,4 @@ jobs:
# Version here should match the one in React Native template and packages/cmake-rn/src/cli.ts
- run: sdkmanager --install "ndk;27.1.12297006"
- run: npm ci
- run: npm run build
- run: npm run copy-node-api-headers --workspace react-native-node-api
- run: npm run build-weak-node-api --workspace react-native-node-api
- run: npm run generate-weak-node-api-injector --workspace react-native-node-api
- run: npm test --workspace @react-native-node-api/node-addon-examples
- run: npx nx run-many -t test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ node_modules/
dist/

*.tsbuildinfo

# NX
.nx/
7 changes: 7 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"targetDefaults": {},
"tui": {
"autoExit": true
}
}
1,130 changes: 868 additions & 262 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"clean": "tsc --build --clean",
"dev": "tsc --build --watch",
"lint": "eslint .",
"test": "npm run test --workspace react-native-node-api --workspace cmake-rn --workspace gyp-to-cmake --workspace node-addon-examples"
"test": "nx run-many -t test"
},
"author": {
"name": "Callstack",
Expand All @@ -34,9 +34,10 @@
"@types/node": "^22.13.0",
"eslint": "^9.19.0",
"globals": "^16.0.0",
"nx": "21.1.3",
"react-native": "0.79.1",
"tsx": "^4.19.3",
"typescript": "^5.7.3",
"typescript-eslint": "^8.22.0",
"tsx": "^4.19.3"
"typescript-eslint": "^8.22.0"
}
}
1 change: 1 addition & 0 deletions packages/cmake-rn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"chalk": "^5.4.1",
"cmake-js": "^7.3.1",
"commander": "^13.1.0",
"react-native-node-api": "0.1.0",
"ora": "^8.2.0"
},
"peerDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions packages/cmake-rn/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"targets": {
"build": {
"dependsOn": ["react-native-node-api:build"],
"outputs": ["{projectRoot}/dist"],
"cache": true
}
}
}
15 changes: 15 additions & 0 deletions packages/ferric-example/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"targets": {
"build": {
"dependsOn": ["ferric-cli:build"],
"inputs": [
"{projectRoot}/build.rs",
"{projectRoot}/Cargo.toml",
"{projectRoot}/src/**"
],
"outputs": ["{projectRoot}/target", "{projectRoot}/*.node"],
"cache": true
}
}
}
3 changes: 2 additions & 1 deletion packages/ferric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
"ferric": "./bin/ferric.js"
},
"scripts": {
"build": "tsc",
"start": "tsx src/run.ts"
},
"dependencies": {
"@napi-rs/cli": "3.0.0-alpha.80",
"@napi-rs/cli": "3.0.0-alpha.88",
"@commander-js/extra-typings": "^13.1.0",
"bufout": "^0.3.1",
"chalk": "^5.4.1",
Expand Down
10 changes: 10 additions & 0 deletions packages/ferric/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"targets": {
"build": {
"inputs": ["{projectRoot}/src"],
"outputs": ["{projectRoot}/dist", "{projectRoot}/*.tsbuildinfo"],
"cache": true
}
}
}
10 changes: 10 additions & 0 deletions packages/gyp-to-cmake/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"targets": {
"build": {
"inputs": ["{projectRoot}/src"],
"outputs": ["{projectRoot}/dist", "{projectRoot}/*.tsbuildinfo"],
"cache": true
}
}
}
2 changes: 1 addition & 1 deletion packages/host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"copy-node-api-headers": "tsx scripts/copy-node-api-headers.ts",
"generate-weak-node-api": "tsx scripts/generate-weak-node-api.ts",
"generate-weak-node-api-injector": "tsx scripts/generate-weak-node-api-injector.ts",
"build-weak-node-api": "npm run generate-weak-node-api && cmake-rn --android --apple --no-auto-link --no-weak-node-api-linkage --xcframework-extension --source ./weak-node-api",
"build-weak-node-api": "cmake-rn --android --apple --no-auto-link --no-weak-node-api-linkage --xcframework-extension --source ./weak-node-api",
"test": "tsx --test --test-reporter=@reporters/github --test-reporter-destination=stdout --test-reporter=spec --test-reporter-destination=stdout src/node/**/*.test.ts src/node/*.test.ts"
},
"keywords": [
Expand Down
48 changes: 48 additions & 0 deletions packages/host/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"targets": {
"build": {
"inputs": ["{projectRoot}/src/**"],
"outputs": ["{projectRoot}/dist", "{projectRoot}/*.tsbuildinfo"],
"cache": true
},
"copy-node-api-headers": {
"inputs": ["{projectRoot}/scripts/copy-node-api-headers.ts"],
"outputs": ["{projectRoot}/weak-node-api/include"],
"cache": true
},
"generate-weak-node-api": {
"inputs": ["{projectRoot}/scripts/generate-weak-node-api.ts"],
"outputs": [
"{projectRoot}/weak-node-api/weak_node_api.cpp",
"{projectRoot}/weak-node-api/weak_node_api.hpp"
],
"cache": true
},
"generate-weak-node-api-injector": {
"inputs": ["{projectRoot}/scripts/generate-weak-node-api-injector.ts"],
"outputs": ["{projectRoot}/cpp/WeakNodeApiInjector.cpp"],
"cache": true
},
"build-weak-node-api": {
"dependsOn": [
"cmake-rn:build",
"copy-node-api-headers",
"generate-weak-node-api",
"generate-weak-node-api-injector"
],
"inputs": [
"{projectRoot}/weak-node-api/CMakeLists.txt",
"{projectRoot}/weak-node-api/include/**",
"{projectRoot}/weak-node-api/*.cpp",
"{projectRoot}/weak-node-api/*.hpp"
],
"outputs": [
"{projectRoot}/weak-node-api/build",
"{projectRoot}/weak-node-api/weak-node-api.android.node",
"{projectRoot}/weak-node-api/weak-node-api.xcframework"
],
"cache": true
}
}
}
4 changes: 1 addition & 3 deletions packages/node-addon-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
"copy-examples": "tsx scripts/copy-examples.mts",
"gyp-to-cmake": "gyp-to-cmake ./examples",
"build": "tsx scripts/build-examples.mts",
"copy-and-build": "npm run copy-examples && npm run gyp-to-cmake && npm run build",
"verify": "tsx scripts/verify-prebuilds.mts",
"test": "npm run copy-and-build && npm run verify"
"test": "tsx scripts/verify-prebuilds.mts"
},
"devDependencies": {
"cmake-rn": "*",
Expand Down
36 changes: 36 additions & 0 deletions packages/node-addon-examples/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"targets": {
"copy-examples": {
"outputs": [
"{projectRoot}/examples/**",
"!{projectRoot}/examples/**/CMakeLists.txt",
"!{projectRoot}/examples/**/*.node"
],
"cache": true
},
"gyp-to-cmake": {
"dependsOn": ["gyp-to-cmake:build", "copy-examples"],
"inputs": ["{projectRoot}/examples/**/binding.gyp"],
"outputs": ["{projectRoot}/examples/**/CMakeLists.txt"],
"cache": true
},
"build": {
"dependsOn": [
"react-native-node-api:build-weak-node-api",
"cmake-rn:build",
"copy-examples",
"gyp-to-cmake"
],
"inputs": [
"{projectRoot}/examples/**",
"!{projectRoot}/examples/**/*.node"
],
"outputs": ["{projectRoot}/examples/**/*.node"],
"cache": true
},
"test": {
"dependsOn": ["build"]
}
}
}
Loading