-
-
Notifications
You must be signed in to change notification settings - Fork 132
/
comigojiChangelog.js
87 lines (83 loc) · 2.8 KB
/
comigojiChangelog.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
To append to the current changelog:
cat ./app/Changelog.md > ./app/Changelog.md.old
comigoji-changelog ./comigojiChangelog.js > ./app/Changelog.md
cat ./app/Changelog.md.old >> ./app/Changelog.md
rm ./app/Changelog.md.old
*/
const gitCommand = 'git log --max-count=1 --tags --simplify-by-decoration --pretty="format:%cI"';
const {exec} = require('child_process');
const miscEmojis = [
'😱', '🙀', '👻', '🤖', '👾', '👽', '😜', '👀', '✌️', '🦄', '🐉', '🌝', '🌚', '🌻', '☄️', '🎲', '🎁', '😺'
];
module.exports = new Promise((resolve, reject) => {
exec(gitCommand, function (err, stdout, stderr) {
if (err) {
reject(err);
return;
}
if (stderr) {
reject(new Error(stderr));
return;
}
const since = new Date(stdout.trim());
resolve({
repos: [{
since,
repo: './',
branch: 'develop'
}, {
since,
repo: './docs',
branch: 'master',
forceCategory: 'docs',
forceCategoryStrip: /^:(books|pencil|pencil2|memo):/
}, {
since,
repo: './../ct-js-site',
branch: 'master',
forceCategory: 'website'
}],
categories: {
rollback: {
pattern: /^:(roller_coaster|rewind):/,
header: '### 🎢 Rollbacked'
},
feature: {
pattern: /^:(rainbow|sparkles):/,
header: '### ✨ New Features'
},
improvement: {
pattern: /^:(zap|wrench):/,
header: '### ⚡️ General Improvements'
},
bug: {
pattern: /^:bug:/,
header: '### 🐛 Bug Fixes'
},
assets: {
pattern: /^:(briefcase|bento):/,
header: '### 🍱 Demos, Dependencies and Stuff'
},
docs: {
pattern: /^:(books|pencil|pencil2|memo):/,
header: '### 📝 Docs'
},
website: {
header: '### 🌐 Website'
},
default: {
header: `### ${miscEmojis[Math.floor(Math.random() * miscEmojis.length)]} Misc`
},
ignore: {
pattern: /^:(construction|doughnut|rocket|bookmark):/,
skip: true
},
merges: {
pattern: 'Merge pull request #',
skip: true
}
}
});
});
});