Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e25d2a3
added initial files
dougg0k Jul 25, 2025
4745e5a
removed ferric example
dougg0k Jul 25, 2025
bfb0e6e
add some setup
dougg0k Jul 25, 2025
1fb0a22
add scripts
dougg0k Jul 26, 2025
da39e3a
changed template to files
dougg0k Jul 26, 2025
0fdc681
add changes
dougg0k Jul 26, 2025
815ebd3
Merge branch 'main' of github.com:dougg0k/react-native-node-api into …
dougg0k Jul 26, 2025
77bcff1
added package template
dougg0k Jul 26, 2025
de848cd
renamed command
dougg0k Jul 26, 2025
2720b01
add progress
dougg0k Jul 26, 2025
1ac1df2
fixed replacing
dougg0k Jul 26, 2025
789e2b8
removed test files
dougg0k Jul 26, 2025
30d0fe9
removed pnpm workspace stuff
dougg0k Jul 26, 2025
cf4b994
updated package lock
dougg0k Jul 26, 2025
9aedc44
added changeset
dougg0k Jul 26, 2025
344a875
add changes
dougg0k Jul 26, 2025
5f3f513
updated check
dougg0k Jul 26, 2025
2b5471a
removed unused var
dougg0k Jul 26, 2025
21a91f6
format and updated readme
dougg0k Jul 26, 2025
2f074fa
updated readme
dougg0k Jul 27, 2025
be9202a
some refactoring
dougg0k Jul 27, 2025
efab2cb
changed pnpm command
dougg0k Jul 28, 2025
16d15b6
Merge remote-tracking branch 'upstream/main' into add-generate-command
dougg0k Aug 1, 2025
b9b5565
improved readme
dougg0k Aug 3, 2025
82a991a
fix readme format
dougg0k Aug 3, 2025
759d9e2
updated some package versions
dougg0k Aug 8, 2025
9ce867b
Merge remote-tracking branch 'upstream/main' into add-generate-command
dougg0k Aug 8, 2025
87d7ee6
updated package lock
dougg0k Aug 8, 2025
a7107cd
removed some config from files
dougg0k Aug 9, 2025
cf63e35
Merge remote-tracking branch 'upstream/main' into add-generate-command
dougg0k Sep 1, 2025
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
1,002 changes: 994 additions & 8 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions packages/ferric-example/.gitignore

This file was deleted.

25 changes: 0 additions & 25 deletions packages/ferric-example/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions packages/ferric-example/build.rs

This file was deleted.

21 changes: 0 additions & 21 deletions packages/ferric-example/package.json

This file was deleted.

6 changes: 0 additions & 6 deletions packages/ferric-example/src/lib.rs

This file was deleted.

7 changes: 7 additions & 0 deletions packages/ferric/__tests__/build.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { assert, describe, it } from "vitest";

describe("", () => {
it("", () => {
assert.equal(1, 1);
});
});
7 changes: 7 additions & 0 deletions packages/ferric/__tests__/generate.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { assert, describe, it } from "vitest";

describe("", () => {
it("", () => {
assert.equal(1, 1);
});
});
12 changes: 8 additions & 4 deletions packages/ferric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@
"ferric": "./bin/ferric.js"
},
"scripts": {
"start": "tsx src/run.ts"
"start": "tsx src/run.ts",
"test": "vitest"
},
"dependencies": {
"@napi-rs/cli": "~3.0.3",
"@commander-js/extra-typings": "^13.1.0",
"@napi-rs/cli": "~3.0.3",
"bufout": "^0.3.2",
"chalk": "^5.4.1",
"commander": "^13.1.0",
"react-native-node-api": "0.3.2",
"ora": "^8.2.0"
"ora": "^8.2.0",
"react-native-node-api": "0.3.2"
},
"devDependencies": {
"vitest": "^3.2.4"
}
}
8 changes: 8 additions & 0 deletions packages/ferric/src/generate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Command } from "@commander-js/extra-typings";

export const generateCommand = new Command("generate")
.description("Generate the project scaffold")
.argument("<name>", "Type the project name")
.action((str, options) => {

Check failure on line 6 in packages/ferric/src/generate.ts

View workflow job for this annotation

GitHub Actions / Lint

'options' is defined but never used

Check failure on line 6 in packages/ferric/src/generate.ts

View workflow job for this annotation

GitHub Actions / Lint

'str' is defined but never used

})
8 changes: 5 additions & 3 deletions packages/ferric/src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { Command } from "@commander-js/extra-typings";

import { printBanner } from "./banner.js";
import { buildCommand } from "./build.js";
import { generateCommand } from "./generate.js";

export const program = new Command("ferric")
.hook("preAction", () => printBanner())
.description("Rust Node-API Modules for React Native")
.addCommand(buildCommand);
.hook("preAction", () => printBanner())
.description("Rust Node-API Modules for React Native")
.addCommand(buildCommand)
.addCommand(generateCommand);
58 changes: 58 additions & 0 deletions packages/ferric/src/template.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
export function cargoTomlTemplate(projectName: string) {
return `
[package]
name = ${projectName}
version = "1.0.0"
edition = "2021"
license = "MIT"

[lib]
crate-type = ["cdylib"]

[dependencies.napi]
version = "3.1"
default-features = false
# see https://nodejs.org/api/n-api.html#node-api-version-matrix
features = ["napi4"]

[dependencies.napi-derive]
version = "3.1"
features = ["type-def"]

[build-dependencies]
napi-build = "2"

[profile.release]
lto = true
codegen-units = 1
strip = "symbols"
opt-level = "z"
panic = "abort"
`;
}

export const GIT_IGNORE_TEMPLATE = `
target
Cargo.lock

*.xcframework/
*.apple.node/
*.android.node/

dist
`;

export const BUILD_RS_TEMPLATE = `
fn main() {
napi_build::setup();
}
`;

export const LIB_RS_TEMPLATE = `
use napi_derive::napi;

#[napi]
pub fn sum(a: i32, b: i32) -> i32 {
a + b
}
`;
2 changes: 1 addition & 1 deletion packages/ferric/tsconfig.tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"composite": true,
"emitDeclarationOnly": true
},
"include": ["src/**/*.test.ts"],
"include": ["__tests__/**/*.test.ts"],
"exclude": [],
"references": [
{
Expand Down
Loading