Skip to content
Open
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
36 changes: 22 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: build
strategy:
matrix:
node: [22]
node: [22, 24, 26]
os:
# https://github.com/actions/runner-images#available-images
- name: darwin
Expand All @@ -33,7 +33,6 @@ jobs:
CXX: clang++
npm_config_clang: 1
GYP_DEFINES: use_obsolete_asm=true
CXXFLAGS: -std=c++17
runs-on: ${{ matrix.os.host }}
steps:
- uses: actions/checkout@v5
Expand All @@ -45,9 +44,18 @@ jobs:
check-latest: true
- name: Prebuildify
run: |
[[ $(uname -o) == *Linux ]] && \
sudo apt-get update && \
sudo apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget python3 zlib1g-dev
if [[ $(uname -o) == *Linux ]]; then
sudo apt-get update
sudo apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget python3 zlib1g-dev lsb-release gnupg
# Node 24+ headers use C++20 std::source_location, which needs
# clang >= 16; ubuntu 22.04 ships clang 14. Stay on 22.04 (rather
# than a newer runner) to keep the glibc 2.35 prebuild baseline.
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
export CC=clang-18
export CXX=clang++-18
fi

npm ci
JOBS=2 npx prebuildify --strip --napi=false --tag-libc -t "$(node --version | tr -d 'v')"
Expand All @@ -63,7 +71,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
node: [22]
node: [22, 24, 26]
steps:
- uses: actions/checkout@v5
- uses: docker/setup-qemu-action@v3
Expand All @@ -85,7 +93,7 @@ jobs:
runs-on: ubuntu-22.04-arm
strategy:
matrix:
node: [22]
node: [22, 24, 26]
steps:
- uses: actions/checkout@v5
- name: build linux musl arm64
Expand Down Expand Up @@ -134,13 +142,13 @@ jobs:
mkdir -p prebuilds/darwin-arm64
mkdir -p prebuilds/darwin-x64
find ${{ steps.download.outputs.download-path }}
# Copy prebuilds for each platform
mv ${{ steps.download.outputs.download-path }}/prebuild-Linux-X64-node22/linux-x64/* ./prebuilds/linux-x64/ 2>/dev/null || true
mv ${{ steps.download.outputs.download-path }}/prebuild-Linux-ARM64-node22/linux-arm64/* ./prebuilds/linux-arm64/ 2>/dev/null || true
mv ${{ steps.download.outputs.download-path }}/prebuild-linux-musl-amd64-node22/linux-x64/* ./prebuilds/linux-x64/ 2>/dev/null || true
mv ${{ steps.download.outputs.download-path }}/prebuild-linux-musl-arm64-node22/linux-arm64/* ./prebuilds/linux-arm64/ 2>/dev/null || true
mv ${{ steps.download.outputs.download-path }}/prebuild-macOS-ARM64-node22/darwin-arm64/* ./prebuilds/darwin-arm64/ 2>/dev/null || true
mv ${{ steps.download.outputs.download-path }}/prebuild-macOS-X64-node22/darwin-x64/* ./prebuilds/darwin-x64/ 2>/dev/null || true
# Merge prebuilds for each platform across all node versions;
# ABI-tagged filenames don't collide.
for d in ${{ steps.download.outputs.download-path }}/prebuild-*/; do
for platarch in linux-x64 linux-arm64 darwin-x64 darwin-arm64; do
[ -d "$d$platarch" ] && mv "$d$platarch"/* "./prebuilds/$platarch/" 2>/dev/null || true
done
done
find ./prebuilds
- name: npm install
run: npm ci
Expand Down
29 changes: 19 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,26 @@ jobs:
linux-test:
name: "test node ${{ matrix.node-version }} on linux"
env:
CC: clang
CXX: clang++
CC: clang-18
CXX: clang++-18
npm_config_clang: 1
GYP_DEFINES: use_obsolete_asm=true
DEBIAN_FRONTEND: "noninteractive"
runs-on: ubuntu-22.04
container: ubuntu:22.04
strategy:
matrix:
node-version: [22]
node-version: [22, 24, 26]
steps:
- name: prerequisites
run: |
apt-get update
apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget python3 zlib1g-dev
apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget python3 zlib1g-dev lsb-release gnupg
# Node 24+ headers use C++20 std::source_location, which needs
# clang >= 16; ubuntu 22.04 ships clang 14
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 18
- uses: actions/checkout@v5
with:
submodules: true
Expand Down Expand Up @@ -61,7 +66,7 @@ jobs:
GYP_DEFINES: use_obsolete_asm=true
strategy:
matrix:
node-version: [22]
node-version: [22, 24, 26]
runner: ["macos-26", "macos-15-intel"]
runs-on: ${{ matrix.runner }}
steps:
Expand Down Expand Up @@ -93,15 +98,14 @@ jobs:
linux-arm-test:
name: "test node ${{ matrix.node-version }} on linux-arm"
env:
CC: clang
CXX: clang++
CC: clang-18
CXX: clang++-18
npm_config_clang: 1
GYP_DEFINES: use_obsolete_asm=true
CXXFLAGS: -std=c++17
runs-on: ubuntu-22.04-arm
strategy:
matrix:
node-version: [22]
node-version: [22, 24, 26]
steps:
- uses: actions/checkout@v5
with:
Expand All @@ -113,7 +117,12 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget python3 zlib1g-dev
sudo apt-get install -y software-properties-common git build-essential clang libssl-dev libkrb5-dev libc++-dev wget python3 zlib1g-dev lsb-release gnupg
# Node 24+ headers use C++20 std::source_location, which needs
# clang >= 16; ubuntu 22.04 ships clang 14
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
- name: Test
run: |
set -xe
Expand Down
8 changes: 4 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Overview

This is [@readme/nodegit](https://www.npmjs.com/package/@readme/nodegit), a fork of the original NodeGit library that provides Node.js bindings to libgit2. This fork is maintained by Readme and includes compatibility updates for Node.js 20 and 22.
This is [@readme/nodegit](https://www.npmjs.com/package/@readme/nodegit), a fork of the original NodeGit library that provides Node.js bindings to libgit2. This fork is maintained by ReadMe and includes compatibility updates for Node.js 22, 24, and 26.

## Quick Start

### Prerequisites
- Node.js >= 20 (supports Node 20 and 22)
- Node.js >= 22 (supports Node 22, 24, and 26)
- Git installed on your system
- Build tools (automatically handled during install)

Expand Down Expand Up @@ -101,7 +101,7 @@ Tests are located in:
## CI/CD

GitHub Actions workflows:
- **tests.yml**: Runs tests on Ubuntu 22.04 and macOS-26
- **tests.yml**: Runs tests on Ubuntu 22.04 and macOS-26 across Node 22, 24, and 26
- **publish.yml**: Handles package publishing

## Architecture
Expand Down Expand Up @@ -139,7 +139,7 @@ npm install

1. Run tests locally: `npm test`
2. Ensure linting passes: `npm run lint`
3. Test on target Node versions (20, 22)
3. Test on target Node versions (22, 24, 26)
4. Update tests if adding new functionality

For more detailed API documentation, visit [nodegit.org](http://www.nodegit.org/).
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## What is this fork?

This fork contains a prebuilt version of nodegit that is compatible with **node
22.x** and the following platforms/arch/libc type:
22.x, 24.x, and 26.x** and the following platforms/arch/libc type:

- **darwin/arm64/glibc**
- **darwin/amd64/glibc**
Expand All @@ -16,7 +16,7 @@ This fork contains a prebuilt version of nodegit that is compatible with **node
- **linux/amd64/musl**
- **linux/arm64/musl**

This means that if you are using node 22 and one of those platforms, you can
This means that if you are using node 22, 24, or 26 and one of those platforms, you can
have a much faster install because you won't need to build nodegit from source.
It also means that you will have a slightly larger file in your node_modules
folder.
Expand Down
3 changes: 1 addition & 2 deletions generate/templates/manual/src/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ namespace nodegit {

Context *Context::GetCurrentContext() {
Nan::HandleScope scope;
v8::Local<v8::Context> context = Nan::GetCurrentContext();
v8::Isolate *isolate = context->GetIsolate();
v8::Isolate *isolate = v8::Isolate::GetCurrent();
return contexts[isolate];
}

Expand Down
6 changes: 2 additions & 4 deletions generate/templates/manual/src/thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,7 @@ namespace nodegit {
// NOTE this should theoretically never be triggered during a cleanup operation
void ThreadPoolImpl::RunLoopCallbacks() {
Nan::HandleScope scope;
v8::Local<v8::Context> context = Nan::GetCurrentContext();
node::CallbackScope callbackScope(context->GetIsolate(), Nan::New<v8::Object>(), {0, 0});
node::CallbackScope callbackScope(v8::Isolate::GetCurrent(), Nan::New<v8::Object>(), {0, 0});

std::unique_lock<std::mutex> lock(*jsThreadCallbackMutex);
// get the next callback to run
Expand Down Expand Up @@ -720,8 +719,7 @@ namespace nodegit {
}

Nan::HandleScope scope;
v8::Local<v8::Context> context = Nan::GetCurrentContext();
node::CallbackScope callbackScope(context->GetIsolate(), Nan::New<v8::Object>(), {0, 0});
node::CallbackScope callbackScope(v8::Isolate::GetCurrent(), Nan::New<v8::Object>(), {0, 0});

while (cancelledJobs.size()) {
std::shared_ptr<Orchestrator::Job> cancelledJob = cancelledJobs.front();
Expand Down
3 changes: 1 addition & 2 deletions generate/templates/templates/nodegit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ NAN_MODULE_INIT(init) {
);

Nan::HandleScope scope;
Local<Context> context = Nan::GetCurrentContext();
Isolate *isolate = context->GetIsolate();
Isolate *isolate = Isolate::GetCurrent();
nodegit::Context *nodegitContext = new nodegit::Context(isolate);

Wrapper::InitializeComponent(target, nodegitContext);
Expand Down
11 changes: 6 additions & 5 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"lib": "./lib"
},
"engines": {
"node": "22.x"
"node": "^22 || ^24 || >=26"
},
"dependencies": {
"@axosoft/nan": "^2.22.0-gk.1",
"@axosoft/nan": "npm:nan@^2.28.0",
"fs-extra": "^7.0.0",
"json5": "^2.1.0",
"lodash": "^4.17.14",
Expand Down
8 changes: 4 additions & 4 deletions scripts/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-alpine3.19
ARG NODE_VERSION=22
FROM node:${NODE_VERSION}-alpine

RUN apk add build-base git krb5-dev libgit2-dev libssh-dev pkgconfig python3 tzdata

# Ensure C++17 is used explicitly for Node.js 20 and define POSIX features
ENV CXXFLAGS="-std=c++17 -D_GNU_SOURCE"
# Define POSIX features; the C++ standard comes from binding.gyp per Node version
ENV CXXFLAGS="-D_GNU_SOURCE"
ENV CFLAGS="-std=c17 -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L"
ENV JOBS="2"

Expand Down