Skip to content

Commit 2d0782c

Browse files
authored
Merge pull request #13 from stovmascript/next
Improve order of business, CLI
2 parents 8fe7ffd + 5bfc606 commit 2d0782c

File tree

18 files changed

+221
-144
lines changed

18 files changed

+221
-144
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ react-native-version will then update your `android/` and `ios/` code. Depending
4949

5050
```shell
5151
npm install -g react-native-version
52+
# or
53+
yarn global add react-native-version
5254
```
5355

5456
### Example usage
@@ -65,13 +67,14 @@ react-native-version
6567
-h, --help output usage information
6668
-V, --version output the version number
6769
-a, --amend Amend the previous commit. Also updates the latest Git tag to point to the amended 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.
68-
--skip-tag For use with "--amend" if you don't want to update Git tags
69-
-A, --never-amend Never amend the previous commit
70-
-b, --increment-build Only increment build number
71-
-d, --android [path] Path to your "android/app/build.gradle" file
72-
-i, --ios [path] Path to your "ios/" folder
73-
-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 reset the build number after every version change. If you then need to push another build under the same version, you can use "-bt ios".
74-
-t, --target <platforms> Only version specified platforms, eg. "--target android,ios"
70+
--skip-tag For use with "--amend", if you don't want to update Git tags.
71+
-A, --never-amend Never amend the previous commit.
72+
-b, --increment-build Only increment build number.
73+
-d, --android [path] Path to your "android/app/build.gradle" file.
74+
-i, --ios [path] Path to your "ios/" folder.
75+
-q, --quiet Be quiet, only report errors.
76+
-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.
77+
-t, --target <platforms> Only version specified platforms, eg. "--target android,ios".
7578
```
7679

7780
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:
@@ -133,7 +136,7 @@ version({
133136

134137
<a name="version"></a>
135138

136-
#### version(program) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
139+
#### version(program, projectPath) ⇒ <code>Promise.&lt;(string\|Error)&gt;</code>
137140
Versions your app
138141

139142
**Kind**: global function
@@ -142,6 +145,7 @@ Versions your app
142145
| Param | Type | Description |
143146
| --- | --- | --- |
144147
| program | <code>Object</code> | commander/CLI-style options, camelCased |
148+
| projectPath | <code>string</code> | Path to your React Native project |
145149

146150
### Types
147151

cli.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ const defaults = rnv.getDefaults();
99

1010
program
1111
.version(pkg.version)
12+
.description(pkg.description)
13+
.arguments('[projectPath]')
1214
/* eslint-disable max-len */
1315
.option('-a, --amend', 'Amend the previous commit. Also updates the latest Git tag to point to the amended commit. This is done automatically when ' + pkg.name + ' is run from the "version" or "postversion" npm script. Use "--never-amend" if you never want to amend.')
14-
.option('--skip-tag', 'For use with "--amend" if you don\'t want to update Git tags')
15-
.option('-A, --never-amend', 'Never amend the previous commit')
16-
.option('-b, --increment-build', 'Only increment build number')
17-
.option('-d, --android [path]', 'Path to your "android/app/build.gradle" file', defaults.android)
18-
.option('-i, --ios [path]', 'Path to your "ios/" folder', defaults.ios)
19-
.option('-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, ' + pkg.name + ' bumps both by default. You can use this option if you prefer to reset the build number after every version change. If you then need to push another build under the same version, you can use "-bt ios".')
20-
.option('-t, --target <platforms>', 'Only version specified platforms, eg. "--target android,ios"', list)
16+
.option('--skip-tag', 'For use with "--amend", if you don\'t want to update Git tags.')
17+
.option('-A, --never-amend', 'Never amend the previous commit.')
18+
.option('-b, --increment-build', 'Only increment build number.')
19+
.option('-d, --android [path]', 'Path to your "android/app/build.gradle" file.', defaults.android)
20+
.option('-i, --ios [path]', 'Path to your "ios/" folder.', defaults.ios)
21+
.option('-q, --quiet', 'Be quiet, only report errors.')
22+
.option('-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, ' + pkg.name + ' 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.')
23+
.option('-t, --target <platforms>', 'Only version specified platforms, eg. "--target android,ios".', list)
2124
/* eslint-enable */
2225
.parse(process.argv);
2326

0 commit comments

Comments
 (0)