-
-
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.
✨ Use handlebars templating to generate markdown (#10)
- Loading branch information
1 parent
2d783e4
commit 141d160
Showing
7 changed files
with
96 additions
and
50 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
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 |
---|---|---|
@@ -1,39 +1,42 @@ | ||
const { convert } = require('./index') | ||
|
||
describe('Markdown converter', () => { | ||
it('should convert json changelog into markdown', () => { | ||
const json = { | ||
next: { | ||
it('should convert changelog into markdown', () => { | ||
const changelog = [ | ||
{ | ||
version: 'v1.0.0', | ||
commits: [ | ||
{ | ||
hash: 'c40ee8669ba7ea5151adc2942fa8a7fc98d9e23c', | ||
date: '2018-08-28T10:07:00+02:00', | ||
hash: 'c40ee8669ba7ea5151adc2942fa8a7fc98d9e23f', | ||
date: '2018-08-28T10:06:00+02:00', | ||
subject: ':sparkles: Upgrade brand new feature', | ||
body: 'Waouh this is awesome 3', | ||
body: 'Waouh this is awesome 2', | ||
}, | ||
], | ||
}, | ||
'v1.0.0': { | ||
{ | ||
version: 'next', | ||
commits: [ | ||
{ | ||
hash: 'c40ee8669ba7ea5151adc2942fa8a7fc98d9e23f', | ||
date: '2018-08-28T10:06:00+02:00', | ||
hash: 'c40ee8669ba7ea5151adc2942fa8a7fc98d9e23c', | ||
date: '2018-08-28T10:07:00+02:00', | ||
subject: ':sparkles: Upgrade brand new feature', | ||
body: 'Waouh this is awesome 2', | ||
body: 'Waouh this is awesome 3', | ||
}, | ||
], | ||
}, | ||
} | ||
] | ||
|
||
expect(convert(json)).toEqual(`# Changelog | ||
expect(convert(changelog)).toEqual(`# Changelog | ||
## v1.0.0 | ||
- :sparkles: Upgrade brand new feature (c40ee8669ba7ea5151adc2942fa8a7fc98d9e23f) | ||
## next | ||
- :sparkles: Upgrade brand new feature (c40ee8669ba7ea5151adc2942fa8a7fc98d9e23c) | ||
## v1.0.0 | ||
- :sparkles: Upgrade brand new feature (c40ee8669ba7ea5151adc2942fa8a7fc98d9e23f) | ||
`) | ||
}) | ||
}) |
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,10 @@ | ||
# Changelog | ||
|
||
{{#each changelog}} | ||
## {{version}} | ||
|
||
{{#each commits}} | ||
- {{subject}} ({{hash}}) | ||
{{/each}} | ||
|
||
{{/each}} |
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