|
@@ -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() {
|