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
 	public void holdsAView() throws Exception {
14
 	public void holdsAView() throws Exception {
15
 		ViewController uut = new ViewController();
15
 		ViewController uut = new ViewController();
16
 		assertThat(uut.getView()).isNull();
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
 const p = require('path');
3
 const p = require('path');
4
 const semver = require('semver');
4
 const semver = require('semver');
5
 
5
 
6
+const VERSION_TAG = 'alpha';
7
+const VERSION_INC = 'prerelease';
8
+
6
 function validateEnv() {
9
 function validateEnv() {
7
   if (!process.env.CI || !process.env.TRAVIS) {
10
   if (!process.env.CI || !process.env.TRAVIS) {
8
     throw new Error(`releasing is only available from Travis CI`);
11
     throw new Error(`releasing is only available from Travis CI`);
31
 }
34
 }
32
 
35
 
33
 function calcNewVersion() {
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
 function copyNpmRc() {
45
 function copyNpmRc() {
45
   console.log(`new version is: ${newVersion}`);
51
   console.log(`new version is: ${newVersion}`);
46
   exec.execSync(`npm version ${newVersion} -m "v${newVersion} [ci skip]"`);
52
   exec.execSync(`npm version ${newVersion} -m "v${newVersion} [ci skip]"`);
47
   exec.execSyncSilent(`git push deploy --tags`);
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
 function run() {
57
 function run() {