-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ full and partial changelog generation #23
Conversation
6d8c59c
to
f86030c
Compare
}) | ||
|
||
// FIXME: should find a better way to mock fs | ||
it.skip('should generate incremental markdown changelog', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test works but it is not full, I didn't succeed to mock streams of fs
, it runs in conflict with jest
that use fs
internaly. We should find a better way to mock fs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👍
return new Promise(resolve => { | ||
const stream = fs.createReadStream(currentFile) | ||
.pipe(es.split()) | ||
.pipe(es.mapSync((line) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you don't end to end pipe
const { Transform } = require('stream')
// [...]
fs.createReadStream(currentFile)
.pipe(es.split())
.pipe(new Transform({
transform(chunk, enc, callback) {
if (line.startsWith(`<a name="${lastVersion}"></a>`)) {
lastVersionFound = true
}
if (lastVersionFound) {
callback(null, `${line}\n`)
} else {
callback()
}
},
})
.pipe(writer)
It doesn't work ?
New process to generate full and partial changelog.
By default, when executing the CLI with
./gitmoji-changelog
:We can also have separated CLI commands:
./gitmoji-changelog init
: full changelog generation./gitmoji-changelog update [version|next]
: partial changelog generation (by default: package.json)Fixes #25