Skip to content

Commit

Permalink
chore(build): Add scripts dir
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed May 13, 2017
1 parent a3c0fb9 commit 29b2824
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/ensure_clean_master.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!env node
if(require.main === module && process.argv[2])
branch = process.argv[2];

require('./util').ensureCleanMaster(branch);
32 changes: 32 additions & 0 deletions scripts/release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!env node
"use strict";

require('shelljs/global');
let readlineSync = require('readline-sync');
let util = require('./util');
let _exec = util._exec;

let version = require('../package.json').version;

if (!readlineSync.keyInYN('Did you bump the version number in package.json?')) {
process.exit(1);
}

if (!readlineSync.keyInYN('Did you update CHANGELOG.md using scripts/update_changelog.js?')) {
process.exit(1);
}

if (!readlineSync.keyInYN('Did you push all changes back to origin?')) {
process.exit(1);
}

if (!readlineSync.keyInYN('Ready to publish?')) {
process.exit(1);
}

util.ensureCleanMaster('master');
_exec(`npm run build`);
_exec(`npm publish`);
_exec(`git tag ${version}`);
_exec(`git push origin ${version}`);

29 changes: 29 additions & 0 deletions scripts/show_changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!env node
"use strict";
let conventionalChangelog = require('conventional-changelog');

let options = {
preset: 'ui-router-core'
};

if(require.main === module) {
let context, gitOpts;

if (process.argv[2]) {
context = {};
gitOpts = {};
context.previousTag = process.argv[2];
gitOpts.from = process.argv[2];
}

if (process.argv[3]) {
context.currentTag = process.argv[3];
}

showChangelog(context, gitOpts);
}

function showChangelog(context, gitOpts) {
var writerOpts = { doFlush: true, generateOn: function() { return false; } };
conventionalChangelog(options, context, gitOpts, undefined, writerOpts).pipe(process.stdout);
}
14 changes: 14 additions & 0 deletions scripts/update_changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!env node
"use strict";

require('shelljs/global');
let path = require('path');
let _exec = require('./util')._exec;

cd(path.resolve(__dirname, '..'));

echo('Updating CHANGELOG...');
cp('CHANGELOG.md', 'CHANGELOG.bak');
_exec('node ./scripts/show_changelog.js >> CHANGELOG.new');
_exec('cat CHANGELOG.new CHANGELOG.bak > CHANGELOG.md');
rm('CHANGELOG.bak', 'CHANGELOG.new');

0 comments on commit 29b2824

Please sign in to comment.