Giter Site home page Giter Site logo

codepushexample's Introduction

CodePushExample

Document to make a sample for code push

link library: microsoft / react-native-code-push

link error:Unable to resolve module code-push/script/acquisition-sdk

link youtobe: https://www.youtube.com/watch?v=Jo7AV5etOsA

follow the link of document to create an account code push for create center for app https://docs.microsoft.com/en-us/appcenter/distribution/codepush/rn-get-started

init project

npm install --save react-native-code-push

then link project and config follow the above link

react-native link react-native-code-push

link config
Install the App Center CLI:

npm install -g appcenter-cli

first, create an account, you can sign in with github or gmail, ...

appcenter login or code-push login
if it is not run you can run code-push to see detail command line

create application in code push server

appcenter apps create -d MyApp-Android -o Android -p React-Native
appcenter apps create -d MyApp-iOS -o iOS -p Cordova

create deployment default for all staging and production for and app

code-push deployment add JoJoAndroid --default

and can get token of this app with environment,if you forgot can use this command line to get this information

code-push deployment ls JoJoAndroid -k

second, wrap application with code push libraries

import React from 'react';
import type { Node } from 'react';
import {
  SafeAreaView,
  StyleSheet,
  Text,
  View,
} from 'react-native';
import codePush from "react-native-code-push";

const App: () => Node = () => {

  return (
    <SafeAreaView>
        <View
          style={styles.sectionContainer}>
          <Text>Check your code push example</Text>
        </View>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  sectionContainer: {
    flex: 1,
    justify-content: 'center',
    alignItem: 'center',
    backgroundColor: 'red',
  },
});

export default codePush(App)

check code,if it run you can build a apk file and then install in a device

change some style for app, and then push this change by this command line and then you can check for your app it is installed

code-push release-react CodePushExample(App name) android -d Production

check command line and + platform and status of application

fix error 1 - In the node_modules/react-native-code-push/CodePush.js file, change the import path from "code-push/script/acquisition-sdk" to "code-push/src/script acquisition-sdk".

2 - In the node_modules/code-push/src/script/acquisition-sdk.ts file and change file follow below

export module Http {
    export const Verb = {
        GET: "GET",
        HEAD: "HEAD",
        POST: "POST",
        PUT: "PUT",
        DELETE: "DELETE",
        TRACE: "TRACE",
        OPTIONS: "OPTIONS",
        CONNECT: "CONNECT",
        PATCH: "PATCH"
    }

    type VerbProps = keyof typeof Verb;
}

with ios, i get an error: Error: Command 'codepush release-react -a name/app_name -d Staging' failed with exception "The "CFBundleShortVersionString" key in the "ios/app_name/Info.plist" file needs to specify a valid semver string, containing both a major and minor version (e.g. 1.3.2, 1.1)."

and i fix it by change {{CFBundleShortVersionString}} by a number of current verion of app and it run follow link

and push it for ios

code-push release-react JoJoIos ios -d Staging

codepushexample's People

Watchers

James Cloos avatar Dat Tran avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.