Skip to content

Commit

Permalink
react-native
Browse files Browse the repository at this point in the history
  • Loading branch information
gutenye committed May 6, 2024
1 parent cecc7c0 commit 79f6cc1
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 7 deletions.
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"quickfix.biome": "explicit"
}
}
18 changes: 18 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.2/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded"
}
}
}
Binary file modified bun.lockb
Binary file not shown.
8 changes: 6 additions & 2 deletions examples/react-native/ake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

def main [] {}

def 'main build react-native' [] {
def 'main build' [] {
chokidar '../../src/**/*.ts' build.ts -c 'bun run build.ts' --initial
}
}

def 'main start' [] }

}
3 changes: 0 additions & 3 deletions packages/common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"#root/*": ["./*"]
},

"moduleSuffixes": [".browser", ""],

// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/ake
29 changes: 29 additions & 0 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@gutenye/ocr-react-native",
"description": "High accurate text detection (OCR) Javascript/Typescript library that runs on Node.js, Browser, and React Native. Based on PaddleOCR and ONNX runtime",
"version": "1.2.1",
"type": "module",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/gutenye/ocr.git",
"directory": "packages/react-native"
},
"exports": {
"react-native": "./src/index.ts",
"default": "./build/index.js"
},
"files": [
"src",
"build",
"tsconfig.json",
"!**/__tests__"
],
"scripts": {
"prepublishOnly": "./ake build"
},
"dependencies": {
"@gutenye/ocr-common": "^1.2.0",
"onnxruntime-react-native": "^1.17.3"
}
}
5 changes: 5 additions & 0 deletions packages/react-native/src/FileUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { FileUtilsBase } from '@gutenye/ocr-common'

export class FileUtils extends FileUtilsBase {
static async read(path: string) {}
}
18 changes: 18 additions & 0 deletions packages/react-native/src/ImageRaw.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ImageRawBase } from '@gutenye/ocr-common'
import type { ImageRawData, SizeOption, LineImage } from '@gutenye/ocr-common'

export class ImageRaw extends ImageRawBase {
static async open(path: string): Promise<ImageRaw> {}

constructor(imageRawData: ImageRawData) {
super(imageRawData)
}

async write(path: string) {}

async resize(size: SizeOption) {}

async drawBox(lineImages: LineImage[]) {}

async #apply(sharp: sharp.Sharp) {}
}
9 changes: 9 additions & 0 deletions packages/react-native/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Ocr, { registerBackend } from '@gutenye/ocr-common'
import { FileUtils } from './FileUtils'
import { ImageRaw } from './ImageRaw'
import { InferenceSession } from 'onnxruntime-react-native'

registerBackend({ FileUtils, ImageRaw, InferenceSession })

export * from '@gutenye/ocr-common'
export default Ocr
1 change: 1 addition & 0 deletions packages/react-native/tsconfig.build.json
1 change: 1 addition & 0 deletions packages/react-native/tsconfig.json

0 comments on commit 79f6cc1

Please sign in to comment.