Skip to content

Commit ef9e57a

Browse files
committed
update several md files
1 parent b601e7e commit ef9e57a

File tree

3 files changed

+73
-107
lines changed

3 files changed

+73
-107
lines changed

AGENTS.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# AGENTS.md
2+
3+
Short, consolidated instructions for working on this repo.
4+
5+
## Repo overview
6+
- Node.js native addon for libgd (Node-API).
7+
- Prebuilds are bundled into the npm package under `prebuilds/`.
8+
- Bindings load via `node-gyp-build` in `lib/bindings.js`.
9+
10+
## Architecture
11+
- **Native C++ binding** (`src/`)
12+
- `node_gd.cc` main implementation
13+
- `node_gd.h` class definitions and macros
14+
- `addon.cc` module initialization
15+
- `node_gd_workers.cc` async workers for file I/O
16+
- **JavaScript wrapper** (`lib/`)
17+
- `node-gd.js` convenience methods and Promise support
18+
- `bindings.js` native binding loader
19+
- `GifAnim.js` animated GIF support
20+
- **Entry point** (`index.js`) exports the main API
21+
- **Build system**: `node-gyp`, `binding.gyp`, and `util.sh` feature detection
22+
23+
## Prereqs
24+
- Node.js 20+.
25+
- System libgd and build tools.
26+
- macOS: `brew install pkg-config gd`
27+
- Debian/Ubuntu: `apt-get install build-essential pkg-config libgd-dev`
28+
29+
## Install
30+
- `npm ci` (or `npm install`) in repo root.
31+
32+
## Build
33+
- `npm run rebuild` (node-gyp rebuild).
34+
- `npm run prebuild` (creates `prebuilds/` for current platform).
35+
36+
## Tests
37+
- `npm test`
38+
39+
## Prebuilds (CI model)
40+
- CI builds per OS/arch and bundles `prebuilds/` into npm publish.
41+
- Local prebuild test:
42+
1. `npm run prebuild`
43+
2. `npm pack`
44+
3. In a dummy project, `npm install /path/to/node-gd-*.tgz`
45+
46+
## Release checklist
47+
- Ensure prebuild workflow ran on release publish.
48+
- Verify `prebuilds/` exists in the npm tarball (`npm pack` + `tar -tf`).
49+
- Publish uses `NPM_TOKEN` secret.
50+
51+
## Development notes
52+
- **Image types**:
53+
- Palette images via `gd.create()` (max 256 colors, white background).
54+
- True color images via `gd.createTrueColor()` (millions of colors, black background).
55+
- **Memory**: Always call `image.destroy()` to free C-level memory.
56+
- **Async vs sync**: File I/O is async (Promises); drawing is sync.
57+
- **Platform**: Windows is not supported; requires libgd headers.
58+
- **Testing**: Mocha with ES modules; tests in `test/*.test.mjs`, fixtures in `test/fixtures/`.
59+
- **Conditional features**: AVIF/HEIF/TIFF/WebP/FreeType/Fontconfig via `util.sh` detection.
60+
- Check runtime support with `gd.getGDVersion()` and feature flags like `gd.GD_TIFF`.

CLAUDE.md

Lines changed: 1 addition & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,3 @@
11
# CLAUDE.md
22

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4-
5-
## Project Overview
6-
7-
This is node-gd, a Node.js binding for the libgd C graphics library. It provides high-level JavaScript APIs for creating, manipulating, and saving images in various formats (PNG, JPEG, GIF, BMP, TIFF, WebP, etc.).
8-
9-
## Key Architecture
10-
11-
### Core Components
12-
13-
- **Native C++ binding** (`src/`) - Contains the core N-API wrapper around libgd
14-
- `node_gd.cc` - Main implementation with all image manipulation functions
15-
- `node_gd.h` - Header file with class definitions and macros
16-
- `addon.cc` - Module initialization
17-
- `node_gd_workers.cc` - Async worker implementations for file I/O
18-
19-
- **JavaScript wrapper** (`lib/`) - Adds convenience methods and Promise support
20-
- `node-gd.js` - Main wrapper that adds format-specific convenience functions
21-
- `bindings.js` - Handles the native binding loading
22-
- `GifAnim.js` - Animated GIF functionality
23-
24-
- **Entry point** (`index.js`) - Simple module setup that exports the main API
25-
26-
### Build System
27-
28-
- Uses `node-gyp` for compiling the native C++ code
29-
- `binding.gyp` - Defines build configuration with conditional compilation based on available libraries
30-
- `util.sh` - Shell script that detects available libgd features (AVIF, HEIF, TIFF, etc.)
31-
32-
## Common Commands
33-
34-
### Development
35-
```bash
36-
# Build the native module
37-
npm run rebuild
38-
39-
# Clean build artifacts
40-
npm run clean
41-
42-
# Install (triggers rebuild)
43-
npm install
44-
```
45-
46-
### Testing
47-
```bash
48-
# Run all tests (builds first via pretest)
49-
npm test
50-
51-
# Just build without testing
52-
npm run pretest
53-
```
54-
55-
### Docker Development
56-
```bash
57-
# Build Docker image
58-
npm run docker-build
59-
60-
# Run in Docker
61-
npm run docker-run
62-
```
63-
64-
## Development Notes
65-
66-
### Image Types
67-
- **Palette images** - Created with `gd.create()`, max 256 colors, white background
68-
- **True color images** - Created with `gd.createTrueColor()`, millions of colors, black background
69-
70-
### Memory Management
71-
- All images must be explicitly destroyed with `image.destroy()` to free C-level memory
72-
- Failing to destroy images will cause memory leaks
73-
74-
### Async vs Sync
75-
- Version 2.x removed sync functions (`createSync`, `createTrueColorSync`)
76-
- All file I/O operations return Promises and use N-API AsyncWorkers
77-
- Drawing operations are synchronous
78-
79-
### Platform Support
80-
- **Does not build on Windows** - explicitly excluded in package.json
81-
- Requires libgd development headers to be installed on the system
82-
- Uses pkg-config to find libgd
83-
84-
### Testing
85-
- Uses Mocha with ES modules
86-
- Tests are in `test/` directory with `.test.mjs` extension
87-
- Test fixtures in `test/fixtures/`
88-
- Output images saved to `test/output/`
89-
90-
### Conditional Features
91-
The build system detects available libgd features and compiles accordingly:
92-
- AVIF support (requires libavif)
93-
- HEIF support (requires libheif)
94-
- TIFF support (requires libtiff)
95-
- WebP support (requires libwebp)
96-
- FreeType font support
97-
- Fontconfig support
98-
99-
Check available features with `gd.getGDVersion()` and feature flags like `gd.GD_TIFF`.
3+
Guidance for Claude Code. See `AGENTS.md` for the consolidated, up-to-date repo instructions.

CONTRIBUTORS.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
* 267 Vincent Bruijn <vebruijn@gmail.com>
2-
* 39 Vincent Bruijn <vincent-bruijn@g-star.com>
1+
* 315 Vincent Bruijn <vebruijn@gmail.com>
2+
* 58 Vincent Bruijn <vincent-bruijn@g-star.com>
33
* 29 Mike Smullin <mike@smullindesign.com>
44
* 11 andris9 <andris@node.ee>
55
* 8 Ilya Sheershoff <sheershoff@gmail.com>
66
* 7 taggon <root@funnyfog.net>
7+
* 5 dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
78
* 4 Andris Reinman <andris.reinman@gmail.com>
8-
* 3 Svetlozar Argirov <zarrro@gmail.com>
99
* 3 Damian Senn <damian.senn@gmail.com>
10-
* 2 Yun Lai <yun.l@impos.com.au>
10+
* 3 Svetlozar Argirov <zarrro@gmail.com>
11+
* 3 Vladislav Veluga <vladislav805@yandex.com>
1112
* 2 Andris Reinman <andris@kreata.ee>
1213
* 2 Burak Tamturk <buraktamturk@gmail.com>
1314
* 2 Christophe BENOIT <christophe@kiwup.com>
14-
* 2 Vladislav Veluga <vladislav805@yandex.com>
15-
* 1 dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
16-
* 1 kmpm <kmpm@birchroad.net>
17-
* 1 Tim Smart <tim@fostle.com>
15+
* 2 Yun Lai <yun.l@impos.com.au>
16+
* 1 Carlos Rodriguez <carlos@s8f.org>
17+
* 1 Christian Clauss <cclauss@me.com>
18+
* 1 Dany Shaanan <danyshaanan@gmail.com>
1819
* 1 Farrin Reid <blakmatrix@gmail.com>
1920
* 1 Gabriele D'Arrigo <darrigo.g@gmail.com>
2021
* 1 Holixus <true@holix.ru>
2122
* 1 Josh Dawkins <zer0x304@gmail.com>
2223
* 1 Thomas de Barochez <tdebarochez@users.noreply.github.com>
23-
* 1 Dany Shaanan <danyshaanan@gmail.com>
24-
* 1 Carlos Rodriguez <carlos@s8f.org>
24+
* 1 Tim Smart <tim@fostle.com>
25+
* 1 Vítor Cardoso Bertolucci <vitorbertolucci@gmail.com>
26+
* 1 kmpm <kmpm@birchroad.net>

0 commit comments

Comments
 (0)