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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-code-push-diff

v1.2.3

Published

This library builds upon the foundational strengths of the react-native-code-push library, adding advanced functionality to precisely identify and manage differences between code-push builds.

Downloads

3,259

Readme

react-native-code-push-diff

The primary objective of this library is to significantly decrease the size of codepush bundles, which comprise both the JavaScript bundle and its associated assets. This is achieved by utilizing a script that retains only the modified or newly added files within the bundle. As a result, this selective retention mechanism enables a drastic reduction in the overall bundle size, often decreasing it by several times. This optimization facilitates more efficient updates and faster distribution, enhancing the overall deployment process and user experience.

Installation

yarn add react-native-code-push-diff

Usage

  1. Add import 'react-native-code-push-diff/setup' in the root file.
+import 'react-native-code-push-diff/setup'
import { AppRegistry } from 'react-native'
import App from './src/App'
import { name as appName } from './app.json'

AppRegistry.registerComponent(appName, () => App)
  1. Run the code-push-diff release-react --app {YOUR_APP_NAME} --base {BRANCH_OR_COMMIT} if you need to create and release a codepush bundle.

How does it work?

The bundle or release-react scripts initiate their process by generating bundles corresponding to the current active git commit and a specified base commit, which is provided as an argument. This step is crucial for identifying the exact changes in assets that have occurred between these two states. Following this, the scripts compute the differences in assets across the generated bundles to pinpoint which files have been modified or added.

The react-native-code-push-diff/setup plays a key role by setting up a custom source transformer based on the specified transformer mechanism in React Native. It makes sure that this file is extracted from the codepush bundle and not the main bundle, otherwise the file will be extracted from the main bundle.

Script Usage

bundle

The bundle command is designed to generate a codepush bundle incorporating only the assets that have changed:

yarn code-push-diff bundle {appOrOs} --base {branchOrCommit}
  • appOrOs - this parameter specifies the context in which the bundle is to be built. You can either input the name of an application as defined within your appcenter configuration or directly specify the platform for which you are building the bundle (ios or android).

  • branchOrCommit - this argument determines the reference point for calculating asset differences. It should be the identifier of the branch or commit that served as the basis for your most recent application build. By specifying this, the script can accurately assess which assets have changed and need to be included in the codepush bundle, ensuring that your updates are both efficient and relevant.

For example: code-push-diff bundle i.kuchaev/AwesomeProject --base release-2.1

Also the script apply all args for the release-react command, like plist-file, output-dir etc.

For example: code-push-diff bundle i.kuchaev/AwesomeProject --base release-2.1 --plist-file ios/project/Info.plist

release-react

The release-react command leverages the code-push-diff bundle functionality to construct a bundle and then releases it to App Center:

code-push-diff release-react --app {appName} --base {branchOrCommit}
  • app - This should be the exact name of your application as registered in App Center. It enables the script to correctly identify and target the application for the update release.

  • branchOrCommit - Specify the branch or commit that will act as a reference point for identifying changes. Typically, you should use the commit or branch that corresponds to the last build of your released application. This comparison helps in determining which assets have changed and need to be included in the release.

This script also supports all the parameters available for the release-react command used by CodePush, , like plistFile, outputDir etc.

code-push-diff release-react --app i.kuchaev/AwesomeProject --base release-2.1 --plist-file ios/project/Info.plist --rallout 50

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library