Skip to content

Add complete integration examples - #9

Merged
YauhenBichel merged 2 commits into
mainfrom
docs/examples
Sep 26, 2026
Merged

YauhenBichel merged 2 commits into
mainfrom
docs/examples

Conversation

@YauhenBichel

Copy link
Copy Markdown
Member

This adds full examples of using the package in an app. The README's "Use" section shows the API; these show a whole integration.

examples/

  • TapToMeasure.tsx: a React Native screen that measures with four taps, with no detector or ML model needed. The person taps the sticker's edges, then the ends of what they want measured. The result reads "About 6.2 mm (an estimate)", and refusals are in your own words.
  • fromDetector.ts: turns your detector's ellipse into lengths and areas. It uses a stricter tilt limit, and flags polygon coins (the £1 and 20p) as a rough scale.
  • compareTwoPhotos.ts: shows both sizes only when the photos were taken at a similar distance. Otherwise it says so and compares nothing. It never judges a change, and a test checks for words like "grown", "worse" or "risk".

They can't go stale

  • npm run typecheck, which CI already runs, now typechecks the examples as well. A small React Native type stub keeps React Native itself out of the dev dependencies.
  • __tests__/examples.test.ts runs the two plain examples and checks their numbers, for example 120 px next to a 200 px sticker comes out as 6.0 mm.

Unchanged: the package code and the published tarball. Its 36 files include no examples.

Checked locally

  • lint, format and types (including the examples) pass
  • 36 tests pass with 100% coverage
  • publint and arethetypeswrong report no problems

🤖 Generated with Claude Code

YauhenBichel and others added 2 commits September 26, 2026 18:59
examples/ has copy-paste starting points:
- TapToMeasure.tsx: a React Native screen that measures with four taps,
  no detector needed, shown as an estimate.
- fromDetector.ts: a detector's ellipse to lengths and areas, with a
  stricter tilt limit and a flag for polygon coins.
- compareTwoPhotos.ts: shows both sizes only when the photos were taken
  at a similar distance, and never judges a change.

npm run typecheck now covers them (a small React Native type stub keeps
React Native itself out of the dev dependencies), and a test runs the
plain ones and checks their numbers. Not in the published package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
paths in examples/tsconfig.json resolve from examples/, so './src' found
nothing and TypeScript fell back to the built lib/. CI lints before it
builds, so lint failed there. Checked with lib/ deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YauhenBichel
YauhenBichel merged commit 7c7de9a into main Sep 26, 2026
8 checks passed
@YauhenBichel
YauhenBichel deleted the docs/examples branch September 26, 2026 18:24
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