Skip to content

Commit

Permalink
Merge pull request #132 from staltz/master
Browse files Browse the repository at this point in the history
Added npm scripts for releasing new version
  • Loading branch information
Matt-Esch committed Dec 2, 2014
2 parents 6a39da0 + 273824e commit a0a0534
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
"tap-dot": "^0.2.1",
"tap-spec": "^0.2.0",
"tape": "^2.13.4",
"zuul": "^1.10.0"
"zuul": "^1.10.0",
"semver": "^4.1.0",
"execSync": "^1.0.2"
},
"licenses": [
{
Expand All @@ -51,7 +53,11 @@
"browser": "run-browser test/index.js",
"phantom": "run-browser test/index.js -b | tap-spec",
"dist": "browserify --standalone virtual-dom index.js > dist/virtual-dom.js",
"travis-test": "npm run phantom && npm run cover && istanbul report lcov && ((cat coverage/lcov.info | coveralls) || exit 0)"
"travis-test": "npm run phantom && npm run cover && istanbul report lcov && ((cat coverage/lcov.info | coveralls) || exit 0)",
"release": "npm run release-patch",
"release-patch": "node ./scripts/release.js patch",
"release-minor": "node ./scripts/release.js minor",
"release-major": "node ./scripts/release.js major"
},
"testling": {
"files": "test/*.js",
Expand Down
21 changes: 21 additions & 0 deletions scripts/release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';
var fs = require('fs');
var semver = require('semver');
var execSync = require('execSync');

var packageFilename = '../package.json';

function release(type) {
execSync.run('git checkout master');
var pkg = require(packageFilename);
pkg.version = semver.inc(pkg.version, type);
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
execSync.run('git commit -a -m "Bumped version to v' + pkg.version + '"');
execSync.run('git push origin master');
execSync.run('git tag v' + pkg.version);
execSync.run('git push origin --tags');
execSync.run('npm publish');
}

release(process.argv[2] || 'patch');

0 comments on commit a0a0534

Please sign in to comment.