All Projects → szhigunov → React Native Npm Version

szhigunov / React Native Npm Version

Licence: gpl-3.0
Example of React-Native application with version from package.json and npm version bump.

Projects that are alternatives of or similar to React Native Npm Version

Awesome Kotlin Android
🔥📱收集利用 Kotlin 进行 Android 开发的开源库,扩展,工具,开源项目,资料等高质量资源
Stars: ✭ 784 (+3820%)
Mutual labels:  example
Mean Angular5 Passport Authentication
Securing MEAN Stack (Angular 5) Web Application using Passport Authentication
Stars: ✭ 24 (+20%)
Mutual labels:  example
Api Example
WIP: Just sample app with API
Stars: ✭ 12 (-40%)
Mutual labels:  example
Ansible Skeleton
The skeleton to create new ansible roles.
Stars: ✭ 5 (-75%)
Mutual labels:  example
Simpleopenclsamples
Simple OpenCL Samples that Build with Khronos Headers and Libs
Stars: ✭ 22 (+10%)
Mutual labels:  example
Refreshversions
Life is too short to google for dependencies and versions
Stars: ✭ 841 (+4105%)
Mutual labels:  versioning
Example.v2
An example project for book 'Go Programming & Concurrency in Practice, 2nd edition' (《Go并发编程实战》第2版).
Stars: ✭ 722 (+3510%)
Mutual labels:  example
Gitversioningonxcode
Pretty Xcode Git versioning for iOS & macOS applications
Stars: ✭ 15 (-25%)
Mutual labels:  versioning
Algolia Swift Demo
iOS instant search tutorial
Stars: ✭ 23 (+15%)
Mutual labels:  example
Strangelog
Painless file-based changelog management via CLI.
Stars: ✭ 12 (-40%)
Mutual labels:  versioning
Multiple Nuxt Apps Example
Stars: ✭ 16 (-20%)
Mutual labels:  example
Mjml React Example
mjml-react example project
Stars: ✭ 19 (-5%)
Mutual labels:  example
Lift
Simple Android Application update logic component
Stars: ✭ 10 (-50%)
Mutual labels:  versioning
Scala Pet Store
An implementation of the java pet store using FP techniques in scala
Stars: ✭ 812 (+3960%)
Mutual labels:  example
Chill Netcat
UDP-only netcat implementation with OCaml / MirageOS
Stars: ✭ 13 (-35%)
Mutual labels:  example
Eventsourcing.netcore
Examples and Tutorials of Event Sourcing in .NET Core
Stars: ✭ 760 (+3700%)
Mutual labels:  example
Haxejs
Documentation about using JavaScript with Haxe
Stars: ✭ 25 (+25%)
Mutual labels:  example
Ionic3 Angular43 Httpclient
Example of Ionic 3 and the new Angular 4.3 HTTPClient
Stars: ✭ 20 (+0%)
Mutual labels:  example
React Redux Boilerplate Example
Stars: ✭ 15 (-25%)
Mutual labels:  example
Versioning Spring Boot Starter
Spring boot starter using for versioning rest easily.
Stars: ✭ 11 (-45%)
Mutual labels:  versioning

react-native-npm-version

Example of React-Native application with version from package.json and npm version bump.

Why not to simpify cross-platform app version increase flow, with only npm version command ?

This repository provides an sample application, with integrated solution to minimize amount of monkey job with handling react-native applications.

Realization consist of few parts:

  • some script ./scripts/version.js which increase version in iOS project file Info.plist.
  • custom npm scripts version.
  • extended ./android/build.gradle
  • modified ./android/app/build.gradle:

To use those solution in your project,

  1. add version npm script to scripts section in your package.json:
{
  "scripts": {
    "version": "node ./scripts/version.js && [[ $(git status --porcelain -z | gawk '/version.json/ && /Info.plist/' ) ]] && git add version.json ios/"
  }
  1. copy ./scripts/version.js to your project root.
  2. extend ./android/app/build.gradle and ./android/build.gradle with the following samples:

./android/app/build.gradle

/* ... */
android {
  /* ... */
    defaultConfig {
        // Replace lines with your versionCode and versionName  with two lines below
        versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
        versionName "${versionMajor}.${versionMinor}.${versionPatch}"
        /* ... */
    }
  /* ... */
}

./android/build.gradle

subprojects {
    ext {
        def npmVersion = getNpmVersionArray()
        versionMajor = npmVersion[0]
        versionMinor = npmVersion[1]
        versionPatch = npmVersion[2]
    }
}

def getNpmVersion() {
    def inputFile = new File("../package.json")
    def packageJson = new JsonSlurper().parseText(inputFile.text)
    return packageJson["version"]
}

def getNpmVersionArray() { // major [0], minor [1], patch [2]
    def (major, minor, patch) = getNpmVersion().tokenize('.')
    return [Integer.parseInt(major), Integer.parseInt(minor), Integer.parseInt(patch)] as int[]
}

Based on solution by @AndrewJack https://github.com/AndrewJack/versioning-react-native-app. See Medium post

Requirements

  • gawk for macOS - used in npm run version
  • watchman for macOS
  • node higher than 4.2.0
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].