Skip to content

Commit

Permalink
Support IOS (#2)
Browse files Browse the repository at this point in the history
* WIP

* Skip not found

* Add build

* Fix try catchs

* Build the files

* Support IOS Info.plist

* Update build

* Add documentation for IOS and remove build folder from git repo

* Fix lint errors

* Fix errors in readme

* Add the MIT license
Refactor function names

* Add punctuation in License section

* Rename license.txt to LICENSE.txt
Add (c) after Copyright

* Refactor Readme and License

* Improve README

* Update LICENSE.txt
  • Loading branch information
ssideleau authored Mar 19, 2019
1 parent 9aa41a3 commit 51d06d6
Show file tree
Hide file tree
Showing 9 changed files with 259 additions and 200 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ typings/
.dynamodb/

# End of https://www.gitignore.io/api/node

build/
7 changes: 7 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright(c) 2019 Novom Interactive, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
105 changes: 83 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
# React Native Set Version
# react-native-set-version

React Native Set Version is a tool that let you set your version easily trough your react-native application. It will modify the following files if found:
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

This tool allows you to easily update the version of a React Native application.
It will update the following files if found:

- **./package.json**
- **./android/app/src/main/AndroidManifest.xml**
- **./android/app/build.gradle**
- **./ios/<app_name>/Info.plist**

## Version number format

## Installation and Usage
In order to use this package, your project version must comply with the format described on [semver.org](https://semver.org/).

There are two ways to install React Native Set Version: globally and locally.
## Setup and Usage

### Local Installation and Usage
There are two ways to install react-native-set-version: globally and locally.

This is the recommended way to install React Native Set Version.
### Local Installation

This is the recommended way to install react-native-set-version.

npm:

```bash
$ npm install react-native-set-version --save-dev
npm install react-native-set-version --save-dev
```

yarn:

```bash
$ yarn add react-native-set-version --dev
yarn add react-native-set-version --dev
```

After that, you can run React Native Set Version in your projet directory like this:
You can then use this command in your project directory to run react-native-set-version:

npm:

Expand All @@ -44,40 +52,93 @@ $ yarn setVersion <version>
$ yarn set-version <version>
```

### Global Installation and Usage
### Global Installation

Use React Native Set Version in any project.
This installation method allows you to use react-native-set-version in any project.

npm:

```bash
$ npm install -g react-native-set-version
npm install -g react-native-set-version
```

yarn:

```bash
$ yarn global add react-native-set-version
yarn global add react-native-set-version
```

After that, you can run React Native Set Version in your project directory like this:
You can then use this command in your project directory to run react-native-set-version:

```bash
$ setVersion <version>
setVersion <version>
-- or --
$ set-version <version>
set-version <version>
```

**Note**: The version number must follow [semver](https://semver.org/)
## Behaviour

## Contributing
When invoked, react-native-set-version will make the following changes to your project files:

### Update Package Version

The **version** attribute in `package.json` will be updated with the specified version.

### Update Android Project Version

**Never** commit directly on master, instead use branches, forks and pull requests.
It will update the **version name** and the **version code** in both `build.gradle` and `AndroidManifest.xml`.

Once approved, a Pull request is merged in `master` by its author. Also, it must be squashed before merging,
either manually or using GitHub's `Squash and merge` feature.
### Update iOS Project Version

It will update the **CFBundleShortVersionString** and the **CFBundleVersion** in `Info.plist`.

### How the version code and CFBundleVersion are updated

The Android version code represents your version number as an integer. This
package uses the following format to generate this integer:

```
<MAJOR><MINOR ON 2 DIGITS><PATCH ON 2 DIGITS><BUILD NUMBER>
```

For instance, the first time you call `set-version 3.1.4`, it will produce the version code `301041`.

If you call the command with the same version a second time, it will increment the build number, to produce `301042`.

This also applies if, for instance, you call `set-version 3.1.4-rc.1`, and then `set-version 3.1.4-rc.2`.

As for the `CFBundleVersion` on iOS, it will produce a string in the format `<MAJOR>.<MINOR>.<PATCH>.<BUILD NUMBER>`.

Example:

```bash
$ yarn set-version 1.0.0-rc.1
# Output
# ...
# Will set android version code to 100001
# ...
# Will set CFBundleVersion to 1.0.0.1
$ yarn set-version 1.0.0-rc.2
# Output
# ...
# Will set android version code to 100002
# ...
# Will set CFBundleVersion to 1.0.0.2
$ yarn set-version 1.0.0
# Output
# ...
# Will set android version code to 100003
# ...
# Will set CFBundleVersion to 1.0.0.3
```

## License

This software uses the [MIT license](LICENSE.txt).

## Contributing

You must use the following Style Guides :
You must use the following style guide:

- [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript)

Expand Down
78 changes: 0 additions & 78 deletions build/index.js

This file was deleted.

54 changes: 0 additions & 54 deletions build/versionUtils.js

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
},
"dependencies": {
"chalk": "^2.4.2",
"manifest-android": "^0.1.1"
"manifest-android": "^0.1.1",
"plist": "^3.0.1"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
Expand Down
Loading

0 comments on commit 51d06d6

Please sign in to comment.