Skip to content
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

Merged
merged 29 commits into from
Oct 25, 2018
Merged

Conversation

bpetetot
Copy link
Collaborator

@bpetetot bpetetot commented Oct 4, 2018

New process to generate full and partial changelog.

By default, when executing the CLI with ./gitmoji-changelog:

  • If CHANGELOG file doesn't exists, a full changelog is generated
  • If CHANGELOG exists, a partial changelog is generated, it can be:
    • the next version (must be given by the user or read from package.json)
    • the next release (current work)

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

@bpetetot bpetetot added the work in progress Still in progress label Oct 4, 2018
@bpetetot bpetetot self-assigned this Oct 4, 2018
@bpetetot bpetetot changed the title ♻️ full and partial changelog generation ✨ full and partial changelog generation Oct 4, 2018
@bpetetot bpetetot removed the work in progress Still in progress label Oct 7, 2018
})

// FIXME: should find a better way to mock fs
it.skip('should generate incremental markdown changelog', async () => {
Copy link
Collaborator Author

@bpetetot bpetetot Oct 7, 2018

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

Copy link
Owner

@frinyvonnick frinyvonnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 👍

packages/gitmoji-changelog-cli/src/cli.js Outdated Show resolved Hide resolved
packages/gitmoji-changelog-cli/src/cli.spec.js Outdated Show resolved Hide resolved
packages/gitmoji-changelog-cli/src/index.js Outdated Show resolved Hide resolved
packages/gitmoji-changelog-core/src/index.js Outdated Show resolved Hide resolved
packages/gitmoji-changelog-core/src/index.js Show resolved Hide resolved
packages/gitmoji-changelog-core/src/index.spec.js Outdated Show resolved Hide resolved
return new Promise(resolve => {
const stream = fs.createReadStream(currentFile)
.pipe(es.split())
.pipe(es.mapSync((line) => {
Copy link
Collaborator

@fabienjuif fabienjuif Oct 15, 2018

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 ?

@bpetetot bpetetot merged commit e7c934a into master Oct 25, 2018
@bpetetot bpetetot deleted the feat/init-and-update branch October 25, 2018 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants