diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..11989fc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Release + +# Publishing is gated on pushing a version tag (e.g. v0.2.1), NOT on merging to +# main. Merge freely; main accumulates unreleased changes. When you're ready to +# ship, run `npm version patch|minor|major` and `git push --follow-tags`. +on: + push: + tags: + - 'v*' + +jobs: + publish: + name: Publish to npm + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # required for OIDC Trusted Publishing + provenance + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: npm + registry-url: 'https://registry.npmjs.org' + + # Trusted Publishing (OIDC) requires npm >= 11.5.1; the bundled npm may be older. + - run: npm install -g npm@latest + + - run: npm ci + + - name: Verify tag matches package.json version + run: | + PKG_VERSION="v$(node -p "require('./package.json').version")" + if [ "$PKG_VERSION" != "$GITHUB_REF_NAME" ]; then + echo "::error::Tag $GITHUB_REF_NAME does not match package.json version $PKG_VERSION" + exit 1 + fi + + - run: npm run lint + - run: npm run test + - run: npm run build + + # No NODE_AUTH_TOKEN: auth is via OIDC Trusted Publishing (configured on + # npmjs.com). npm mints a short-lived token from the id-token permission + # and generates provenance automatically. + - name: Publish + run: npm publish diff --git a/.npmignore b/.npmignore deleted file mode 100644 index e9f611a..0000000 --- a/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -__mocks__ -__tests__ -.eslintrc.js -babel.config.js -tsconfig.json -example/ -*.png -.github/ -.claude/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..158ff87 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,32 @@ +# Changelog + +All notable changes to this project are documented here. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Fixed + +- iOS: return UTF-16 offsets from `NSDataDetector` instead of grapheme-cluster + distances, so `start`/`end` align with JavaScript string indices and Android's + ML Kit char offsets. Previously mismatched on text containing emoji, accented, + or non-BMP characters. +- Android: read the library version from `package.json` instead of a hardcoded + value, so `build.gradle` can no longer drift from the published version. + +### Changed + +- Ship an explicit `files` allowlist in `package.json` and drop the stale + `.npmignore`; development config (ESLint, Prettier, EditorConfig, CONTRIBUTING) + is no longer included in the published tarball. +- README hero image now uses an absolute URL so it renders on npmjs.com. + +## [0.2.0] + +- Initial public release: cross-platform text data detection using + `NSDataDetector` on iOS and ML Kit Entity Extraction on Android. + +[Unreleased]: https://github.com/pablogdcr/react-native-data-detector/compare/v0.2.0...HEAD +[0.2.0]: https://github.com/pablogdcr/react-native-data-detector/releases/tag/v0.2.0 diff --git a/README.md b/README.md index 1c8cac7..ea1d613 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Cross-platform text data detection for React Native. Uses **NSDataDetector** on iOS and **ML Kit Entity Extraction** on Android to detect phone numbers, URLs, emails, dates, and addresses — returning structured results to JavaScript.
-
+