All Projects → stovmascript → React Native Version

stovmascript / React Native Version

Licence: mit
🔢 Version your React Native or Expo app in a `npm version` fashion.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Version

Python Semver
Python package to work with Semantic Versioning (http://semver.org/)
Stars: ✭ 264 (-35.29%)
Mutual labels:  versioning, release, semver, semantic-versioning
Release It
🚀 Automate versioning and package publishing
Stars: ✭ 4,773 (+1069.85%)
Mutual labels:  cli, hooks, release, semver
Standard Version
🏆 Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org
Stars: ✭ 5,806 (+1323.04%)
Mutual labels:  versioning, cli, release
perfekt
Release, changelog and version your packages with perfe(k)t 👌 ease!
Stars: ✭ 15 (-96.32%)
Mutual labels:  semver, versioning, release
next-ver
Tells you the next semantic version for your local package
Stars: ✭ 27 (-93.38%)
Mutual labels:  semver, semantic-versioning, release
Version
Represent and compare versions via semantic versioning (SemVer) in Swift
Stars: ✭ 160 (-60.78%)
Mutual labels:  versioning, semver, semantic-versioning
Shipjs
Take control of what is going to be your next release.
Stars: ✭ 668 (+63.73%)
Mutual labels:  versioning, release, semver
Dunamai
Dynamic versioning library and CLI
Stars: ✭ 85 (-79.17%)
Mutual labels:  versioning, cli, semantic-versioning
Semver
Semantic versioning helper library for PHP
Stars: ✭ 144 (-64.71%)
Mutual labels:  versioning, semver, semantic-versioning
Axion Release Plugin
Gradle release & version management plugin.
Stars: ✭ 372 (-8.82%)
Mutual labels:  versioning, release, semantic-versioning
ngp
New Go Package
Stars: ✭ 22 (-94.61%)
Mutual labels:  semantic-versioning, release
versiontag
Bash command to automate tag semantic versioning
Stars: ✭ 40 (-90.2%)
Mutual labels:  versioning, semantic-versioning
zerover
0️⃣ Minimalist versioning scheme for devs who can't be bothered.
Stars: ✭ 141 (-65.44%)
Mutual labels:  semver, versioning
gradle-versioner
Gradle Version Plugin. Generates semantic versions with git meta data per branch.
Stars: ✭ 25 (-93.87%)
Mutual labels:  semver, semantic-versioning
sv4git
Semantic version and conventional commits for git
Stars: ✭ 33 (-91.91%)
Mutual labels:  versioning, semantic-versioning
terraform-module-versions
CLI tool that checks Terraform code for module updates. Single binary, no dependencies. linux, osx, windows. #golang #cli #terraform
Stars: ✭ 143 (-64.95%)
Mutual labels:  semver, versioning
tag
Git utility to create tags in order to identify specific releases
Stars: ✭ 24 (-94.12%)
Mutual labels:  versioning, release
glare
gracefully download (latest) releases from GitHub
Stars: ✭ 64 (-84.31%)
Mutual labels:  semver, release
git-semver
a small cli tool to version your git repository with semantic versioning
Stars: ✭ 19 (-95.34%)
Mutual labels:  semver, semantic-versioning
bump
🌻 CLI tool to draft a GitHub Release for the next semantic version
Stars: ✭ 40 (-90.2%)
Mutual labels:  semver, semantic-versioning

react-native-version

license npm test david

Seamlessly shadows the behaviour of npm version.

npm-scripts hook (automatic method)

Setup

$ npm install react-native-version --save-dev
# or
$ yarn add react-native-version --dev

Hook into the "version" or "postversion" npm script in your app's package.json:

{
  "name": "AwesomeProject",
  "version": "0.0.1",
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
+   "postversion": "react-native-version"
  }
}

Usage

Before you publish a new build of your app, run npm version <newversion>.

react-native-version will then update your android/ and ios/ code. Depending on the script and options you choose, it can also automatically amend the version bump commit and update the Git tag created by npm version. This method should be useful in most cases. If you need more control, take a look at the CLI and options below.

CLI

Setup

$ npm install -g react-native-version
# or
$ yarn global add react-native-version

Example usage

$ cd AwesomeProject/
$ npm version patch
$ react-native-version

Options

-V, --version                output the version number
-a, --amend                  Amend the previous commit. This is done automatically when react-native-version is run from the "version" or "postversion" npm script. Use "--never-amend" if you never want to amend. Also, if the previous commit is a valid npm-version commit, react-native-version will update the Git tag pointing to this commit.
--skip-tag                   For use with "--amend", if you don't want to update Git tags. Use this option if you have git-tag-version set to false in your npm config or you use "--no-git-tag-version" during npm-version.
-A, --never-amend            Never amend the previous commit.
-b, --increment-build        Only increment build number.
-B, --never-increment-build  Never increment build number.
-d, --android [path]         Path to your "android/app/build.gradle" file. (default: "android/app/build.gradle")
-i, --ios [path]             Path to your "ios/" folder. (default: "ios")
-L, --legacy                 Version iOS using agvtool (macOS only). Requires Xcode Command Line Tools.
-q, --quiet                  Be quiet, only report errors.
-r, --reset-build            Reset build number back to "1" (iOS only). Unlike Android's "versionCode", iOS doesn't require you to bump the "CFBundleVersion", as long as "CFBundleShortVersionString" changes. To make it consistent across platforms, react-native-version bumps both by default. You can use this option if you prefer to keep the build number value at "1" after every version change. If you then need to push another build under the same version, you can use "-bt ios" to increment.
-s, --set-build <number>     Set a build number. WARNING: Watch out when setting high values. This option follows Android's app versioning specifics - the value has to be an integer and cannot be greater than 2100000000. You cannot decrement this value after publishing to Google Play! More info at: https://developer.android.com/studio/publish/versioning.html#appversioning
--generate-build             Generate build number from the package version number. (e.g. build number for version 1.22.3 will be 1022003)
-t, --target <platforms>     Only version specified platforms, e.g. "--target android,ios".
-h, --help                   output usage information

You can apply these options to the "version" or "postversion" script too. If for example you want to commit the changes made by RNV yourself, add the "--never-amend" option:

{
  "scripts": {
-   "postversion": "react-native-version"
+   "postversion": "react-native-version --never-amend"
  }
}

Targeting platforms

The default behaviour is to version all React Native platforms. You can target specific platforms by passing a comma-separated list to the "--target" option, or by using the RNV environment variable:

$ RNV=android,ios npm version patch
# or
$ RNV=android,ios react-native-version

When using the CLI, you can even combine both methods and make your teammates rage 😈

$ RNV=android react-native-version --target ios

🙊

Custom version commit message

When updating Git tags, RNV uses the version commit message to find the correct Git tag. If you're running npm version with the -m or --message option, make sure your message includes %s, which will be replaced with the resulting version number. For example:

$ npm version patch -m "Upgrade to %s for reasons"

If you're using yarn, you can configure the commit message generated by yarn version though yarn config set version-git-message - see the docs.

The behavior can be also adjusted by .npmrc and .yarnrc config files.

API

import { version } from "react-native-version";

async function doSomething() {
  const versionResult = await version({
    amend: true,
    // ...
  });
}

// or

version({
  amend: true,
  // ...
})
  .then((commitHash) => {
    console.log(commitHash);
  })
  .catch((err) => {
    console.error(err);
  });

Functions

version(program, projectPath)Promise.<(string|Error)>

Versions your app

Typedefs

Promise

Custom type definition for Promises

version(program, projectPath) ⇒ Promise.<(string|Error)>

Versions your app

Kind: global function
Returns: Promise.<(string|Error)> - A promise which resolves with the last commit hash

Param Type Description
program Object commander/CLI-style options, camelCased
projectPath string Path to your React Native project

Promise

Custom type definition for Promises

Kind: global typedef
Properties

Name Type Description
result * See the implementing function for the resolve type and description
result Error Rejection error object

Known issues

SyntaxError: Expected """, "\'", "\"", "\n", or [^\"] but "\" found.

When running react-native link on Windows, native modules will be linked in your Xcode project with paths that include backslashes (\) instead of forward slashes (/). This will break pbxproj-dom, which we rely on to parse Xcode projects. To fix this issue, convert any LIBRARY_SEARCH_PATHS and HEADER_SEARCH_PATHS as shown in this comment. This step could be automated with a library like normalize-path or unixify.

See also

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].