Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@np-dev/rn-deploy

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@np-dev/rn-deploy

React Native Deploy helper ## Install - Install rn-deploy ``` npm install -g @np-dev/rn-deploy OR npm install --save-dev @np-dev/rn-deploy ``` ## Commands - rn-deploy codepush ${platform} ${environment} - platform: ios or android or all - environment: d

  • 1.0.8
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

React Native Deploy helper

Install

  • Install rn-deploy
npm install -g @np-dev/rn-deploy
OR
npm install --save-dev @np-dev/rn-deploy

Commands

  • rn-deploy codepush ${platform} ${environment}
  • platform: ios or android or all
  • environment: dev - .env, staging - .env.staging, production - .env.production
  • For example:
rn-deploy codepush ios dev
rn-deploy codepush android dev
rn-deploy codepush all dev

.env example

DEPLOY_CODEPUSH_TOKEN = 'User token from codepush'
IOS_DEPLOY_TOKEN = 'IOS token from codepush'
ANDROID_DEPLOY_TOKEN = 'Android token from codepush'
ANDROID_CODEPUSH_URL = 'Android project'
IOS_CODEPUSH_URL = 'IOS project'

Sync CodePush with S3

  • Add to .env or .env.codepush_s3
AWS_REGION = ''
AWS_BUCKET_NAME = ''
AWS_ACCESS_KEY_ID = ''
AWS_SECRET_ACCESS_KEY = ''
AWS_ENDPOINT = 'For custom s3 server'
AWS_FORCE_PATH_STYLE = true
  • Add @np-dev/react-native-code-push to package.json
yarn add @np-dev/react-native-code-push
  • or
npm i @np-dev/react-native-code-push
  • In the app, when your app check for updates, add the following code:
import codePush, {RemotePackage} from '@np-dev/react-native-code-push';

const remoteVersion: RemotePackage | null = await codePush.checkForUpdate();

let downloadUrl: string | undefined;
if (remoteVersion.packageHash) {
  // Send head request to check if the file is available
  const S3Url = 'https://packages.s3.ap-southeast-1.amazonaws.com/' + remoteVersion.packageHash;
  const checkS3 = await fetch(S3Url, {
    method: 'HEAD',
  });
  if (checkS3.status === 200) {
    downloadUrl = S3Url;
  }
}
codePush.sync(
  {
    installMode: codePush.InstallMode.IMMEDIATE,
    downloadUrl,
  },
  syncStatusChangedCallback,
  codePushDownloadDidProgress,
  codePushDownloadCompleted,
);

Keywords

FAQs

Package last updated on 23 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc