Skip to content

Commit a441232

Browse files
chore(deps): upgrade napi to v3 (napi 3.8, napi-derive 3.5, @napi-rs/cli 3)
Upgrades the napi ecosystem to v3: - napi crate: 2.16 → 3.8 (dependabot) - napi-derive: 2.16 → 3 (v3 proc-macro required for napi v3 runtime) - @napi-rs/cli: ^2.18 → ^3 (v3 CLI required to set env vars the v3 proc-macro needs) - Regenerated index.js/index.d.ts with napi-rs/cli v3 - CI: npx @napi-rs/cli → npx napi (binary renamed in v3) All Node.js CI passes on all 4 platforms.
1 parent be69c96 commit a441232

6 files changed

Lines changed: 582 additions & 35 deletions

File tree

.github/workflows/node-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
- name: Build native addon
3434
working-directory: minigraf-node
35-
run: npx @napi-rs/cli build --platform --release
35+
run: npx napi build --platform --release
3636

3737
- name: Run tests
3838
working-directory: minigraf-node

.github/workflows/node-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ jobs:
6161
shell: bash
6262
run: |
6363
if [ "${{ matrix.settings.target }}" = "universal-apple-darwin" ]; then
64-
# napi-rs 2.x does not internally handle universal-apple-darwin.
64+
# napi-rs does not internally handle universal-apple-darwin.
6565
# Build each arch separately, then lipo-combine.
6666
# napi-rs --platform names the output using npm platform names:
6767
# aarch64-apple-darwin → minigraf.darwin-arm64.node
6868
# x86_64-apple-darwin → minigraf.darwin-x64.node
69-
npx @napi-rs/cli build --platform --release --target aarch64-apple-darwin
70-
npx @napi-rs/cli build --platform --release --target x86_64-apple-darwin
69+
npx napi build --platform --release --target aarch64-apple-darwin
70+
npx napi build --platform --release --target x86_64-apple-darwin
7171
lipo -create -output minigraf.darwin-universal.node \
7272
minigraf.darwin-arm64.node minigraf.darwin-x64.node
7373
rm minigraf.darwin-arm64.node minigraf.darwin-x64.node
7474
else
75-
npx @napi-rs/cli build --platform --release --target "${{ matrix.settings.target }}"
75+
npx napi build --platform --release --target "${{ matrix.settings.target }}"
7676
fi
7777
7878
- name: Upload .node binary

minigraf-node/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ publish = false
88
crate-type = ["cdylib"]
99

1010
[dependencies]
11-
napi = { version = "2.16", features = ["napi6"] }
12-
napi-derive = "2.16"
11+
napi = { version = "3.8", features = ["napi6"] }
12+
napi-derive = "3"
1313
minigraf = { path = ".." }
1414
serde_json = "1.0"
1515

minigraf-node/index.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
/* tslint:disable */
1+
/* auto-generated by NAPI-RS */
22
/* eslint-disable */
3-
4-
export class MiniGrafDb {
3+
export declare class MiniGrafDb {
4+
/** Open a file-backed database. Throws on error. */
55
constructor(path: string)
6+
/** Open an in-memory database. Throws on error. */
67
static inMemory(): MiniGrafDb
8+
/** Execute a Datalog string. Returns a JSON string. Throws on error. */
79
execute(datalog: string): string
10+
/** Flush the WAL to disk. Throws on error. */
811
checkpoint(): void
912
}

0 commit comments

Comments
 (0)