fix: align iOS indices with JS + packaging hygiene; add release workflow#3
Merged
Merged
Conversation
- iOS: return UTF-16 offsets from NSDataDetector instead of grapheme distances so start/end align with JavaScript strings and Android's ML Kit char offsets (broke on emoji/accented/non-BMP text) - android: read version from package.json instead of hardcoded 0.1.0 so it never drifts from the published version again - package.json: add explicit "files" allowlist; stop shipping dev cruft (eslint/prettier/editorconfig/CONTRIBUTING) in the tarball - remove stale .npmignore (listed deleted files, missed new ones) - README: use absolute raw GitHub URL for hero image so it renders on npmjs.com
Decouple releasing from merging: fixes land in main at 0.2.0 (the last published version) and accumulate under CHANGELOG [Unreleased]. Publishing is gated on pushing a v* tag, not on merge. - add .github/workflows/release.yml: npm publish --provenance on v* tags, with a guard that the tag matches package.json version - add CHANGELOG.md (Keep a Changelog format) - revert version 0.2.1 -> 0.2.0; release happens later via npm version + tag
- drop NODE_AUTH_TOKEN/NPM_TOKEN secret; auth now via id-token (OIDC) trusted publisher configured on npmjs.com - upgrade npm to latest on the runner (OIDC needs >= 11.5.1) - provenance is generated automatically under trusted publishing, so the explicit --provenance flag is no longer needed
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.
iOS
start/endnow match JavaScript string indicesThe Swift module computed offsets with
text.distance(...)over Swift'sCharacter(grapheme) view. JavaScript strings, and Android's ML Kitannotation.start/end, use UTF-16 offsets. So for any text with emoji, accents, or non-BMP characters, iOS returned indices that disagreed with Android and broketext.slice(start, end)in JS. Now returns the raw UTF-16NSRangeoffsets. (ASCII text hid this, which is why it passed manual testing.)Android
build.gradleversion driftWas hardcoded to
0.1.0while the package was at0.2.0. Now readsversionfrompackage.json(same as the podspec), so it can never drift again.Explicit
filesallowlist inpackage.jsonThe tarball was shipping dev cruft (
eslint.config.js,.editorconfig,.prettierrc,.prettierignore,CONTRIBUTING.md). Replaced the brittle, stale.npmignorewith an allowlist.npm pack --dry-runnow ships onlysrc,build,android,ios, config, README, and LICENSE.README hero image renders on npmjs.com
Switched the relative
data-detector.png<img>to an absoluteraw.githubusercontent.comURL. The PNG is excluded from the tarball, so the relative path was broken on the npm page.