1.0.1 • Published 3 years ago

react-native-semver v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

This is automated version of https://www.npmjs.com/package/react-native-version-up (Made by Pavel Kondratenko)

React native version semver

Increase major, minor or patch part of the version and build number in your app in package.json and in ios and android projects with one command.

node ./node_modules/react-native-semver/index.js --patch

With this script you can:

  • Increase major, minor or patch part in the version.

Example

> yarn run version:up -- --patch
$ node ./node_modules/react-native-semver/index.js "--patch"

I'm going to increase the version in:
  - package.json (./package.json);
  - ios project (./ios/happinesstracker/Info.plist);
  - android project (./android/app/build.gradle).

The version will be changed:
  - from: 0.2.2 (9);
  - to:   0.2.3 (10).

Updating versions
  Updating version in package.json...
    Version in package.json changed.
  Updating version in xcode project...
    Version and build number in ios project (plist file) changed.
  Updating version in android project...
    Version and build number in android project (gradle file) changed.
Done!

Installation

yarn add react-native-semver

Or via npm:

npm install react-native-semver --save

Usage

1. Add command in the section scripts in the package.json

{
  "name": "your-project-name",
  "scripts": {
    "version:up": "node ./node_modules/react-native-semver/index.js"
  }
}

2. Make sure you have defined the version

{
  "name": "your-project-name",
  "version": "1.0.0",
  "scripts": {
    "version:up": "node ./node_modules/react-native-semver/index.js"
  }
}

4. Increase version when needed

yarn version:up --major

Or via npm:

npm run version:up -- --major

Options

You can pass option name and value with following syntax (remember to put -- before options if you are using npm, with yarn this is not needed):

yarn version:up --flag value
OptionTypeDefault valueDescription
--majorflagIncrease major version:0.0.0 -> 1.0.0
--minorflagIncrease minor version:0.0.0 -> 0.1.0
--patchflagIncrease patch version:0.0.0 -> 0.0.1
--message or -mstring"release ${version}: increase versions and build numbers"Custom commit message.
--pathToPackage './path'string./package.jsonPath to package.json file in your project.
--pathToPlist './path'string./ios/${package.name}/Info.plistPath to Info.plist file (ios project).
--pathToGradle './path'string./android/app/build.gradlePath to build.gradle file (android project).