npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

co-push

v1.1.1

Published

## πŸš€ React Native Over-the-Air (OTA) Update Package

Downloads

26

Readme

πŸ“¦ co-push

πŸš€ React Native Over-the-Air (OTA) Update Package

co-push is a lightweight React Native package for checking and downloading updates from a remote server without requiring an app store release. It downloads the latest JavaScript bundle and reloads the app seamlessly.

πŸ“Œ Installation

npm install co-push

or

yarn add co-push

Peer Dependencies

Make sure you have the following dependencies installed in your React Native project:

(npm install react-native-fs)

πŸ› οΈ Setup

1️⃣ Import and Initialize

import CoPush from 'co-push';

CoPush.checkForUpdate('API_KEY','CURRENT_VERSION');

Replace 'API_KEY' and 'CURRENT_VERSION' with your update server URL.


🌐 Get Your API Key

To use co-push, you need an API key. You can obtain your API_KEY from co-push.com.

Visit co-push.com to create an account and get your API key.


βš™οΈ Platform-Specific Configuration

2️⃣ Android Configuration

Modify MainApplication.kt

In android/app/src/main/kotlin/com/yourapp/MainApplication.kt, update the getJSBundleFile method:

import java.io.File

 override fun getJSBundleFile(): String? {
    val bundlePath = "${applicationContext.filesDir.absolutePath}/index.bundle"
    return if (File(bundlePath).exists()) bundlePath else null
 }

This ensures that the app loads the new bundle file if available.


3️⃣ iOS Configuration

React Native Version >= 0.77

Modify AppDelegate.swift

In ios/YourApp/AppDelegate.swift, update the bundle loading logic:

#if DEBUG
    return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
    let bundlePath = documentDirectory?.appendingPathComponent("index.bundle").path
    if let path = bundlePath, FileManager.default.fileExists(atPath: path) {
        return URL(fileURLWithPath: path)
    }
    return Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif

React Native Version < 0.77

Modify AppDelegate.mm

In ios/YourApp/AppDelegate.mm, update the bundle loading logic:

#if DEBUG
   return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
   NSURL *documentDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] firstObject];
  NSString *bundlePath = [[documentDirectory URLByAppendingPathComponent:@"index.bundle"] path];

  if ([[NSFileManager defaultManager] fileExistsAtPath:bundlePath]) {
      return [NSURL fileURLWithPath:bundlePath];
  }

  // If no updated bundle is found, use the main.jsbundle in assets
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif

This ensures the app loads the downloaded bundle instead of the built-in one.


🎯 How It Works

  1. 'checkForUpdate()' checks the update server for a new bundle.
  2. If an update is available, the user will download it on app launch.
  3. The downloaded bundle is stored in the app's document directory.
  4. The app restarts to apply the update.

πŸ“ Example Usage

import React, { useEffect } from 'react';
import { View, Text } from 'react-native';
import CoPush from 'co-push';

const App = () => {
    useEffect(() => {
      CoPush.checkForUpdate('API_KEY','CURRENT_VERSION');
    }, []);
    
    return (
        <View>
            <Text>Welcome to My App!</Text>
        </View>
    );
};

export default App;

πŸ“Œ Notes

  • Ensure that your update server provides a valid bundle file.
  • Make sure to sign your bundles correctly to prevent security issues.
  • This package does not replace native updates (i.e., changes to native code still require an app store update).

🌜 License

MIT License. Feel free to use and contribute!


🀝 Contributing

We welcome contributions! Please open an issue or submit a pull request on GitHub.


πŸš€ Enjoy seamless updates with co-push! πŸš€

Contributors ✨