This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Install dependencies
yarn
# Build the library
yarn prepare
# Type checking
yarn typecheck
# Linting
yarn lint
yarn lint --fix
# Tests
yarn test
# Run a single test file
yarn test src/__tests__/index.test.tsx
# Clean build artifacts
yarn clean
# Example app
yarn example start
yarn example android
yarn example iosThis is a React Native TurboModule library (New Architecture) for thermal receipt printing over Bluetooth, scaffolded with create-react-native-library.
src/— TypeScript source;index.tsxexports the public API,NativeReceiptPrinter.tsdefines theSpecinterface and retrieves the native module viaTurboModuleRegistry.getEnforcingandroid/src/main/java/com/receiptprinter/— Kotlin TurboModule implementation (ReceiptPrinterModule.kt) and package registration (ReceiptPrinterPackage.kt)ios/— Objective-C++ implementation (ReceiptPrinter.mm/ReceiptPrinter.h) with JSI bridgeexample/— Standalone demo app (Yarn workspace) for testing against real devices/simulatorslib/— Compiled output (generated byyarn prepare; do not edit manually)
The JS–native bridge works as follows:
src/NativeReceiptPrinter.tsdefines theSpecinterface (method signatures)codegenConfiginpackage.jsondrives codegen to produce native specs- Native classes (
ReceiptPrinterModuleon Android,ReceiptPrinteron iOS) implement the generated spec src/index.tsxwraps the native module and exposes the public API
- Yarn v4 workspaces — root +
example/app - Turbo (
turbo.json) —build:androidandbuild:iostasks with caching - Lefthook — pre-commit runs ESLint +
tsc --noEmiton staged files; commit-msg enforces Conventional Commits (Angular preset:fix,feat,refactor,docs,test,chore) - react-native-builder-bob — compiles
src/tolib/(ESM + TypeScript declarations; no CommonJS target)
tsconfig.json uses strict mode with bundler module resolution. The path alias react-native-receipt-printer → ./src/index lets the example app import the library source directly during development.
The library is scaffolded but not yet functional. All native modules currently expose only the placeholder multiply(a, b) stub from create-react-native-library. react-native-bluetooth-classic is installed as a runtime dependency but is not yet wired into any native or JS code. Actual Bluetooth discovery, connection, and ESC/POS printing logic still needs to be implemented.
yarn release runs release-it — bumps the version via Conventional Commits, tags the commit (v<version>), publishes to npm, and creates a GitHub release.