Skip to content

fix: move @webbtc/webln-types to dependencies - #585

Open
Steve0x2a wants to merge 1 commit into
getAlby:masterfrom
Steve0x2a:fix/webln-types-runtime-dep
Open

Steve0x2a wants to merge 1 commit into
getAlby:masterfrom
Steve0x2a:fix/webln-types-runtime-dep

Conversation

@Steve0x2a

@Steve0x2a Steve0x2a commented Sep 7, 2026

Copy link
Copy Markdown

Published .d.ts files import @webbtc/webln-types, but that package was only listed under devDependencies. TypeScript consumers that do not install it themselves fail with:

Cannot find module '@webbtc/webln-types' or its corresponding type declarations.

import type is used at the source import sites. The published declarations still re-export those types, so the package is moved to dependencies so package managers install it for consumers.

A smoke test packs the SDK and typechecks a clean TypeScript project that does not add @webbtc/webln-types itself.

Fixes #234

Reported by @rolznz

Summary by CodeRabbit

  • Bug Fixes

    • Ensured published packages include the WebLN type definitions required for consumers to typecheck successfully without additional manual installation.
  • Tests

    • Added coverage verifying clean, production-only installations can compile consumer code using the SDK and OAuth APIs.

Published d.ts files import @webbtc/webln-types, so consumers must
resolve it without installing the types package by hand. Use import
type at the source sites; keep the package in dependencies while the
declarations re-export those types.

Signed-off-by: Yi Zhan <stevesough@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: b05765e7-6c77-4387-830a-2e9c345ad743

📥 Commits

Reviewing files that changed from the base of the PR and between 5696f97 and d2760e8.

📒 Files selected for processing (4)
  • package.json
  • src/oauth/client.ts
  • src/webln-types-consumer.smoke.test.ts
  • src/webln/NostrWeblnProvider.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The package now declares @webbtc/webln-types as a runtime dependency. WebLN imports use type-only syntax. A smoke test validates tarball installation and TypeScript consumer typechecking without development dependencies.

Changes

WebLN type dependency

Layer / File(s) Summary
Runtime dependency and type-only imports
package.json, src/webln/NostrWeblnProvider.ts, src/oauth/client.ts
Moves @webbtc/webln-types to runtime dependencies and changes its TypeScript-only imports to type-only imports.
Consumer packaging validation
src/webln-types-consumer.smoke.test.ts
Packs the package, installs it without development dependencies, and typechecks a clean consumer project that imports SDK declarations.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to d2760

The SDK now ships its required WebLN type dependency for TypeScript consumers while preserving runtime import behavior. The packaged consumer path is covered, with no remaining merge-readiness risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: moving @webbtc/webln-types to runtime dependencies.
Linked Issues check ✅ Passed The changes address issue #234 by declaring @webbtc/webln-types as a runtime dependency and adding a smoke test that verifies clean TypeScript consumers can resolve the declarations without manual ins…
Out of Scope Changes check ✅ Passed All changes support the linked issue. The type-only import updates preserve runtime behavior and support the dependency correction. No unrelated changes are present.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@rolznz

rolznz commented Sep 15, 2026

Copy link
Copy Markdown
Member

Hi, thanks for the PR! I'll review and test this before doing the next release.

@rolznz rolznz added this to the v8.1.0 milestone Sep 15, 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.

Build error caused by @webbtc/webln-types when including @getalby/sdk in standard typescript project

2 participants