Skip to content

chore(deps-dev): bump better-sqlite3 to 12.4.1 - #11683

Closed
pkuczynski wants to merge 2 commits into
typeorm:masterfrom
pkuczynski:deps/better-sqlite3
Closed

pkuczynski wants to merge 2 commits into
typeorm:masterfrom
pkuczynski:deps/better-sqlite3

Conversation

@pkuczynski

@pkuczynski pkuczynski commented Sep 24, 2025 •

Copy link
Copy Markdown
Member

Description of change

There are no binaries provided for macOS Tahoe and compiling package from source requires extensive setup, which is cumbersome. I propose we move forward with better-sqlite3 to make it easier for developers to contribute.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • This pull request links relevant issues as Fixes #00000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change

Summary by CodeRabbit

  • Chores

    • Updated a development dependency (better-sqlite3) to a newer major version for improved compatibility and maintenance.
    • No impact on features, workflows, or runtime performance for end-users.
  • Documentation

    • Confirmed there are no changes to exported/public interfaces.
  • General

    • Maintenance-only update; no user-facing changes.

@coderabbitai

coderabbitai Bot commented Sep 24, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Updated the devDependency for better-sqlite3 from ^8.7.0 to ^12.4.1 and updated the package generation logic to use the new version string. No public API, control flow, or error handling changes.

Changes

Cohort / File(s) Summary of changes
Dev dependency bump
package.json, src/commands/InitCommand.ts
Bumped devDependencies.better-sqlite3 in package.json from ^8.7.0 to ^12.4.1. Updated generation logic in InitCommand.ts to emit the new version string. No other code, API, or behavior changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • alumni
  • naorpeled
  • michaelbromley
  • gioboa

Poem

I nibble versions in the night,
Swapped carrots in the dependency light.
No api hopped, no logic torn,
Just fresher roots for code to adorn. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly indicates that this pull request is a dev dependency chore bumping better-sqlite3 to version 12.4.1, which directly matches the primary change in package.json without including unrelated details or ambiguity.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 043b8cf and be15efa.

📒 Files selected for processing (1)
  • src/commands/InitCommand.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: tests-linux (20) / mysql_mariadb
  • GitHub Check: tests-linux (18) / sap
  • GitHub Check: tests-linux (20) / better-sqlite3
  • GitHub Check: tests-linux (20) / sqlite
  • GitHub Check: tests-linux (20) / mysql_mariadb_latest
  • GitHub Check: tests-linux (18) / better-sqlite3
  • GitHub Check: tests-linux (18) / mssql
  • GitHub Check: tests-linux (18) / mysql_mariadb
  • GitHub Check: tests-linux (18) / oracle
  • GitHub Check: tests-linux (18) / mongodb
  • GitHub Check: tests-linux (18) / mysql_mariadb_latest
  • GitHub Check: tests-linux (18) / postgres (17)
  • GitHub Check: tests-linux (18) / postgres (14)
  • GitHub Check: tests-linux (18) / sqlite
  • GitHub Check: tests-windows / sqljs
  • GitHub Check: tests-windows / better-sqlite3
  • GitHub Check: tests-windows / sqlite
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
src/commands/InitCommand.ts (1)

712-713: Template dependency bump stays in sync.

Matching the scaffolded package’s better-sqlite3 version with the root devDependency keeps generated projects aligned with the new prebuilt binaries expectations. Looks good.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented Sep 24, 2025 •

Copy link
Copy Markdown

typeorm-sql-js-example

npm i https://pkg.pr.new/typeorm/typeorm@11683

commit: be15efa

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4f7b44 and 043b8cf.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: tests-linux (20) / cockroachdb
  • GitHub Check: tests-linux (20) / oracle
  • GitHub Check: tests-linux (20) / sqljs
  • GitHub Check: tests-linux (20) / sqlite
  • GitHub Check: tests-linux (20) / better-sqlite3
  • GitHub Check: tests-linux (18) / sap
  • GitHub Check: tests-linux (18) / sqlite
  • GitHub Check: tests-linux (18) / oracle
  • GitHub Check: tests-linux (18) / mysql_mariadb
  • GitHub Check: tests-linux (18) / postgres (17)
  • GitHub Check: tests-linux (18) / postgres (14)
  • GitHub Check: tests-linux (18) / sqljs
  • GitHub Check: tests-linux (18) / better-sqlite3
  • GitHub Check: tests-linux (18) / mongodb
  • GitHub Check: tests-linux (18) / mssql
  • GitHub Check: tests-linux (18) / mysql_mariadb_latest
  • GitHub Check: tests-windows / sqljs
  • GitHub Check: tests-windows / better-sqlite3
  • GitHub Check: tests-windows / sqlite
  • GitHub Check: Analyze (javascript-typescript)

Comment thread package.json
"@types/source-map-support": "^0.5.10",
"@types/yargs": "^17.0.33",
"better-sqlite3": "^8.7.0",
"better-sqlite3": "^12.4.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

🧩 Analysis chain

Looks compatible; please verify Node engine support and macOS prebuilds for 12.4.1

  • Peer range already includes ^12.x — good.
  • Risk: [email protected] may require Node >=18. Your engines field is >=16.13.0. If engines < required, dev installs will fail.

Action: verify engines and that prebuilt binaries exist for macOS 15 (Sequoia) darwin-arm64 to satisfy the PR rationale.

Run:

If engines >=18 is required, consider bumping package.json "engines.node" and aligning @types/node accordingly in a follow-up.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Repo engines.node:"
jq -r '.engines.node' package.json || true

echo
echo "[email protected] engines (npm registry):"
curl -s https://registry.npmjs.org/better-sqlite3/12.4.1 | jq -r '.engines.node // "not specified"'

echo
echo "Release assets for darwin prebuilds (better-sqlite3 v12.4.1):"
gh release view v12.4.1 -R JoshuaWise/better-sqlite3 --json assets --jq '.assets[].name' | rg -nP '(?i)darwin|mac' -n -C0 || echo "No darwin assets detected (could indicate build-at-install or different naming)."

Length of output: 1785


Action: align Node engine or change better-sqlite3

Repo package.json declares "engines.node": ">=16.13.0" but [email protected] requires "20.x || 22.x || 23.x || 24.x" (npm). Release assets include darwin node-v115/127/131/137 arm64/x64 prebuilds (covers those Node ranges).

  • Options: bump package.json "engines.node" to >=20 (and update @types/node) OR pin/downgrade better-sqlite3 to a version compatible with Node 16/18.
  • Location: package.json — engines.node and dependency "better-sqlite3" (dependency at line ~130).

Comment thread package.json
"@types/source-map-support": "^0.5.10",
"@types/yargs": "^17.0.33",
"better-sqlite3": "^8.7.0",
"better-sqlite3": "^12.4.1",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this change, in the peerDeps we already have
"better-sqlite3": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0",
🤔
cc @alumni

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is for peer deps. The one I made was for dev deps. Version 8.7.0 is not distributed as binary anymore and requires compilation from source, at least on macOS Tahoe. So is it worth to be base for our tests, or would it be better to test with the latest version? I would vote for the second option. Alternatively we could (and probably should) setup testing for the whole supported matrix in CI. But for local dev, I would stick with the latest as it will always get most support.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason we didn't do this in the past was because we are still officially supporting Node.js 16, so we wanted the tests to be able to run on that version, even if we removed them from the CI.

[email protected] requires Node.js 20 and higher. We'll drop support for EOL node in our next major version, so we can upgrade this then.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of sense that answer. And how do you install version 8 on macOS? I could not find any instruction here...

@alumni alumni Sep 24, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so better-sqlite3 does not compile on node 22 (probably not just on MacOS). I am still running 20 locally in this repo - mainly because I want to generate a lockfile that still works in CI (and node 22 upgrades npm - we'll probably introduce corepack at some point to avoid such issues).

What if we use ^11.10.0? It already has prebuilds for node 18 and 20 (our CI runs on that, so it won't have to compile it), even up to node 23. I also managed to build it locally on MacOS on node 24.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am on Node 24, and 11.x does not have binaries and needs to be compiled from scratch. And since Node 24 is the current version, I think it's fine to stick to it, as most people will start with Node 24. And then they will have issues with installing dev depenedencies to create a PR.

How about we use latest version in dev deps, but test in a matrix in CI like this: #11688

I udated InitCommand but it got me wondering, if we should not reach to npm to get the latets version compatible with current node. What do you think?

@alumni alumni Sep 25, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am on Node 24, and 11.x does not have binaries and needs to be compiled from scratch.

Compiling on MacOS/Linux is not difficult. Compiling in the CI takes time and makes the CI slow.

And since Node 24 is the current version, I think it's fine to stick to it, as most people will start with Node 24

In production most companies use the LTS version of Node.js, currently 22. The stable version is seen as a development build.

How about we use latest version in dev deps, but test in a matrix in CI like this: #11688

We had this in the past with the mssql driver and we realized it does not bring any value and only makes the CI slow.

I udated InitCommand but it got me wondering, if we should not reach to npm to get the latets version compatible with current node.

This is not how Node.js works. We have some ideas to handle the lockfile better by pinning the package manager version using corepack, but I personally don't want to invest any effort in the 0.3.x releases in such things due to the fact that we need to keep support for old Node versions. Such things will happen in 1.0, including dropping support for old better-sqlite3. But until then, we can't use 12.x.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiling on MacOS/Linux is not difficult.

Not in this example, as it requires setting up Python env, so pain in the neck...

In production most companies use the LTS version of Node.js, currently 22.

Depends on the company. In most of those I worked for, current Node was always selected as the prime env...

We had this in the past with the mssql driver and we realized it does not bring any value and only makes the CI slow.

Yes, this would be the downside for too many jobs. It's either CI testing or users...

This is not how Node.js works.

Maybe you misunderstood what I was saying. I didn't refered to package.json but to to command which generates one when you call init (this is what InitCommand does, right?).

And updating devDependencies, which is proposed in this PR does not mean dropping support for older node, as the better-sqlite3 would not be installed for the end users. It's only for developers like me, right?

Feel free to close this PR if you feel it's unwanted. No offence taken :)

@alumni alumni Sep 25, 2025 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you misunderstood what I was saying

Aaaah you meant to get the version of better-sqlite3 from npm for the nodejs version that the user has. Sorry, I thought you meant to request smth from the nodejs team. Honestly, I'd don't like the init command at all and I'd remove it in the next major version if it were just for me. We have to talk about it with the rest of the maintainers, but it has little value nowadays.

Feel free to close this PR if you feel it's unwanted. No offence taken :)

For the better-sqlite3 version used as dev dependency, v11 is okay for most of the things, just v12 will make the current workflows slower. So no need to close this PR. We can merge it with v11 into 0.3 or with v12 into the next major.

We will have a meeting on Monday and talk about the next major, we'd like to start introducing breaking changes (removing deprecations, dropping support for old versions etc.) that are necessary to continue maintaining this repo.

BTW, I see you have quite a few PRs open, if you are interesting in contributing more feel free to reach out on Discord ;)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaaah you meant to get the version of better-sqlite3 from npm for the nodejs version that the user has.

Yeah, that's what I meant :) It does not make sense to propose user 8.x when user is already on node 22 or 24, since it would not even install. As we fund out in case of this PR :)

BTW, I see you have quite a few PRs open, if you are interesting in contributing more feel free to reach out on Discord ;)

Yeah, that was my intent to contribute a bit more :) I will reach out on Discord, sure. I am already there...

@alumni

alumni commented Oct 1, 2025

Copy link
Copy Markdown
Collaborator

#11382 was merged into next

@alumni alumni closed this Oct 1, 2025
@Ahmad-Mosha Ahmad-Mosha mentioned this pull request Oct 15, 2026
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants