From 53962694dc84a9e061de7ebc20ae6819f5ed7fa5 Mon Sep 17 00:00:00 2001 From: prashantdixittt Date: Thu, 7 May 2026 16:49:51 +0530 Subject: [PATCH] chore: clean up README, gut app.plugin.js to no-op, and fix compileSdkVersion (#7) * chore: clean up README, gut app.plugin.js to no-op, and fix compileSdkVersion - Remove stale GitHub Packages references from README - Fix compileSdkVersion to 36+ to match build.gradle - Update Publishing section for automated CI/CD flow - Replace app.plugin.js with a no-op placeholder * fix(docs): revert compileSdkVersion to 35+ in README Workaround in build.gradle still pins core-ktx to 1.13.1 to support consumers on compileSdk 35. --- README.md | 48 +++++++++++------------------------ app.plugin.js | 70 +++------------------------------------------------ 2 files changed, 17 insertions(+), 101 deletions(-) diff --git a/README.md b/README.md index d41f59e..d8ff650 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,7 @@ Real-time device performance monitoring and telemetry for React Native. Collect ### Android - **minSdkVersion**: 24 -- **compileSdkVersion**: 35+ - -This library depends on a native Android SDK published to **Maven Central**. No additional repository configuration is needed. +- **compileSdkVersion**: 35+ --- @@ -48,29 +46,13 @@ npm install @lokal-dev/react-native-device-metrics yarn add @lokal-dev/react-native-device-metrics ``` -Linking is automatic. The native Android dependency resolves from **Maven Central** — no additional repository configuration needed. - ### React Native CLI No additional setup required. ### Expo -Add the config plugin in `app.json`: - -```json -{ - "expo": { - "plugins": ["@lokal-dev/react-native-device-metrics"] - } -} -``` - -Then create a **development build** (Expo Go is not supported): - -```bash -npx expo run:android -``` +No additional setup required. Expo Go is not supported — use a development build. --- @@ -260,10 +242,6 @@ await DeviceMetrics.init(customThresholds); ## Troubleshooting -### Build - -- **AGP / Kotlin version errors** — Align Android Gradle Plugin and Kotlin versions with React Native 0.73+ (e.g. Kotlin 1.8.0+). - ### Runtime - **`Cannot read property 'init' of undefined`** — Clean build and Metro cache: @@ -278,22 +256,24 @@ await DeviceMetrics.init(customThresholds); ## Publishing -### Manual release +Publishing is automated via GitHub Actions. The `publish.yml` workflow triggers on any `v*` tag push, runs validation, and publishes to npm with provenance attestation. + +### Stable release + +```bash +git checkout main && git pull origin main +yarn release # select the next stable version e.g. 1.0.1 +``` -1. Ensure you're logged in to npm: `npm login` -2. Commit all changes, clean working tree. -3. Build: `yarn prepare` -4. Bump: `npm version patch` (or `minor` / `major`) -5. Publish: `npm publish --access public` -6. Push: `git push && git push --tags` +release-it bumps `package.json`, generates `CHANGELOG.md`, commits, tags `v1.0.1`, and pushes. The tag push triggers the publish pipeline which publishes under the `latest` dist-tag. -### Automated (release-it) +### Beta / pre-release ```bash -yarn release +yarn release --preRelease=beta # produces 1.0.1-beta.0, 1.0.1-beta.1, etc. ``` -This bumps version, tags, publishes to npm, and can create a GitHub release (if configured). +Published under the `beta` dist-tag — `latest` is not affected. --- diff --git a/app.plugin.js b/app.plugin.js index 152d21a..c93775e 100644 --- a/app.plugin.js +++ b/app.plugin.js @@ -1,69 +1,5 @@ -const { - withProjectBuildGradle, - createRunOncePlugin, -} = require('@expo/config-plugins'); +const { createRunOncePlugin } = require('@expo/config-plugins'); const pkg = require('./package.json'); -const MAVEN_REPO_BLOCK = ` - maven { - url = uri("https://maven.pkg.github.com/lokal-app/device-telemetry-toolkit") - credentials { - username = System.getenv("GITHUB_USERNAME") ?: "lokal-app" - password = System.getenv("GITHUB_TOKEN") ?: "" - } - }`; - -const ALLPROJECTS_BLOCK = ` -allprojects { - repositories {${MAVEN_REPO_BLOCK} - } -} -`; - -function addDeviceTelemetryGithubPackageRepo(config) { - return withProjectBuildGradle(config, (gradleConfig) => { - const { contents } = gradleConfig.modResults; - - if ( - contents.includes( - 'maven.pkg.github.com/lokal-app/device-telemetry-toolkit' - ) - ) { - return gradleConfig; - } - - const allprojectsMatch = contents.match(/\ballprojects\s*\{/); - - if (allprojectsMatch) { - const blockStart = allprojectsMatch.index + allprojectsMatch[0].length; - const repoMatch = contents - .slice(blockStart) - .match(/^\s*repositories\s*\{/); - - if (repoMatch) { - const repoOpenBraceIndex = - blockStart + repoMatch.index + repoMatch[0].length - 1; - gradleConfig.modResults.contents = - contents.slice(0, repoOpenBraceIndex + 1) + - MAVEN_REPO_BLOCK + - contents.slice(repoOpenBraceIndex + 1); - } else { - const repoBlock = `\n repositories {${MAVEN_REPO_BLOCK}\n }`; - gradleConfig.modResults.contents = - contents.slice(0, blockStart) + - repoBlock + - contents.slice(blockStart); - } - } else { - gradleConfig.modResults.contents = contents + '\n' + ALLPROJECTS_BLOCK; - } - - return gradleConfig; - }); -} - -module.exports = createRunOncePlugin( - addDeviceTelemetryGithubPackageRepo, - pkg.name, - pkg.version -); +// Placeholder for future Expo config plugin functionality. +module.exports = createRunOncePlugin((config) => config, pkg.name, pkg.version);