Skip to content

Chore/prepare npm publish#2

Merged
prashantdixittt merged 4 commits into
mainfrom
chore/prepare-npm-publish
Mar 2, 2026
Merged

Chore/prepare npm publish#2
prashantdixittt merged 4 commits into
mainfrom
chore/prepare-npm-publish

Conversation

@prashantdixittt
Copy link
Copy Markdown
Collaborator

What it does

Prepares the library for npm publish under @lokal-dev/react-native-device-metrics: updates docs and package metadata, fixes example and TS resolution for the new scope, and configures CI so the Android build can resolve the device-telemetry-toolkit dependency from GitHub Packages.

Why we did it

  • Publish the package on npm under the @lokal-dev scope.
  • Align README and API docs with the current implementation so install, usage, and publishing steps are accurate.
  • Fix example app and TypeScript so they use the scoped package name and resolve correctly in the repo.
  • Unblock the Android CI job that was failing due to missing GitHub Packages credentials for device-telemetry-toolkit.

Changes

  • README.md — Title and badges updated for @lokal-dev/react-native-device-metrics; features, requirements, installation, and API reference simplified and corrected (e.g. getWeightedPerformanceLevels returns parsed object; getLatest* and getPerformanceLevel documented accurately); removed TOC, Kotlin requirement, and Publishing prerequisites; added npm login to manual release steps.
  • package.jsonname set to @lokal-dev/react-native-device-metrics; description updated; publishConfig.access: "public"; files includes README.md and LICENSE; author set to { name, email } (no url).
  • example/src/App.tsx — Import updated to @lokal-dev/react-native-device-metrics.
  • tsconfig.json — Path mapping added for @lokal-dev/react-native-device-metrics so the example and IDE resolve the scoped package.
  • .github/workflows/ci.yml — In build-android: permissions (contents: read, packages: read); env with GITHUB_USERNAME (github.repository_owner) and GITHUB_TOKEN (secrets.DEVICE_TELEMETRY_GITHUB_TOKEN) so Gradle can fetch device-telemetry-toolkit from GitHub Packages.

Test Plan

  • Run yarn prepare at repo root and confirm build succeeds.
  • Run yarn typecheck and yarn lint; no errors.
  • In example app, confirm import from @lokal-dev/react-native-device-metrics resolves (no red underline) and app runs.
  • Push branch and confirm CI passes (lint, test, build-library, build-android, build-ios).
  • After merge, run through README install + Quick Start in a fresh app (or example) and sanity-check one flow (e.g. init + raw or detailed collection).

AI Used (~95%)

  • What: README restructure and accuracy fixes; package.json metadata and author format; example import and tsconfig path mapping; CI env and permissions for GitHub Packages; commit/PR message suggestions.
  • Tool: Cursor
  • Prompt gist: Refine README for npm, align APIs with code, update package name/author/files, fix example and TS resolution, add GitHub Packages auth to Android CI, remove comments and finalize ci.yml.
  • Manual changes after AI: Review and minor wording tweaks; adding repo secret DEVICE_TELEMETRY_GITHUB_TOKEN in GitHub Settings; running commits and pushing.

- Set package name to @lokal-dev/react-native-device-metrics
- Add publishConfig.access, author object, files (README, LICENSE)
- Polish README: structure, API reference accuracy, remove TOC/Prerequisites
- Add npm login to manual release steps
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 2, 2026

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • Documentation

    • Reorganized and restructured README for improved readability and clarity.
    • Added new Performance Classes and Levels sections with code examples.
    • Explicitly highlighted Android-only support and iOS limitations.
    • Clarified GitHub Packages authentication and Expo configuration guidance.
  • Chores

    • Updated package name to the scoped package format.
    • Updated package metadata, keywords, and author information.
    • Updated import paths and configuration aliases.

Walkthrough

This pull request renames the package from react-native-device-metrics to @lokal-dev/react-native-device-metrics and updates related configurations, documentation, and imports accordingly. GitHub Actions permissions and environment variables were added for CI authentication.

Changes

Cohort / File(s) Summary
Package Configuration
package.json, tsconfig.json
Updated package name to scoped format, added path alias for new package name, expanded keywords, converted author to object format, and added public files and access configuration.
CI/CD Configuration
.github/workflows/ci.yml
Added permissions block (read for contents and packages) and environment variables (GITHUB_USERNAME and GITHUB_TOKEN) to build-android job.
Documentation
README.md
Reorganized content with updated package name, rebranded features section, added Android-only notice, clarified requirements and GitHub Packages authentication guidance, and added performance classes documentation.
Example Application
example/src/App.tsx
Updated import path from react-native-device-metrics to @lokal-dev/react-native-device-metrics.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preparing the package for npm publication with the new scoped name and metadata updates.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the purpose, changes made, test plan, and AI assistance used.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/prepare-npm-publish

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on preparing the React Native device metrics library for public npm distribution under a new organizational scope. It includes comprehensive updates to documentation, package metadata, and build configurations to ensure seamless installation, usage, and continuous integration for Android, addressing previous dependency resolution issues.

Highlights

  • Package Renaming and Scoping: The library has been renamed to '@lokal-dev/react-native-device-metrics' and is now prepared for npm publishing under this new scope.
  • Documentation Updates: The README.md file has been extensively updated to reflect the new package name, clarify features, requirements, installation steps (especially for GitHub Packages authentication), API reference, and publishing instructions.
  • Dependency Resolution and CI Configuration: The example application's import paths and the TypeScript configuration have been updated to correctly resolve the new scoped package name. Additionally, the CI workflow for Android builds has been configured to properly resolve the 'device-telemetry-toolkit' dependency from GitHub Packages.
  • Package Metadata Refinement: The 'package.json' file has been updated with the new scoped name, a revised description, inclusion of 'README.md' and 'LICENSE' in the published files, and a structured author field, along with setting public access for publishing.
  • Dependency Version Bumps: Numerous development and runtime dependencies across the project have been updated to their latest versions, reflected in the 'yarn.lock' file.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Updated title and badges to reflect the new scoped package name.
    • Revised features, requirements, installation, and API reference for clarity and accuracy.
    • Removed outdated sections like TOC, Kotlin requirement, and some publishing prerequisites.
    • Added 'npm login' to manual release steps.
    • Clarified Android-only support and GitHub Packages configuration.
    • Improved formatting for various sections including Performance Classes & Levels, Collection Flows, Troubleshooting, and Publishing.
  • example/src/App.tsx
    • Modified the import statement to reflect the new scoped package name.
  • package.json
    • Changed the package 'name' to '@lokal-dev/react-native-device-metrics'.
    • Updated the package 'description'.
    • Included 'README.md' and 'LICENSE' in the 'files' array for publishing.
    • Formatted the 'author' field as an object with name and email.
    • Set 'publishConfig.access' to 'public'.
    • Added new keywords: 'device-metrics', 'performance', 'telemetry', 'turbo-module'.
  • tsconfig.json
    • Added a path mapping for '@lokal-dev/react-native-device-metrics' to resolve to './src/index'.
  • yarn.lock
    • Updated numerous dependency versions and their corresponding checksums.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci.yml
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
README.md (1)

30-30: Nitpick: Consider "incompatible" for conciseness.

-| **Expo (dev client)**| SDK 50+ (not compatible with Expo Go) |
+| **Expo (dev client)**| SDK 50+ (incompatible with Expo Go) |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 30, Update the table entry text to use the shorter
adjective "incompatible": replace the cell value "**Expo (dev client)**| SDK 50+
(not compatible with Expo Go)" with "**Expo (dev client)**| SDK 50+
(incompatible with Expo Go)" so the README uses the more concise phrasing;
locate the string "not compatible with Expo Go" in README.md and change it to
"incompatible with Expo Go".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@README.md`:
- Line 30: Update the table entry text to use the shorter adjective
"incompatible": replace the cell value "**Expo (dev client)**| SDK 50+ (not
compatible with Expo Go)" with "**Expo (dev client)**| SDK 50+ (incompatible
with Expo Go)" so the README uses the more concise phrasing; locate the string
"not compatible with Expo Go" in README.md and change it to "incompatible with
Expo Go".

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

Disabled knowledge base sources:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d3f5309 and e50b78f.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/ci.yml
  • README.md
  • example/src/App.tsx
  • package.json
  • tsconfig.json

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively prepares the library for its initial public release on npm under the @lokal-dev scope. The updates to package metadata, documentation, and build configurations are well-executed. The API simplification, by removing the *Parsed methods, is a welcome improvement for clarity. My review includes a few suggestions for the README.md to enhance the installation instructions, ensuring a smoother setup process for developers, especially concerning credential handling for dependencies from GitHub Packages.

Comment thread README.md
Comment on lines 257 to +267
memory: {
low: {
approxHeapRemainingInMBThreshold: 32,
approxHeapLimitInMBThreshold: 64,
},
average: {
approxHeapRemainingInMBThreshold: 64,
approxHeapLimitInMBThreshold: 128,
availableRamGBThreshold: 1.5,
},
high: {
approxHeapRemainingInMBThreshold: 256,
availableRamGBThreshold: 3,
},
low: { approxHeapRemainingInMBThreshold: 32, approxHeapLimitInMBThreshold: 64 },
average: { approxHeapRemainingInMBThreshold: 64, approxHeapLimitInMBThreshold: 128, availableRamGBThreshold: 1.5 },
high: { approxHeapRemainingInMBThreshold: 256, availableRamGBThreshold: 3 },
},
battery: {
excellent: {
batteryPercentageThreshold: 80,
isChargingBatteryPercentageThreshold: 70,
temperatureThreshold: 30,
},
high: {
batteryPercentageThreshold: 55,
isChargingBatteryPercentageThreshold: 50,
temperatureThreshold: 34,
},
average: {
batteryPercentageThreshold: 40,
isChargingBatteryPercentageThreshold: 35,
temperatureThreshold: 38,
},
excellent: { batteryPercentageThreshold: 80, isChargingBatteryPercentageThreshold: 70, temperatureThreshold: 30 },
high: { batteryPercentageThreshold: 55, isChargingBatteryPercentageThreshold: 50, temperatureThreshold: 34 },
average: { batteryPercentageThreshold: 40, isChargingBatteryPercentageThreshold: 35, temperatureThreshold: 38 },
},
// ... cpu, network, storage thresholds
// ... cpu, network, storage
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This code block has been made very compact, which harms readability. For a documentation example, clarity is more important than saving a few lines. Please consider reformatting this to be more readable, similar to its previous state, to improve developer experience.

  memory: {
    low: {
      approxHeapRemainingInMBThreshold: 32,
      approxHeapLimitInMBThreshold: 64,
    },
    average: {
      approxHeapRemainingInMBThreshold: 64,
      approxHeapLimitInMBThreshold: 128,
      availableRamGBThreshold: 1.5,
    },
    high: {
      approxHeapRemainingInMBThreshold: 256,
      availableRamGBThreshold: 3,
    },
  },
  battery: {
    excellent: {
      batteryPercentageThreshold: 80,
      isChargingBatteryPercentageThreshold: 70,
      temperatureThreshold: 30,
    },
    high: {
      batteryPercentageThreshold: 55,
      isChargingBatteryPercentageThreshold: 50,
      temperatureThreshold: 34,
    },
    average: {
      batteryPercentageThreshold: 40,
      isChargingBatteryPercentageThreshold: 35,
      temperatureThreshold: 38,
    },
  },
  // ... cpu, network, storage

@prashantdixittt prashantdixittt self-assigned this Mar 2, 2026
@prashantdixittt prashantdixittt merged commit 0a39a1c into main Mar 2, 2026
6 checks passed
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