Skip to content
Merged
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Asynchronous, non-blocking [SQLite3](https://sqlite.org/) bindings for [Node.js]

# Features

- Bundles SQLite v3.53.2, or you can build using a local SQLite (or SqlCipher,...)
- Bundles SQLite v3.53.3, or you can build using a local SQLite (or SqlCipher,...)
- Straightforward query and parameter binding interface
- Full Buffer/Blob support
- Extensive debugging support via [verbose mode](docs/API.md#verbose-mode)
Expand All @@ -43,7 +43,7 @@ yarn add @homeofthings/sqlite3

### Prebuilt binaries

`@homeofthings/sqlite3` uses [Node-API](https://nodejs.org/api/n-api.html) so prebuilt binaries do not need to be built for specific Node versions. Prebuilt binaries are built as NAPI-version-agnostic (`@homeofthings+sqlite3.*.node`) using the `--napi` flag, and work on any Node.js version that supports the NAPI version used at compile time. Requires Node.js v22.1.0 or later.
`@homeofthings/sqlite3` uses [Node-API](https://nodejs.org/api/n-api.html) so prebuilt binaries do not need to be built for specific Node versions. Prebuilt binaries are built as NAPI-version-agnostic (`@homeofthings+sqlite3.*.node`) using the `--napi` flag, and work on any Node.js version that supports the NAPI version used at compile time. Requires Node.js v22.22.2 or later.

Prebuilt binaries are bundled inside the npm package using [`prebuildify`](https://github.com/prebuild/prebuildify) and loaded at runtime by [`node-gyp-build`](https://github.com/prebuild/node-gyp-build). No separate download step is needed — `npm install` just works. The following targets are currently provided:

Expand Down
2 changes: 1 addition & 1 deletion deps/common-sqlite.gypi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
'variables': {
'sqlite_version%':'3530200',
'sqlite_version%':'3530300',
"toolset%":'',
},
'target_defaults': {
Expand Down
Binary file removed deps/sqlite-amalgamation-3530200.zip
Binary file not shown.
Binary file added deps/sqlite-amalgamation-3530300.zip
Binary file not shown.
115 changes: 115 additions & 0 deletions docs/DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,121 @@ After releasing, you can verify:
- GitHub Release with binaries: https://github.com/gms1/node-sqlite3/releases
- npm package: https://www.npmjs.com/package/@homeofthings/sqlite3

## How to Bump SQLite

The project bundles SQLite as an amalgamation zip file in `deps/`. To upgrade to a newer SQLite version, use the automated script or follow the manual steps below.

### Automated: `bump-sqlite.sh`

The [`tools/bin/bump-sqlite.sh`](../tools/bin/bump-sqlite.sh) script automates the entire process:

```bash
# Auto-detect the latest SQLite version and bump (with 7-day cooldown)
tools/bin/bump-sqlite.sh

# Specify a version explicitly
tools/bin/bump-sqlite.sh 3510400

# Dry-run to preview changes
tools/bin/bump-sqlite.sh --dry-run

# Skip cooldown check
tools/bin/bump-sqlite.sh --force 3510400
```

The script performs these steps:

1. **Validate** the target version (numeric format, e.g., `3530300` for SQLite 3.53.3)
2. **Check** the source tree is clean (no uncommitted changes)
3. **Compare** the target version against the current version in `deps/common-sqlite.gypi`
4. **Enforce a cooldown** period (default: 7 days since the SQLite release) to allow the community to discover critical bugs
5. **Create** a feature branch (`feature/bump_sqlite_X.Y.Z_W.A.B`)
6. **Download** the new amalgamation zip from sqlite.org and verify its checksum
7. **Update** `deps/common-sqlite.gypi` — change `sqlite_version%` to the new version
8. **Update** `README.md` — update the bundled SQLite version reference
9. **Build** (`yarn rebuild`) to verify compilation
10. **Lint** (`yarn lint`) to ensure code quality
11. **Test** (`yarn test`) to verify functionality
12. **Commit** and **push** the feature branch

### Manual Steps

If you need to bump SQLite manually:

1. **Download** the amalgamation zip from [sqlite.org/download.html](https://sqlite.org/download.html) and place it in `deps/`
2. **Remove** the old zip from `deps/` and from git tracking:
```bash
git rm deps/sqlite-amalgamation-<OLD_VERSION>.zip
```
3. **Update** [`deps/common-sqlite.gypi`](../deps/common-sqlite.gypi) — change `sqlite_version%` to the new numeric version:
```
'sqlite_version%':'3530300',
```
4. **Update** [`README.md`](../README.md) — update the "Bundles SQLite v" reference (e.g., `Bundles SQLite v3.53.3`)
5. **Review** [`deps/sqlite3.gyp`](../deps/sqlite3.gyp) — check if any new SQLite compile flags or defines are needed (e.g., new extensions)
6. **Build and test**:
```bash
yarn rebuild
yarn lint
yarn test
```
7. **Commit** with a message like: `Bumped bundled SQLite from 3.XX.YY to 3.WW.ZZ`

### SQLite Version Number Format

SQLite uses a numeric version format `XYYZZ00` where:
- `X` = major version (always `3`)
- `YY` = minor version (zero-padded, e.g., `53`)
- `ZZ` = patch version (zero-padded, e.g., `03`)

For example, SQLite **3.53.3** → numeric version **3530300**.

### Key Files

| File | Purpose |
|----------------------------------|-------------------------------------------------------------------------------|
| `deps/common-sqlite.gypi` | Stores `sqlite_version%` — the single source of truth for the bundled version |
| `deps/sqlite3.gyp` | Build configuration for SQLite (compile flags, defines, extensions) |
| `deps/sqlite-amalgamation-*.zip` | The bundled SQLite amalgamation archive |
| `deps/extract.js` | Used at build time to extract the amalgamation zip |
| `tools/bin/bump-sqlite.sh` | Automated version bump script |
| `README.md` | Human-readable version reference |

## Upgrading Dependencies

When upgrading any npm dependency (e.g., `node-addon-api`, `node-gyp`, `node-gyp-build`), always verify that the new version's Node.js engine requirements are compatible with the project's declared minimum:

1. **Install the dependency** with the new version:
```bash
yarn add <package>@<version>
# or for devDependencies:
yarn add -D <package>@<version>
```

2. **Rebuild** native addons to pick up the new dependency:
```bash
yarn rebuild
```

3. **Run the semver check** to verify that no dependency requires a higher Node.js version than the project supports:
```bash
node tools/semver-check.js
```
This script checks all `dependencies` and `optionalDependencies` in [`package.json`](../package.json) and reports if any dependency's `engines.node` requirement exceeds the [`supportedVersions`](../tools/semver-check.js) constant.

If the check **fails**, you need to:
- Update `supportedVersions` in [`tools/semver-check.js`](../tools/semver-check.js) to match the new minimum
- Update `engines.node` in [`package.json`](../package.json) to the same version
- Update version references in [`README.md`](../README.md), [`docs/DEVELOP.md`](DEVELOP.md), and [`memory-bank/`](../memory-bank/) files

4. **Lint and test**:
```bash
yarn lint
yarn test
```

5. **Commit** with a message like: `Upgraded <package> from X.Y.Z to A.B.C`

## Code Quality

**IMPORTANT**: After making any code changes, always run:
Expand Down
4 changes: 2 additions & 2 deletions memory-bank/build-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ The `install` script runs `node-gyp-build` which tests whether the prebuilt bina

## Platform Support

- Node.js >= 22.1.0
- Node.js >=22.22.2
- NAPI: version-agnostic (`@homeofthings+sqlite3.*.node`), built with NAPI v9 on Node 22 (PREBUILD_NODE_VERSION)
- Platforms: Linux (glibc + musl), macOS, Windows (see CI configuration)

Expand Down Expand Up @@ -394,7 +394,7 @@ The project uses three GitHub Actions workflows for continuous integration and r

### Build Fails

1. Check Node.js version: `node --version` (must be >= 22.1.0)
1. Check Node.js version: `node --version` (must be >=22.22.2)
2. Check node-gyp version: `node-gyp --version`
3. Try clean rebuild: `node-gyp clean && node-gyp rebuild`
4. Check Python version (node-gyp requires Python 3)
Expand Down
2 changes: 1 addition & 1 deletion memory-bank/decisionLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ if (locked && pending == before_pending) {

### Node.js Version Requirement

**Decision**: Require Node.js >= 22.1.0
**Decision**: Require Node.js >=22.22.2

**Rationale**:
- Modern NAPI support
Expand Down
2 changes: 1 addition & 1 deletion memory-bank/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Prerequisites

- Node.js >= 22.1.0
- Node.js >=22.22.2
- Python 3 (for node-gyp)
- C++ compiler (gcc, clang, or MSVC)
- yarn or npm
Expand Down
2 changes: 1 addition & 1 deletion memory-bank/project-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

**Package Name**: `@homeofthings/sqlite3`

**Node.js Version**: >= 22.1.0
**Node.js Version**: >=22.22.2

## Architecture

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
"url": "https://github.com/gms1/node-sqlite3.git"
},
"dependencies": {
"node-addon-api": "^8.8.0",
"node-addon-api": "^8.9.0",
"node-gyp-build": "^4.8.4"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"eslint": "^10.4.1",
"globals": "^17.6.0",
"eslint": "^10.6.0",
"globals": "^17.7.0",
"mocha": "11.7.6",
"nyc": "^18.0.0",
"prebuildify": "^6.0.1",
Expand All @@ -61,10 +61,10 @@
}
},
"optionalDependencies": {
"node-gyp": "12.x"
"node-gyp": "13.x"
},
"engines": {
"node": ">=22.1.0"
"node": ">=22.22.2"
},
"scripts": {
"install": "node-gyp-build",
Expand Down
2 changes: 1 addition & 1 deletion tools/benchmark-drivers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Despite lower raw throughput, async drivers provide **Non-Blocking I/O**, by pre

## Requirements

- **Node.js**: v22.1.0 or later (for N-API compatibility)
- **Node.js**: v22.22.2 or later (for N-API compatibility)
- **For `node:sqlite`**: Node.js v22.6.0+ (experimental) or v22.12.0+ (stable)

## Installation
Expand Down
2 changes: 1 addition & 1 deletion tools/semver-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require('fs');
const path = require('path');
const semver = require('semver');

const supportedVersions = '22.1.0';
const supportedVersions = '22.22.2';

function checkEngines(modulePath) {
const packageJsonPath = path.join(modulePath, 'package.json');
Expand Down
Loading
Loading