-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Group commits by changelog types (#11)
- Loading branch information
1 parent
02cec25
commit 7b8b49b
Showing
13 changed files
with
308 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,3 +59,5 @@ typings/ | |
|
||
# next.js build output | ||
.next | ||
|
||
CHANGELOG.json |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,47 @@ | ||
# Changelog | ||
|
||
- Merge branch 'master' into refactor/remove-babel (0e650182544bd4e16cccbdd42e6f1e36b320095c) | ||
- :green_heart: Ignore node_modules in linter (802c0f7dc29508876c6b4d178bbcc8274ee308b5) | ||
- :wrench: missing package.json to update (32e0d943c2b4d06b610b17748486d3cc1e4f3a5a) | ||
- :sparkles: add 'use strict' (4df1b8c92e04902698e13041664642ae16c4c3b4) | ||
- :fire: remove bad property in package.json (dfe9aa9ebaca0003f2a403fee8bdd8d612512dee) | ||
- :wrench: add engines attribute to node 10 in package.json (e93603e071062aac50a126f85121e5ee6ff427aa) | ||
- :recycle: refactor code to native node 10 (1213a06adf517cf57867a1d7c380c5c2e1936b67) | ||
- :wrench: remove .babelrc and change eslint to remove babel parser (379d1854991d4d974a50179f6b72a7e83fa674f9) | ||
- :heavy_minus_sign: remove babel dependencies (f3a2a5cff11d4e0835ae74e70b74acdd8379347b) | ||
## next | ||
|
||
### Added | ||
|
||
- :sparkles: Add group to commit object (fafbf3635b75ee3f1d0e580976569017025f05b6) | ||
- :sparkles: Use handlebars templating to generate markdown (#10) (141d1601fd1fa3b278db05acbc8f47e2bb239bbf) | ||
- :sparkles: Generate changelog for the next release (#8) (2d783e44e7d4b84a993237e27b95a5d27532426b) | ||
- :sparkles: Implement format option (#5) (9b7287d167637b7a02387cea135d1d7d44a90695) | ||
- :sparkles: Convert changelog to markdown (b165f695f4c1a49ff16a5f03918545bfb36cf367) | ||
- :sparkles: Generate markdown first draft function (10c6d3e20b82f5a0f6ce5cd372899e6519bc2412) | ||
- :tada: Intialize markdown project (a4a12bb4f7133e7e5e40436da4c884f135abf03d) | ||
- :sparkles: Generate changelog JSON file (86ca3eaefb18fd9c9b6bb4256ed2f6fa711aef59) | ||
- :sparkles: Handle when no repository found (c912efd73b9b286711d468ccb73bf1a03bd6f848) | ||
- :package: Fix build (a1526b38e164b8471954e3dd0c658e10595ee966) | ||
- :package: Build dist file (acba6f776196d8312c470ccefce8be81bafd8d52) | ||
- :fire: remove parsing multiple commit (73207b70d85ad2371def0ec9045e5a6ea46fee8c) | ||
- :tada: intialize cli project (0b4f39408e675f368c9562bd7645ac74abcd2293) | ||
- :sparkles: implements changelog generation to json (44e401db08cc828fcc8c19b027350ac9d310773e) | ||
- :truck: move parse functions into parser.js (e29f239dee8dc393caee9d320371e54a37eb90ae) | ||
- :sparkles: add edge cases for commit parsing (cb35644a640cfe3cb2c246345fe25202d814c436) | ||
- :sparkles: Implements parse commit function (195b59431dde83a4cff26be5c3ab362d97a9604e) | ||
|
||
### Changed | ||
|
||
- :recycle: remove babel to use native node 10 (#3) (6edd0c48591e935f3bcd7e73d48733e623f779d9) | ||
- :truck: move parse functions into parser.js (e29f239dee8dc393caee9d320371e54a37eb90ae) | ||
- :wrench: Fix main script in core module (7f091a3900605ee9bc44e793ddbb10a7272112fa) | ||
- :wrench: Add build script (efbc04d902ac201b128a8e02692b778eff109b12) | ||
- :wrench: Add lint (9faf008d457d777afe0fa3443c34af510c1098fa) | ||
- :green_heart: Set up travis configuration (dda9b287989c1ca2e9513c4a5a4a3d1b6749e816) | ||
- :wrench: Set up tests (656c8bbb506fc8f9064df1fc7aa64e2f1869751e) | ||
- :wrench: Add package.json (34c8f53a58487a6368016de09989465cd2a96786) | ||
|
||
### Removed | ||
|
||
- :fire: remove parsing multiple commit (73207b70d85ad2371def0ec9045e5a6ea46fee8c) | ||
|
||
### Fixed | ||
|
||
- :green_heart: Ignore node_modules in linter (802c0f7dc29508876c6b4d178bbcc8274ee308b5) | ||
- :green_heart: Set up travis configuration (dda9b287989c1ca2e9513c4a5a4a3d1b6749e816) | ||
|
||
### Miscellaneous | ||
|
||
- :memo: Add README.md (c177349386dfd87ab41c58f8a317b0962a511207) | ||
- :package: Fix build (a1526b38e164b8471954e3dd0c658e10595ee966) | ||
- :package: Build dist file (acba6f776196d8312c470ccefce8be81bafd8d52) | ||
- Initial commit (a60d98def5bcbbef74a19db9e8f43af7a6ff6865) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
module.exports = [ | ||
{ | ||
group: 'added', | ||
label: 'Added', | ||
emojis: [ | ||
'sparkles', | ||
'tada', | ||
'white_check_mark', | ||
'bookmark', | ||
'construction_worker', | ||
'charts_with_upwards_trend', | ||
'heavy_plus_sign', | ||
'loud_sound', | ||
], | ||
}, | ||
{ | ||
group: 'changed', | ||
label: 'Changed', | ||
emojis: [ | ||
'art', | ||
'zap', | ||
'lipstick', | ||
'rotating_light', | ||
'arrow_down', | ||
'arrow_up', | ||
'pushpin', | ||
'recycle', | ||
'wrench', | ||
'rewind', | ||
'alien', | ||
'truck', | ||
'boom', | ||
'bento', | ||
'wheelchair', | ||
'speech_ballon', | ||
'card_file_box', | ||
'children_crossing', | ||
'building_construction', | ||
'iphone', | ||
], | ||
}, | ||
{ | ||
group: 'deprecated', | ||
label: 'Deprecated', | ||
emojis: [], | ||
}, | ||
{ | ||
group: 'removed', | ||
label: 'Removed', | ||
emojis: ['fire', 'heavy_minus_sign', 'mute'], | ||
}, | ||
{ | ||
group: 'fixed', | ||
label: 'Fixed', | ||
emojis: [ | ||
'bug', | ||
'ambulance', | ||
'apple', | ||
'penguin', | ||
'checkered_flag', | ||
'robot', | ||
'green_apple', | ||
'green_heart', | ||
'pencil2', | ||
], | ||
}, | ||
{ | ||
group: 'security', | ||
label: 'Security', | ||
emojis: ['lock'], | ||
}, | ||
{ | ||
group: 'misc', | ||
label: 'Miscellaneous', | ||
emojis: [], | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,48 @@ | ||
const splitLines = require('split-lines') | ||
const mapping = require('./mapping') | ||
|
||
function parseSubject(subject) { | ||
if (!subject) return {} | ||
const matches = subject.match(/:(\w*):(.*)/) | ||
if (!matches) return {} | ||
const [, emoji, message] = matches | ||
|
||
return { | ||
emoji, | ||
message: message.trim(), | ||
} | ||
} | ||
|
||
function getCommitGroup(emoji) { | ||
let group = 'misc' | ||
|
||
mapping.forEach(type => { | ||
if (type.emojis.includes(emoji)) { | ||
group = type.group | ||
} | ||
}) | ||
|
||
return group | ||
} | ||
|
||
function parseCommit(commit) { | ||
const lines = splitLines(commit) | ||
const [hash, date, subject, ...body] = lines.splice(1, lines.length - 2) | ||
const { emoji, message } = parseSubject(subject) | ||
const group = getCommitGroup(emoji) | ||
|
||
return { | ||
hash, | ||
date, | ||
subject, | ||
emoji, | ||
message, | ||
group, | ||
body: body.join('\n'), | ||
} | ||
} | ||
|
||
module.exports = { | ||
parseCommit, | ||
getCommitGroup, | ||
} |
Oops, something went wrong.