Browse Source

update release script

Daniel Zlotin 7 years ago
parent
commit
5168e756ff

+ 5
- 1
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ViewControllerTest.java View File

@@ -14,6 +14,10 @@ public class ViewControllerTest extends BaseTest {
14 14
 	public void holdsAView() throws Exception {
15 15
 		ViewController uut = new ViewController();
16 16
 		assertThat(uut.getView()).isNull();
17
-		uut.setView(Shadow.newInstanceOf(View.class));
17
+		View view = Shadow.newInstanceOf(View.class);
18
+		uut.setView(view);
19
+		assertThat(uut.getView()).isEqualTo(view);
18 20
 	}
21
+
22
+
19 23
 }

+ 10
- 4
scripts/release.js View File

@@ -3,6 +3,9 @@ const exec = require('shell-utils').exec;
3 3
 const p = require('path');
4 4
 const semver = require('semver');
5 5
 
6
+const VERSION_TAG = 'alpha';
7
+const VERSION_INC = 'prerelease';
8
+
6 9
 function validateEnv() {
7 10
   if (!process.env.CI || !process.env.TRAVIS) {
8 11
     throw new Error(`releasing is only available from Travis CI`);
@@ -31,9 +34,12 @@ function setupGit() {
31 34
 }
32 35
 
33 36
 function calcNewVersion() {
34
-  const nextTaggedVersion = exec.execSyncRead(`npm view ${process.env.npm_package_name}@next version`);
35
-  console.log(`next tagged version is: ${nextTaggedVersion}`);
36
-  return semver.inc(nextTaggedVersion, 'prerelease');
37
+  const currentVersion = exec.execSyncRead(`npm view ${process.env.npm_package_name}@${VERSION_TAG} version`);
38
+  console.log(`${VERSION_TAG} version: ${currentVersion}`);
39
+  const packageVersion = process.env.npm_package_version;
40
+  console.log(`package version: ${packageVersion}`);
41
+  const greater = semver.gt(currentVersion, packageVersion) ? currentVersion : packageVersion;
42
+  return semver.inc(greater, VERSION_INC);
37 43
 }
38 44
 
39 45
 function copyNpmRc() {
@@ -45,7 +51,7 @@ function tagAndPublish(newVersion) {
45 51
   console.log(`new version is: ${newVersion}`);
46 52
   exec.execSync(`npm version ${newVersion} -m "v${newVersion} [ci skip]"`);
47 53
   exec.execSyncSilent(`git push deploy --tags`);
48
-  exec.execSync(`npm publish --tag next`);
54
+  exec.execSync(`npm publish --tag ${VERSION_TAG}`);
49 55
 }
50 56
 
51 57
 function run() {