-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rick Harrison
committed
Jul 20, 2016
1 parent
0c88498
commit be19a5a
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
.nyc_output | ||
coverage.lcov | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
node_modules | ||
.nyc_output | ||
coverage.lcov | ||
coverage | ||
|
||
.eslintrc | ||
circle.yml | ||
scripts | ||
tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
/* eslint no-console: 0, no-sync: 0, no-process-exit: 0 */ | ||
|
||
const execSync = require('child_process').execSync; | ||
const fs = require('fs'); | ||
const packageJson = require('../package.json'); | ||
|
||
const nextVersion = process.argv[process.argv.length - 1]; | ||
const nextRef = `v${nextVersion}`; | ||
const semverRegex = /[0-9]+\.[0-9]+\.[0-9](-.+)?/ig; | ||
|
||
function validateSemver (version) { | ||
if (!semverRegex.test(version)) { | ||
console.error(`Version ${version} is not valid! It must be a valid semver string`); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
validateSemver(nextVersion); | ||
|
||
console.log(`Current Version: ${packageJson.version}`); | ||
console.log(`Next Version: ${nextVersion}`); | ||
|
||
packageJson.version = nextVersion; | ||
|
||
fs.writeFileSync('package.json', `${JSON.stringify(packageJson, null, 2)}\n`, 'utf8'); | ||
|
||
execSync(`git commit -am 'Release Version: ${nextRef}'`); | ||
execSync(`git tag ${nextRef}`); | ||
execSync('git push origin master'); | ||
execSync(`git push origin ${nextRef}`); | ||
|
||
execSync('npm publish', { stdio: [0, 1, 2] }); |