Skip to content

Commit 9f9dca9

Browse files
committed
add changelog scripts
1 parent f59d5d9 commit 9f9dca9

File tree

3 files changed

+96
-1
lines changed

3 files changed

+96
-1
lines changed

bin/changelog

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
4+
/*
5+
* This script generates the template a changelog by comparing a current version
6+
* with master. Run this, copy what's logged into the `CHANGELOG.md` and update
7+
* the top section based on the changes listed in "Community Contributions"
8+
*
9+
* Usage:
10+
*
11+
* bin/changelog
12+
*/
13+
14+
var EOL = require('os').EOL;
15+
var multiline = require('multiline');
16+
var Promise = require('ember-cli/lib/ext/promise');
17+
var GitHubApi = require('github');
18+
19+
var github = new GitHubApi({version: '3.0.0'});
20+
var compareCommits = Promise.denodeify(github.repos.compareCommits);
21+
var currentVersion = 'v' + require('../package').version;
22+
23+
var user = 'ember-cli-deploy';
24+
var repo = 'ember-cli-deploy-redis';
25+
26+
compareCommits({
27+
user: user,
28+
repo: repo,
29+
base: currentVersion,
30+
head: 'master'
31+
}).then(function(res) {
32+
return res.commits.map(function(commitInfo) {
33+
return commitInfo.commit.message
34+
35+
}).filter(function(message) {
36+
return message.indexOf('Merge pull request #') > -1;
37+
38+
}).map(function(message) {
39+
var numAndAuthor = message.match(/#(\d+) from (.*)\//).slice(1,3);
40+
var title = message.split('\n\n')[1];
41+
42+
return {
43+
number: +numAndAuthor[0],
44+
author: numAndAuthor[1],
45+
title: title
46+
};
47+
48+
}).sort(function(a, b) {
49+
return a.number > b.number;
50+
}).map(function(pr) {
51+
var link = '[#' + pr.number + ']' +
52+
'(https://github.com/' + user + '/' + repo + '/pull/' + pr.number + ')';
53+
var title = pr.title;
54+
var author = '[@' + pr.author + ']' +
55+
'(https://github.com/' + pr.author +')';
56+
57+
return '- ' + link + ' ' + title + ' ' + author;
58+
59+
}).join('\n');
60+
61+
}).then(function(contributions) {
62+
var changelog = generateChangelog(contributions);
63+
64+
console.log(changelog);
65+
}).catch(function(err) {
66+
console.error(err);
67+
})
68+
69+
function generateChangelog(contributions) {
70+
var header = multiline(function() {/*
71+
The following changes are required if you are upgrading from the previous
72+
version:
73+
- Users
74+
+ Upgrade your project's ember-cli version - [docs](http://www.ember-cli.com/#project-update)
75+
- Addon Developers
76+
+ No changes required
77+
- Core Contributors
78+
+ No changes required
79+
#### Community Contributions
80+
*/});
81+
82+
var footer = 'Thank you to all who took the time to contribute!';
83+
84+
return header + EOL + EOL + contributions + EOL + EOL + footer;
85+
}

bin/prepare-release

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
rm -rf node_modules && \
4+
rm -rf ./ember-cli-deploy-redis*.tgz && \
5+
npm cache clear && \
6+
npm i --no-optional && \
7+
npm link --no-optional && \
8+
npm pack

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
"ember-export-application-global": "^1.0.3",
4040
"ember-try": "0.0.6",
4141
"glob": "^5.0.15",
42-
"mocha": "^2.3.3"
42+
"mocha": "^2.3.3",
43+
"github": "^0.2.4",
44+
"multiline": "^1.0.2"
4345
},
4446
"keywords": [
4547
"ember-addon",

0 commit comments

Comments
 (0)