Giter Site home page Giter Site logo

grunt-conventional-changelog's Introduction

NPM version Build Status Dependency Status Coverage Status

Generate a changelog using conventional-changelog

Issues with the output should be reported on the conventional-changelog issue tracker.

Install

$ npm install --save-dev grunt-conventional-changelog

Usage

grunt.loadNpmTasks('grunt-conventional-changelog');

grunt.initConfig({
  conventionalChangelog: {
    options: {
      changelogOpts: {
        // conventional-changelog options go here
        preset: 'angular'
      },
      context: {
        // context goes here
      },
      gitRawCommitsOpts: {
        // git-raw-commits options go here
      },
      parserOpts: {
        // conventional-commits-parser options go here
      },
      writerOpts: {
        // conventional-changelog-writer options go here
      }
    },
    release: {
      src: 'CHANGELOG.md'
    }
  }
});

grunt.registerTask('default', ['conventionalChangelog']);

API

See the conventional-changelog docs.

There are some changes:

changelogOpts

warn

It is grunt.verbose.writeln.

Edit your changelog manually

Sometimes after auto-generating the changelog you want to be able to review the generated changes or add some notes to the current release, you can polish your changelog manually without changing your workflow (you might use grunt-release in the workflow but need grunt to wait until you have finished polishing your changelog).

Here are some examples of how to achieve this.

grunt.initConfig({

  // grunt-shell
  shell: {
    changelog: {
      options: {
        stdinRawMode: true
      },
      command: 'subl -w CHANGELOG.md',
    }
  },

  // or grunt-spawn
  spawn: {
    changelog: {
      command: 'vim',
      pattern: 'CHANGELOG.md',
      commandArgs: ['{0}'],
      opts: {
        stdio: 'inherit'
      }
    }
  },

});

...

grunt.registerTask('publish', ['conventionalChangelog', 'shell:changelog', 'release']);

// or

grunt.registerTask('publish', ['conventionalChangelog', 'spawn:changelog', 'release']);

License

MIT

grunt-conventional-changelog's People

Contributors

0x-r4bbit avatar 0x6a68 avatar ajoslin avatar btford avatar d2s avatar passy avatar pdehaan avatar pkozlowski-opensource avatar rainboxx avatar rkoch avatar sindresorhus avatar stevemao avatar vojtajina avatar xzyfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grunt-conventional-changelog's Issues

Can we make a minor release?

cc @btford , there are some bug fixed and more logics are moved to conventional-changelog.

There is no public api changes

If everything seems fine with you can you make a minor release?

Also can you enable travis on https://travis-ci.org please? Thanks.

Currently I'm trying to split conventional-changelog into smaller modules.

Suggested improvement to Readmemd

It took me about 15 minutes to figure out where to put my host details. Previously I just pointed it to the package.json's repository.url property and it worked.

So this example, showing where to put the host and repository name, may help others too:

options: {
  changelogOpts: {
    // conventional-changelog options go here
    preset: 'angular'
  },
  context: {
    host: 'https://somehost',
    repository: 'company/repo-name'
  }
}

This is required to generate the links to the commits in the changelog file

Commit links are no longer working.

After updating, I no longer get the links showing in my output readme file.

Using the following set-up

    conventionalChangelog: {
      options: {
        changelogOpts: {
          preset: 'angular'
        }
      },
      release: {
        src: 'CHANGELOG.md'
      }
    },

I am not longer getting links to my commits in my output.

Previously my readme file looked like this

#### Bug Fixes

* **productSelection:** Fixed issue caused by $watchers ([61140ae4](https:/*****/****/****/commit/61140ae4))

And now it outputs like this

#### Bug Fixes

* **productSelection:** Fixed issue caused by $watchers (61140ae4)

Obviously my package.json etc remains the same. Can anyone tell me where I am going wrong?

Should read existing changelog from `dest` option.

It seems to me that setting dest only affects the output file, not the input file. The input is always read from CHANGELOG.md in the project root.

Running grunt changelog with a non-default dest and no CHANGELOG.md in the project root throws an ENOENT error - Unable to read "CHANGELOG.md".

Installation fails on Windows 10

So for this project I need to work on Windows. Trying to install this resutls in the following. I have otheriwse no issues installing and using other npm packages including grunt plugins which we have been using as our build system.

>npm install --save-dev grunt-conventional-changelog

> [email protected] install c:\myproject\node_modules\buffertools
> node-gyp rebuild


c:\myproject\node_modules\buffertools>if not defined npm_config_node_gyp (node "C:\Users\user\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not fi
nd WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid versio
n number. [c:\myproject\node_modules\buffertools\build\buffertools.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [c:\myproject\node_modules\buffertools\build\buffertools.vcxproj]


gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\myproject\node_modules\buffertools
gyp ERR! node -v v4.4.1
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1
[email protected] node_modules\grunt-contrib-watch\node_modules\tiny-lr\node_modules\noptify\node_modules\nopt -> node_modules\nopt
npm WARN optional Skipping failed optional dependency /grunt-ts/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN optional Skipping failed optional dependency /karma/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN [email protected] No repository field.

Cannot name change log task 'changelog', must call it 'conventionalChangelog'

I am using version 4.1.0. I define the change log task inside Gruntfile.js and name it 'changelog'.

Then I run grunt changelog. Reply from the system is: 'Task changelog not found', but the task is there...

Then I rename the task to 'conventionalChangelog' and run grunt conventionalChangelog. Everything runs just fine.

I've verified that also che following names are not good for my task, and all fail with message task xxx not found

  • cohangelog
  • change_log

The only reason I'm asking is because https://github.com/buildfirst/buildfirst/tree/master/ch04/04_conventional-changelog apparently can use the shorter task name.

spawning git process fails on windows

running "grunt changelog" fails on my computer with a warning that it failed ;-) I tracked it down to line 40 ff. where "git.cmd" is used as command. On my system i have to use the "normal" command "git" (or "git.exe" as you like).

It seems to have change in newer versions of msysgit (as i have 1.8.1.msysgit installed): http://stackoverflow.com/a/14452151

Learning to use the v1.0.0, the README is not so clear

Hi guys,

This project just hits v1.0.0 and I just test it and want make some returns. I think they can interest you.

I first thought that learn to use it will be quick and easy but I came across some problems that have made ​​me nervous. So describe it here can help other people too.

The version number displayed in the changelog file
Like v1.0.0 here https://github.com/btford/grunt-conventional-changelog/blob/master/CHANGELOG.md#v100-2013-07-17

I firstly thought it was generated from the git log history. But I was totaly wrong. It's just a string taken from pkg.version. Why? Because the the changelog is generated by the user grunt changelog just before create the new git tag. It's logic, but if you don't know it, because it's not explain in the README, you can search/think in the wrong direction.

The date displayed in the changelog file
Like (2013-07-17) here https://github.com/btford/grunt-conventional-changelog/blob/master/CHANGELOG.md#v100-2013-07-17

Exactly for the same reason than the previous explanation. It's not the date of a real tag inside the git repo. It's just the current date when you run the script to generate the changelog. You must create the tag right after have exported the changelog. Means if you forgot and create the tag some days after, the date will be "wrong". That was not clear for me.

About the allowed types
You didn't write in the README about the possibility to write message with or without contextual subject like

feat: a new thing
feat(subject): a new thing

Also, you list several type allowed...

feat (feature)
fix (bug fix)
docs (documentation)
style (formatting, missing semi colons, …)
refactor
test (when adding missing tests)
chore (maintain)

...but you didn't explain that the generated changelog will only list the messages starting with feat and fix, all others are simply ignored. Again, it can be logic, but if you didn't know, you can lost a lot of times. I personnaly generate my first changelog with a lot of chore test messages ;)

Other things
One important thing it was not clear at all for me: you only generate the last commits message from the last previous tag.
Means if you currently have v0.1.0 and v0.2.0 tags. And have new commits and want create a v0.3.0 tag, it will export only the changes from the v0.2.0. That's why apped/prepend is important.
That was not clear for me, because I imagine you can generate a changelog from scratch, containing all the history v0.1.0 then v0.2.0 then v0.3.0 in 1 pass. But it's not possible.

Means also that you can miss a tag: if you forgot to export the changelog just before create the v0.3.0 tag, then continue to add commit, when you will want create the v0.4.0 tag, it will export the changelog from v0.3.0 to v0.4.0, but nothing will be listed in the changelog for v0.2.0 to v0.3.0

Also, there is no "security check" when you update the changelog. Means if you call 2 or more times grunt changelog, the history will be append or preprend several times

I hope that my return can help people to learn it or you guys if you want clarify the README

Usage.

At what point in time should someone run the changelog task? I'm rather confused.

Maybe its one of the following;

  • Before a version bump
  • After a version bump
  • Before a commit
  • After a commit

I also have an issue where the task is parsing all of the valid commits, not ones since the last tag.

My process currently is;

  • Make changes
  • Bump
  • Tag
  • Commit
  • grunt changelog

Any guidance would be great, perhaps I can add it do your documentation

commit feat messages not showing up in CHANGELOG.md

Command grunt changelog generates very little info for me:

### 0.0.2 (2014-10-26)

Versions are:
$ git --version
git version 1.9.0.msysgit.0
$ grunt --version
grunt-cli v0.1.13
grunt v0.4.5
$ node --version
v0.10.31
$ npm --version
1.4.23

Using grunt-bump (or those conventions) so git tags created like:
git tag -a v0.0.1 -m "Version 0.0.1"
git commit -m "chore(version) Revision 0.0.1"
Also, grunt-bump says to work with grunt-conventional-changelog as follows:
$ grunt bump-only
$ grunt changelog
$ grunt bump-commit

I am currently working with my repository on Windows 8.1 but can switch over to Ubuntu 14.04 if someone thinks that might help.

It is possible to git clone my repository and run grunt changelog. I'm stuck!

The GitHub repository is specified in package.json as:

"repository": {
  "type": "git",
  "url": "http://github.com/bradsturtevant/swks-genyo-seed"
},

Did command npm install grunt-conventional-changelog --save-dev, update Gruntfile with changelog section, change changelog section to invoke emacs before finishing task, and add repository entry in package.json.

Gruntfile was generated by Yeoman generator-angular, so code uses require('load-grunt-tasks')(grunt); rather than usual grunt.loadNpmTasks('grunt-conventional-changelog'); and use editor option:

changelog: {
  options: {
    // Run emacs before finishing task to manually polish changelog
    editor: 'emacsclient -t -a=\\\"\\\"'
  }
}

I think I have pretty darn good git commit messages. Here is everything in repository:
Brad@BRAD-DESKTOP ~/devel/src/swks-genyo-seed (master)
$ git log
commit f95c9c0afc7f7a30550b56c5a3139b02ddf161f3
Author: Brad Sturtevant [email protected]
Date: Sat Oct 25 22:38:55 2014 -0700

feat(grunt-conventional-changelog) add changelog to Gruntfile, package.json

command npm install grunt-conventional-changelog --save-dev
update Gruntfile with changelog section
change changelog section to invoke emacs before finishing task

commit f16c2db2618d8b614e0ee9c755f3f9fd4beed9fe
Author: Brad Sturtevant [email protected]
Date: Sat Oct 25 21:40:43 2014 -0700

feat(grunt-bump) add grunt-bump to Gruntfile, package.json

command npm install grunt-bump --save-dev
update Gruntfile with bump section
change bump section to not push by default for changelog feature
change bump section defaults to also bump bower.json

commit 28148f8d3a8a9cb4c6fde24c34776d6dbb0f8ef4
Author: Brad Sturtevant [email protected]
Date: Sat Oct 25 20:21:44 2014 -0700

chore(private) indicate private true

add private:true to suppress related npm warning

commit e52eeb14525195117442d45cafb805737470036d
Author: Brad Sturtevant [email protected]
Date: Sat Oct 25 20:18:54 2014 -0700

chore(version) Release 0.0.1

update version in bower.json, package.json

commit f4a5262244efc337abd1ce2b8597afa1603bbe7f
Author: Brad Sturtevant [email protected]
Date: Sat Oct 25 19:40:34 2014 -0700

feat(generator-angular 0.9.8) add generated files to bootstrap project

ran 'yo generator-angular swks'

commit 57b7ef76490f98930b93fe263eefdc9be39bac1f
Author: Brad Sturtevant [email protected]
Date: Sat Oct 25 18:08:30 2014 -0700

chore(LICENCE) update licence with Copyright Brad Sturtevant, Sturdyworks

commit 626cc6a09b0510d28acd9d4aa0367cbe37f92b0b
Author: Brad Sturtevant [email protected]
Date: Sat Oct 25 17:23:25 2014 -0700

Initial commit

Not an independent npm module or CLI

I recently adopted angular commit conventions for non-angular projects.

Detaching this script from grunt would be great. This way it could be used with other task runners (e.g. gulp) and/or have its own CLI which can be installed globally for use with any project, regardless of language or framework.

Of course, the grunt task itself could use the module, so no harm done to projects currently dependent on task.

use `core.editor` from git as editior option

Is there a way to use the git editor (or maybe $VISUAL or $EDITOR) as a default for the editor option?

We use different editors in our office and i don't want to predefine/commit the config with an editor only i use. So it would be nice to have an option to use ENV or something like git config core.editor.

Bug Missing = sign

From my configuration of:

  grunt.config('changelog', {
    options : {
      file : "../CHANGELOG.md",
      dest : "..CHANGELOG.md"
    }
  });

I get the following output
<a name"0.1.17">
... etc

Mind the missing = sign between name and the quote

what is the workflow supposed to be?

I'm stumped.

I can't figure out how I'm supposed to get anything into the changelog.

I've read that it works from the local git. This seems not to be true -- it appears to look at tags on the remote git?

But more importantly, every time I run this it doesn't generate any messages in the changelog, regardless of where my tags are -- it just lists the version and date and doesn't contain any commit messages.

At what point am I supposed to run the changelog task? After "true" commits (the ones that change things other than the changelog) and before tagging? After tagging? Apologies -- I just can't get it to generate anything at all other than a list of version numbers with dates.

Migrate to use conventional-changelog

This should depend on conventional-changelog, and use it.

Be sure to keep compatibility with the current options from grunt-conventional-changelog (some option names are different).

Perhaps with the github option, deprecate it with a warning so we can remove it eventually.

get error when doing custom transform

I get the following error when I try and override the transform object.

section from grunt config:

    conventionalChangelog: {
      options: {
        changelogOpts: {
          // conventional-changelog options go here
          preset: 'angular',

          transform: through.obj(function(chunk, enc, cb) {
            console.log("custom transform called ... ");

            cb(null, chunk);
          }),

          append: true

error:

Fatal error: Uncaught, unspecified "error" event.

I've looked at the default transform object used in conventional-changelog index.js file, even copied it. But whenever I try and pass in transfrom override from grunt, then I get the above error.

Also verified that the trough2 package version is the same as used in conventional changelog code.

Any ideas ? Would be helpful to have an example/testcase on this.

----- snip stack trace -----

custom transform called ...
Fatal error: Uncaught, unspecified "error" event.
Error: Uncaught, unspecified "error" event.
    at Error (native)
    at Readable.EventEmitter.emit (events.js:87:13)
    at DestroyableTransform.<anonymous> (d:\Projects\.........\conventional-changelog\index.js:198:20)

From the stack trace it seems to break in conventional-changelog\index.js when

      gitRawCommits(gitRawCommitsOpts)
        .on('error', function(err) {
          readable.emit('error', 'Error in git-raw-commits. ' + err);
        })
        .pipe(conventionalCommitsParser(parserOpts))
        .on('error', function(err) {
          // ******* BREAKS HERE WITH ERR: "no writecb in Transform class"
          readable.emit('error', 'Error in conventional-commits-parser. ' + err);
        })
        .pipe(options.transform)       // when I uncomment this, or remove override transform then all good

questions

Somes questions Brian please :

  • shouldn't the task returns return done(true); on finished ? looks like it hangs upon complete here.
  • in the generator-angular project, you have a 'stage' task that add the changelog to the git index before release, but why is it not commited too ?

Thanks :)

Julien

Having issues with slashes in scope

Hi,

It appears that grunt-conventional-changelog misses all commits with a "/" in scope (<type>(<scope>): <subject>).

Example commit messages affected:

  • feat(api/user): add support for OAuth2
  • fix(api/v1): fix local API limit

..but the following does work:

  • feat(user): add support for OAuth2

Renaming all commits just to use this tool isn't an option. Any help/advise would be greatly appreciated.

options.dest is ignored

The dest option is not working anymore and it always defaults to 'CHANGELOG.md'.
As a workaround, you can use the file option which does the same.

This bug is caused by changelog.js:

var options = this.options({
      file: 'CHANGELOG.md',
     [...]
    });
options.file = options.file || options.dest;

You can see how options.file is always truthy and options.dest will therefore be ignored.

Template for CHANGELOG.md

Will be nicer if have possibility to change CHANGELOG template.

    // Creates a changelog on a new version
    changelog: {
      options: {
        dest: 'CHANGELOG.md',
        template: 'changelog.tpl'
      }
    }

file.src diffrerent result by npm , git clone

var fileSrc = file.src;
when download this project, this code result : CHANGELOG.md
when npm install this project, this code result : undefined
version : v6.1.0

i don't know why ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.