Skip to content

Commit

Permalink
Add per-platform project builds, a loader stub, and metadata.
Browse files Browse the repository at this point in the history
  • Loading branch information
obi1kenobi committed Dec 5, 2024
1 parent 1099199 commit 2b9f1f7
Show file tree
Hide file tree
Showing 16 changed files with 169 additions and 24 deletions.
2 changes: 2 additions & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resolver = "2"
chrono = "0.4.38"
flate2 = "1.0.34"
futures = "0.3.31"
napi = "2.16.13"
napi = { version = "2.16.13", features = ["napi9", "serde-json"] }
napi-derive = "2.16.13"
napi-build = "2.1.3"
rayon = "1.10.0"
Expand Down
10 changes: 10 additions & 0 deletions rust/crates/langsmith-nodejs/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
target
Cargo.lock
.cargo
.github
npm
.eslintrc
.prettierignore
rustfmt.toml
yarn.lock
*.node
11 changes: 11 additions & 0 deletions rust/crates/langsmith-nodejs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { loadBinding } = require('@node-rs/helper')

/**
* __dirname means load native addon from current dir
* 'langsmith-nodejs' is the name of native addon
* the second arguments was decided by `napi.name` field in `package.json`
* the third arguments was decided by `name` field in `package.json`
* `loadBinding` helper will load `langsmith-nodejs.[PLATFORM].node` from `__dirname` first
* If failed to load addon, it will fallback to load from `langsmith-nodejs-[PLATFORM]`
*/
module.exports = loadBinding(__dirname, 'langsmith-nodejs', 'langsmith-nodejs')
3 changes: 3 additions & 0 deletions rust/crates/langsmith-nodejs/npm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Platform-specific binary builds of `langsmith-nodejs`

Each of them carries just the `.node` binary file of `langsmith-nodejs` compiled for that platform.
3 changes: 3 additions & 0 deletions rust/crates/langsmith-nodejs/npm/darwin-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `langsmith-nodejs-darwin-arm64`

This is the **aarch64-apple-darwin** binary for `langsmith-nodejs`
18 changes: 18 additions & 0 deletions rust/crates/langsmith-nodejs/npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "langsmith-nodejs-darwin-arm64",
"version": "0.0.0",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "langsmith-nodejs.darwin-arm64.node",
"files": [
"langsmith-nodejs.darwin-arm64.node"
],
"license": "MIT",
"engines": {
"node": ">= 18"
}
}
3 changes: 3 additions & 0 deletions rust/crates/langsmith-nodejs/npm/darwin-x64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `langsmith-nodejs-darwin-x64`

This is the **x86_64-apple-darwin** binary for `langsmith-nodejs`
18 changes: 18 additions & 0 deletions rust/crates/langsmith-nodejs/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "langsmith-nodejs-darwin-x64",
"version": "0.0.0",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "langsmith-nodejs.darwin-x64.node",
"files": [
"langsmith-nodejs.darwin-x64.node"
],
"license": "MIT",
"engines": {
"node": ">= 18"
}
}
3 changes: 3 additions & 0 deletions rust/crates/langsmith-nodejs/npm/linux-x64-gnu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `langsmith-nodejs-linux-x64-gnu`

This is the **x86_64-unknown-linux-gnu** binary for `langsmith-nodejs`
18 changes: 18 additions & 0 deletions rust/crates/langsmith-nodejs/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "langsmith-nodejs-linux-x64-gnu",
"version": "0.0.0",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "langsmith-nodejs.linux-x64-gnu.node",
"files": [
"langsmith-nodejs.linux-x64-gnu.node"
],
"license": "MIT",
"engines": {
"node": ">= 18"
}
}
3 changes: 3 additions & 0 deletions rust/crates/langsmith-nodejs/npm/linux-x64-musl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `langsmith-nodejs-linux-x64-musl`

This is the **x86_64-unknown-linux-musl** binary for `langsmith-nodejs`
18 changes: 18 additions & 0 deletions rust/crates/langsmith-nodejs/npm/linux-x64-musl/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "langsmith-nodejs-linux-x64-musl",
"version": "0.0.0",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "langsmith-nodejs.linux-x64-musl.node",
"files": [
"langsmith-nodejs.linux-x64-musl.node"
],
"license": "MIT",
"engines": {
"node": ">= 18"
}
}
3 changes: 3 additions & 0 deletions rust/crates/langsmith-nodejs/npm/win32-x64-msvc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `langsmith-nodejs-win32-x64-msvc`

This is the **x86_64-pc-windows-msvc** binary for `langsmith-nodejs`
18 changes: 18 additions & 0 deletions rust/crates/langsmith-nodejs/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "langsmith-nodejs-win32-x64-msvc",
"version": "0.0.0",
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "langsmith-nodejs.win32-x64-msvc.node",
"files": [
"langsmith-nodejs.win32-x64-msvc.node"
],
"license": "MIT",
"engines": {
"node": ">= 18"
}
}
60 changes: 37 additions & 23 deletions rust/crates/langsmith-nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
{
"package": "langsmith-nodejs",
"version": "0.1.0",
"author": "LangChain",
"scripts": {
"build": "napi build --release",
"build:debug": "napi build",
"test": ""
},
"devDependencies": {
"@napi-rs/cli": "^1.0.0"
},
"napi": {
"name": "langsmith-nodejs"
},
"bugs": {
"url": "https://github.com/langchain-ai/langsmith-sdk/issues"
},
"homepage": "https://github.com/langchain-ai/langsmith-sdk#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/langchain-ai/langsmith-sdk.git"
},
"license": "MIT"
"package": "langsmith-nodejs",
"version": "0.1.0",
"author": "LangChain",
"scripts": {
"artifacts": "napi artifacts",
"build": "napi build --platform --release",
"build:debug": "napi build --platform",
"prepublishOnly": "napi prepublish -t npm",
"version": "napi version"
},
"dependencies": {
"@node-rs/helper": "^1.2.1"
},
"devDependencies": {
"@napi-rs/cli": "^1.0.0"
},
"napi": {
"name": "langsmith-nodejs",
"triples": {
"additional": [
"aarch64-apple-darwin",
"x86_64-unknown-linux-musl"
]
}
},
"bugs": {
"url": "https://github.com/langchain-ai/langsmith-sdk/issues"
},
"homepage": "https://github.com/langchain-ai/langsmith-sdk#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/langchain-ai/langsmith-sdk.git"
},
"license": "MIT",
"engines": {
"node": ">= 18"
}
}

0 comments on commit 2b9f1f7

Please sign in to comment.