Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
14 changes: 12 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,38 @@ runs:
with:
node-version-file: .nvmrc

- name: Enable Corepack
run: corepack enable
shell: bash

Comment on lines +12 to +15

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

πŸ’‘ Verification agent

🧩 Analysis chain

Corepack version pin: verify packageManager is set

Ensure package.json (and example/package.json if applicable) has a packageManager: "yarn@<exact>" entry so corepack enable activates the intended Yarn version.


🏁 Script executed:

#!/bin/bash
# Inspect packageManager fields
jq -r '.packageManager // "MISSING"' package.json 2>/dev/null || true
jq -r '.packageManager // "MISSING"' example/package.json 2>/dev/null || true

Length of output: 130


Add missing packageManager field to example/package.json

The root package.json already specifies "packageManager": "yarn@3.6.1", but example/package.json is missing this field. Without it, corepack enable may not pick up the intended Yarn version when running the example workflow.

β€’ In example/package.json, add:

  "packageManager": "yarn@3.6.1"

to match the root configuration and ensure Corepack correctly activates Yarn v3.6.1.

πŸ€– Prompt for AI Agents
In .github/actions/setup/action.yml around lines 12 to 15: update the example
project's package.json to include the missing packageManager field so Corepack
uses the intended Yarn version; open example/package.json and add
"packageManager": "yarn@3.6.1" at the top-level of the JSON (alongside
name/version/etc.) to match the root package.json and ensure corepack enable
picks Yarn v3.6.1.

- name: Restore dependencies
id: yarn-cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
**/node_modules
.yarn/cache
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('package.json', 'example/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
run: |
# Use immutable install for Yarn v3
yarn install --immutable
shell: bash
env:
NODE_OPTIONS: --max-old-space-size=4096

- name: Cache dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
**/node_modules
.yarn/cache
.yarn/install-state.gz
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}
33 changes: 23 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ on:
types:
- checks_requested

env:
# Increase Node.js memory to prevent allocation errors
NODE_OPTIONS: --max-old-space-size=4096
# Ensure Yarn uses immutable installs
YARN_ENABLE_IMMUTABLE_INSTALLS: true

jobs:
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -54,13 +60,19 @@ jobs:
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/android
CI: 1
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup
uses: ./.github/actions/setup

- name: Install example dependencies
run: cd example && yarn install --immutable
env:
NODE_OPTIONS: --max-old-space-size=4096

- name: Cache turborepo for Android
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
Expand Down Expand Up @@ -102,22 +114,29 @@ jobs:

- name: Build example for Android
env:
JAVA_OPTS: "-XX:MaxHeapSize=6g"
JAVA_OPTS: '-XX:MaxHeapSize=6g'
CI: 1
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"

build-ios:
runs-on: macos-latest
env:
XCODE_VERSION: 16.2
XCODE_VERSION: 16.4
TURBO_CACHE_DIR: .turbo/ios
CI: 1
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup
uses: ./.github/actions/setup

- name: Install example dependencies
run: cd example && yarn install --immutable
env:
NODE_OPTIONS: --max-old-space-size=4096

- name: Cache turborepo for iOS
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
Expand All @@ -140,14 +159,8 @@ jobs:
with:
xcode-version: ${{ env.XCODE_VERSION }}

- name: Install cocoapods
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
cd example
bundle install
bundle exec pod repo update --verbose
bundle exec pod install --project-directory=ios

- name: Build example for iOS
env:
CI: 1
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
29 changes: 29 additions & 0 deletions .github/workflows/env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Environment Configuration

on:
workflow_call:

env:
# Node.js memory settings to prevent OOM errors
NODE_OPTIONS: --max-old-space-size=4096

# Yarn settings for better CI performance
YARN_ENABLE_IMMUTABLE_INSTALLS: true
YARN_ENABLE_GLOBAL_CACHE: false

# Disable telemetry for various tools
NEXT_TELEMETRY_DISABLED: 1
TURBO_TELEMETRY_DISABLED: 1

jobs:
validate-environment:
runs-on: ubuntu-latest
steps:
- name: Check Node version
run: node --version

- name: Check Yarn version
run: yarn --version

- name: Check available memory
run: free -h
18 changes: 11 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.0] - 2025-08-26
## [0.1.0] - 2025-08-27

### Added

- Initial release of React Native Image Code Scanner
- Native implementation for iOS using Vision Framework
- Native implementation for Android using ML Kit
- Support for 13 barcode formats (QR Code, Code 128, Code 39, etc.)
- Advanced image preprocessing options:
- **Automatic image preprocessing** for optimal recognition:
- Contrast enhancement
- Grayscale conversion
- Automatic rotation attempts
- Platform-specific preprocessing overrides
- Multiple rotation attempts (0Β°, 90Β°, 180Β°, 270Β°)
- **Ultra-simple API** - just pass image path and formats, preprocessing is automatic by default
- Full support for React Native's New Architecture (Turbo Modules)
- TypeScript support with complete type definitions
- Comprehensive documentation and examples
Expand All @@ -27,19 +28,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Cross-platform example app (iOS, Android, Web)

### Features

- Lightweight and performant native implementation
- Smart retry logic with image preprocessing
- **Automatic preprocessing** enabled by default for best results
- Smart retry logic with multiple image enhancement techniques
- No additional setup required for Android
- Minimal iOS setup with just pod install
- **Expo integration** with proper prebuild workflow
- **Modern example app** using Expo Image Picker and StatusBar
- **Real-time configuration** of preprocessing options
- **Simplified API** - just pass image path and formats
- **Performance metrics** and timing measurements

### Example App Features

- Modern Expo-based example application
- Barcode format selection UI with real-time toggles
- Enhanced preprocessing options with visual controls
- Automatic preprocessing info with optional disable switch
- Improved error handling and user feedback
- Comprehensive setup documentation
- Support for both Expo Go (UI testing) and prebuild (full functionality)
Expand Down
Loading
Loading