Skip to content

Commit 29b2824

Browse files
chore(build): Add scripts dir
1 parent a3c0fb9 commit 29b2824

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

scripts/ensure_clean_master.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!env node
2+
if(require.main === module && process.argv[2])
3+
branch = process.argv[2];
4+
5+
require('./util').ensureCleanMaster(branch);

scripts/release.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!env node
2+
"use strict";
3+
4+
require('shelljs/global');
5+
let readlineSync = require('readline-sync');
6+
let util = require('./util');
7+
let _exec = util._exec;
8+
9+
let version = require('../package.json').version;
10+
11+
if (!readlineSync.keyInYN('Did you bump the version number in package.json?')) {
12+
process.exit(1);
13+
}
14+
15+
if (!readlineSync.keyInYN('Did you update CHANGELOG.md using scripts/update_changelog.js?')) {
16+
process.exit(1);
17+
}
18+
19+
if (!readlineSync.keyInYN('Did you push all changes back to origin?')) {
20+
process.exit(1);
21+
}
22+
23+
if (!readlineSync.keyInYN('Ready to publish?')) {
24+
process.exit(1);
25+
}
26+
27+
util.ensureCleanMaster('master');
28+
_exec(`npm run build`);
29+
_exec(`npm publish`);
30+
_exec(`git tag ${version}`);
31+
_exec(`git push origin ${version}`);
32+

scripts/show_changelog.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!env node
2+
"use strict";
3+
let conventionalChangelog = require('conventional-changelog');
4+
5+
let options = {
6+
preset: 'ui-router-core'
7+
};
8+
9+
if(require.main === module) {
10+
let context, gitOpts;
11+
12+
if (process.argv[2]) {
13+
context = {};
14+
gitOpts = {};
15+
context.previousTag = process.argv[2];
16+
gitOpts.from = process.argv[2];
17+
}
18+
19+
if (process.argv[3]) {
20+
context.currentTag = process.argv[3];
21+
}
22+
23+
showChangelog(context, gitOpts);
24+
}
25+
26+
function showChangelog(context, gitOpts) {
27+
var writerOpts = { doFlush: true, generateOn: function() { return false; } };
28+
conventionalChangelog(options, context, gitOpts, undefined, writerOpts).pipe(process.stdout);
29+
}

scripts/update_changelog.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!env node
2+
"use strict";
3+
4+
require('shelljs/global');
5+
let path = require('path');
6+
let _exec = require('./util')._exec;
7+
8+
cd(path.resolve(__dirname, '..'));
9+
10+
echo('Updating CHANGELOG...');
11+
cp('CHANGELOG.md', 'CHANGELOG.bak');
12+
_exec('node ./scripts/show_changelog.js >> CHANGELOG.new');
13+
_exec('cat CHANGELOG.new CHANGELOG.bak > CHANGELOG.md');
14+
rm('CHANGELOG.bak', 'CHANGELOG.new');

0 commit comments

Comments
 (0)