Skip to content

chore: declare dbus-next as optional peer dependency#80

Closed
stoprocent wants to merge 1 commit into
mainfrom
chore/dbus-next-optional-peer
Closed

chore: declare dbus-next as optional peer dependency#80
stoprocent wants to merge 1 commit into
mainfrom
chore/dbus-next-optional-peer

Conversation

@stoprocent
Copy link
Copy Markdown
Owner

Summary

  • Adds dbus-next: ^0.10.0 under peerDependencies with peerDependenciesMeta.optional: true
  • Replaces the undocumented, prose-only requirement (in README + lazy require error message) with a machine-readable version range
  • No runtime behavior change — the binding still lazily requires dbus-next and falls back to a friendly install error if missing

Why

@stoprocent/bluetooth-hci-socket is in optionalDependencies because it's a native build that breaks installs on macOS/Windows. dbus-next is pure JS but Linux-only by purpose — making it a hard or optional dependency would pull a Linux-only library onto every Mac/Win install. The peer-optional pattern is the standard idiom for plug-in backends (eslint plugins, vite plugins, jest reporters, etc.) and gives us:

  • Renovate/Dependabot/npm ls visibility into the supported version range
  • No phantom install on platforms that don't use the D-Bus backend (npm 7+ does not auto-install optional peers)
  • Same UX as today for missing-peer: the existing try/catch around require('dbus-next') still surfaces the install hint

The intent already leaked into lib/dbus/bindings.js:37 ("dbus-next is an optional peer of this Linux-only backend"); this just makes the manifest reflect that.

Test plan

  • npm test — 17 suites, 654 tests pass
  • npm run lint — clean
  • npm install --dry-run — manifest validates
  • CI green on Linux/macOS/Windows
  • Verify npm ls dbus-next warns appropriately when the D-Bus backend is selected without dbus-next installed (manual, Linux)

🤖 Generated with Claude Code

Replaces undocumented prose-only requirement with a machine-readable
version range so Renovate/Dependabot/`npm ls` can track supported
versions. Marked optional so npm doesn't auto-install on Mac/Win.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@stoprocent stoprocent closed this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant