chg
Version:
simple changelog/release history manager
201 lines (140 loc) • 4.17 kB
Markdown
unfancy release history tracking
[](http://blog.heff.me/post/75189221194/introducing-chg-a-simple-changelog-cli-lib)
functions:
- `init` - create a CHANGELOG.md file
- `add` - add new changes to the changelog under a 'HEAD (Unreleased)' heading
- `release` - move all unreleased changes under a new release version
`chg` can be useful when built into a release/deploy script or paired with a pull request merging script like [pulley](https://github.com/jeresig/pulley).
It **does not** try to automatically generate changes from git commits or github pull requests, though you could build that on top of the `chg` functions.
```markdown
CHANGELOG
=========
* Removed crusty semantic html, javascript app ftw
--------------------
* Removed horrible tables, semantic html ftw
* Switched background to vertical gradient
* Added dropshadows to EVERYTHING
* Added a dot.gif to 3,000 table cells to fix layout issues
* Removed horrible Flash, table layout ftw
* Switched background to horizontal gray lines
* Duplicated all Flash content in HTML so Yahoo can see it
* Removed horrible frames, Flash ftw
* Switched background to fast moving clouds like 2advanced V3
* Added a "GIF" of a construction worker. ha ha ha
* Navigation frame ftw
* Added repeating tanbark background to look more professional
```
```bash
[] npm install -g chg
chg init
chg add 'My first change'
chg release '0.0.1'
```
shell
```shell
npm install chg --save
```
javascript
```js
var chg = require('chg');
// create CHANGELOG.md
chg.init({}, callback);
// add a change
chg.add('My first change', {}, callback);
// create a release
chg.release('0.0.1', {}, callback);
// each command can take a callback, but each also returns synchronously
var changeData = chg.release('3.0.0', {});
// changeData = { title: '0.0.1', changes: '* Removed crusty semantic html, javascript app ftw', changeLog: '/* entire changelog */' }
chg.find('1.1.1');
// => { title: '## 1.1.1 (2002-08-16)', changes: ['* Added a dot.gif to 3,000 table cells to fix layout issues'], changesRaw: '* Added a dot.gif to 3,000 table cells to fix layout issues' }
```
shell
```shell
npm install chg --save-dev
```
Gruntfile.js
```js
grunt.loadNpmTasks('chg');
```
shell
```shell
grunt chg-init
grunt chg-add
grunt chg-release
```
```json
"scripts": {
"version": "chg release -y && git add -A CHANGELOG.md"
}
```
**The `-y` flag will use the current version in `package.json`**
Creates a CHANGELOG.md file in the current directory.
```bash
chg init
```
```markdown
CHANGELOG
=========
* _(none)_
--------------------
```
Add a line to the change log. The first argument is the line to add.
```bash
chg add "My new change!"
```
```markdown
CHANGELOG
=========
* My new change!
--------------------
```
Add a line to the change log. The first argument is the version to be used as the release version.
```bash
chg release "v0.1.0"
```
```markdown
CHANGELOG
=========
* _(none)_
--------------------
* My new change!
```
Finds a release given a version.
Delete the current changelog
See [CHANGELOG.md](CHANGELOG.md) :scream_cat:
Copyright (c) 2014 heff. Licensed under the Apache license.