Add complete integration examples - #9
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsruns 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
🤖 Generated with Claude Code