git-changelog
Advanced tools
Comparing version 0.1.1 to 0.1.2
<a name="">Git changelog</a> | ||
# (2014-02-26) | ||
# (2014-10-11) | ||
## Documentation | ||
- Added docs | ||
([e0ba50c0](https://github.com/rafinskipg/git-changelog/commits/e0ba50c0bb0b13e9b39a59b8f4dda96e86d55644)) | ||
- **readme:** Final readme Fixes #1 Closes #1 | ||
([e725d8f4](https://github.com/rafinskipg/git-changelog/commits/e725d8f4bf477b517ca6185a75fdfa0aa660b3be)) | ||
## Bug Fixes | ||
- **git_changelog_generate:** pass tag if it exists to gitReadLog | ||
([7c801927](https://github.com/rafinskipg/git-changelog/commits/7c801927672792fc9a818653b74c78d77c7bff9e), | ||
[#5](https://github.com/rafinskipg/git-changelog/issues/5)) | ||
- **package.json:** move q to dependancies since it is required to run | ||
([257119cf](https://github.com/rafinskipg/git-changelog/commits/257119cf2bb6d8f341a5d65a2f47bcf803dff205)) | ||
## Features | ||
- **bootstrap:** creating initial structure | ||
([dea45d68](https://github.com/rafinskipg/git-changelog/commits/dea45d68ce9555e876680bf7c0778add2f367a30)) | ||
- **grunt-plugin:** Now it is ready to be a grunt plugin | ||
([6422e055](https://github.com/rafinskipg/git-changelog/commits/6422e0552b30f6e94d11b03310a23c1342aa5965)) | ||
- **options:** Added ignore tags option | ||
([95362e8b](https://github.com/rafinskipg/git-changelog/commits/95362e8b57a673e810ffe54ff3337de1ea5109a8)) | ||
## Docs | ||
- Added docs- **readme:** Final readme Fixes #1 Closes #1 | ||
## Breaking Changes | ||
--- | ||
<sub><sup>*Generated with [git-changelog](https://github.com/rafinskipg/git-changelog). If you have any problem or suggestion, create an issue.* :) **Thanks** </sub></sup> |
<a name="">Git changelog extended</a> | ||
# (2014-02-26) | ||
# (2014-10-11) | ||
## Documentation | ||
- Added docs | ||
([e0ba50c0](https://github.com/rafinskipg/git-changelog/commits/e0ba50c0bb0b13e9b39a59b8f4dda96e86d55644)) | ||
- **readme:** Final readme Fixes #1 Closes #1 | ||
([e725d8f4](https://github.com/rafinskipg/git-changelog/commits/e725d8f4bf477b517ca6185a75fdfa0aa660b3be)) | ||
## Bug Fixes | ||
@@ -18,2 +10,5 @@ | ||
[#5](https://github.com/rafinskipg/git-changelog/issues/5)) | ||
- **nested lists:** nested list fix. Closes #9 | ||
([22855518](https://github.com/rafinskipg/git-changelog/commits/2285551810919bd4d8a749ae3ddd88f9cedcdd0e), | ||
[#9](https://github.com/rafinskipg/git-changelog/issues/9)) | ||
- **package.json:** move q to dependancies since it is required to run | ||
@@ -25,6 +20,13 @@ ([257119cf](https://github.com/rafinskipg/git-changelog/commits/257119cf2bb6d8f341a5d65a2f47bcf803dff205)) | ||
- Working on new API | ||
([121b9928](https://github.com/rafinskipg/git-changelog/commits/121b99285d2a04f9159951fa0e3f849d0d618fef)) | ||
- **bootstrap:** creating initial structure | ||
([dea45d68](https://github.com/rafinskipg/git-changelog/commits/dea45d68ce9555e876680bf7c0778add2f367a30)) | ||
- **grunt-plugin:** Now it is ready to be a grunt plugin | ||
- **grunt-plugin:** | ||
- Commit for research purposes | ||
([5afbb7a9](https://github.com/rafinskipg/git-changelog/commits/5afbb7a95c9f0e985f78666e7e231967524a8928)) | ||
- Now it is ready to be a grunt plugin | ||
([6422e055](https://github.com/rafinskipg/git-changelog/commits/6422e0552b30f6e94d11b03310a23c1342aa5965)) | ||
- **options:** Added ignore tags option | ||
([95362e8b](https://github.com/rafinskipg/git-changelog/commits/95362e8b57a673e810ffe54ff3337de1ea5109a8)) | ||
@@ -34,11 +36,16 @@ | ||
- **delete:** deleted some files- **docs:** | ||
- Angular document commits - Added docs | ||
- **delete:** deleted some files | ||
- **docs:** | ||
- Angular document commits | ||
- Added docs | ||
## Docs | ||
- Added docs- **readme:** Final readme Fixes #1 Closes #1 | ||
## Documentation | ||
## Breaking Changes | ||
- Added docs | ||
- **readme:** Final readme Fixes #1 Closes #1 | ||
--- | ||
<sub><sup>*Generated with [git-changelog](https://github.com/rafinskipg/git-changelog). If you have any problem or suggestion, create an issue.* :) **Thanks** </sub></sup> |
@@ -43,2 +43,3 @@ /* | ||
appName : 'Git changelog extended', | ||
ignore_tags: true, | ||
file : 'EXTENDEDCHANGELOG.md', | ||
@@ -54,3 +55,12 @@ grep_commits: '^fix|^feat|^docs|^refactor|^chore|BREAKING' | ||
}, | ||
mochaTest: { | ||
test: { | ||
options: { | ||
reporter: 'spec', | ||
//captureFile: 'tests/results.txt', // Optionally capture the reporter output to a file | ||
quiet: false // Optionally suppress output to standard out (defaults to false) | ||
}, | ||
src: ['test/**/*.spec.js'] | ||
} | ||
} | ||
}); | ||
@@ -64,7 +74,7 @@ | ||
grunt.loadNpmTasks('grunt-contrib-clean'); | ||
grunt.loadNpmTasks('grunt-contrib-nodeunit'); | ||
grunt.loadNpmTasks('grunt-mocha-test'); | ||
// Whenever the "test" task is run, first clean the "tmp" dir, then run this | ||
// plugin's task(s), then test the result. | ||
grunt.registerTask('test', ['clean', 'git_changelog', 'nodeunit']); | ||
grunt.registerTask('test', ['clean', 'git_changelog', 'mochaTest']); | ||
@@ -71,0 +81,0 @@ // By default, lint and run all tests. |
{ | ||
"name": "git-changelog", | ||
"description": "A git changelog based on ANGULAR JS commit standards", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/rafinskipg/git-changelog", | ||
@@ -34,7 +34,9 @@ "author": { | ||
"devDependencies": { | ||
"chai": "^1.9.2", | ||
"exec": "0.0.6", | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-clean": "~0.4.0", | ||
"grunt-contrib-jshint": "~0.6.0", | ||
"grunt-contrib-clean": "~0.4.0", | ||
"grunt-contrib-nodeunit": "~0.2.0", | ||
"grunt": "~0.4.1", | ||
"exec": "0.0.6" | ||
"grunt-mocha-test": "^0.12.1", | ||
"mocha": "^1.21.4" | ||
}, | ||
@@ -41,0 +43,0 @@ "peerDependencies": { |
# git-changelog | ||
> A git changelog based on ANGULAR JS commit standards | ||
> A git changelog based on ANGULAR JS commit standards. [NPM page](https://www.npmjs.org/package/git-changelog) | ||
You can see an example generated changelog [here](https://github.com/rafinskipg/git-changelog/blob/master/CHANGELOG.md) | ||
## Getting Started | ||
@@ -30,3 +33,3 @@ This plugin requires Grunt `~0.4.1` | ||
options: { | ||
repo_url: 'https://github.com/rafinskipg/git-changelog', | ||
file: 'https://github.com/rafinskipg/git-changelog', | ||
appName : 'Git changelog' | ||
@@ -49,8 +52,9 @@ } | ||
* branch_name : 'The name of the branch I want to generate my changelog (Defaults to "")', | ||
* repo_url: 'The url of my project ', | ||
* version : '', | ||
* file: 'CHANGELOG.md', | ||
* appName : 'My app - Changelog' | ||
* grep_commits: '^fix|^feat|^docs|^refactor|^chore|BREAKING' | ||
* **branch_name** : The name of the branch. Defaults to ` ` | ||
* **repo_url**: The url of the project. For issues and commits links. Defaults to ` ` | ||
* **version**: The version of the project. Defaults to ` `, | ||
* **file**: The name of the file that will be generated. Defaults to `CHANGELOG.md`, | ||
* **appName** : The name of the project. Defaults to `My App - Changelog` | ||
* **ignore_tags** : Ignore tags, read from the beggining of the history. Defaults to `false` | ||
* **grep_commits**: The commits that will be picked. Defaults to `'^fix|^feat|^docs|^refactor|^chore|BREAKING'` | ||
@@ -57,0 +61,0 @@ ## Git Commit Guidelines - Source : "Angular JS" |
@@ -14,4 +14,6 @@ #!/usr/bin/env node | ||
var q = require('q'); | ||
var OPTS = {}; | ||
var PROVIDER, GIT_LOG_CMD, GIT_NOTAG_LOG_CMD, | ||
IGNORE_TAGS = false, | ||
//ALLOWED_COMMITS = '^fix|^feat|^docs|BREAKING', | ||
@@ -30,3 +32,3 @@ //git-describe - Show the most recent tag that is reachable from a commit | ||
PROVIDER = OPTS.repo_url.indexOf('github.com') !== -1 ? 'G' :'B'; | ||
IGNORE_TAGS = OPTS.ignore_tags ? true : false; | ||
//Log commits | ||
@@ -62,5 +64,2 @@ GIT_LOG_CMD = 'git log ' + OPTS.branch_name + ' --grep="%s" -E --format=%s %s..HEAD'; | ||
msg.hash = lines.shift(); | ||
msg.subject = lines.shift(); | ||
msg.closes = []; | ||
@@ -74,2 +73,5 @@ msg.breaks = []; | ||
msg.hash = lines.shift(); | ||
msg.subject = lines.shift(); | ||
match = raw.match(/BREAKING CHANGE:([\s\S]*)/); | ||
@@ -147,2 +149,3 @@ if (match) { | ||
stream.write(util.format('%s %s\n (%s', prefix, commit.subject, linkToCommit(commit.hash))); | ||
if (commit.closes.length) { | ||
@@ -153,3 +156,3 @@ stream.write(',\n ' + commit.closes.map(linkToIssue).join(', ')); | ||
} else { | ||
stream.write(util.format('%s %s', prefix, commit.subject)); | ||
stream.write(util.format('%s %s\n', prefix, commit.subject)); | ||
} | ||
@@ -162,4 +165,7 @@ }); | ||
var printSalute = function(stream){ | ||
stream.write('\n\n---\n'); | ||
stream.write('<sub><sup>*Generated with [git-changelog](https://github.com/rafinskipg/git-changelog). If you have any problem or suggestion, create an issue.* :) **Thanks** </sub></sup>'); | ||
} | ||
var readGitLog = function( git_log_command, from) { | ||
@@ -203,2 +209,20 @@ var deferred = q.defer(); | ||
organizeCommitsInSections(commits, sections) | ||
stream.write(util.format(HEADER_TPL, OPTS.version, OPTS.appName, OPTS.version, currentDate())); | ||
printSection(stream, 'Bug Fixes', sections.fix); | ||
printSection(stream, 'Features', sections.feat); | ||
printSection(stream, 'Refactor', sections.refactor, false); | ||
printSection(stream, 'Style', sections.style, false); | ||
printSection(stream, 'Test', sections.test, false); | ||
printSection(stream, 'Chore', sections.chore, false); | ||
printSection(stream, 'Documentation', sections.docs, false); | ||
if(sections.breaks[EMPTY_COMPONENT].length > 0 ) { | ||
printSection(stream, 'Breaking Changes', sections.breaks, false); | ||
} | ||
printSalute(stream); | ||
}; | ||
var organizeCommitsInSections = function(commits, sections){ | ||
commits.forEach(function(commit) { | ||
@@ -222,14 +246,5 @@ var section = sections[commit.type]; | ||
}); | ||
return sections; | ||
} | ||
stream.write(util.format(HEADER_TPL, OPTS.version, OPTS.appName, OPTS.version, currentDate())); | ||
printSection(stream, 'Documentation', sections.docs); | ||
printSection(stream, 'Bug Fixes', sections.fix); | ||
printSection(stream, 'Features', sections.feat); | ||
printSection(stream, 'Refactor', sections.refactor, false); | ||
printSection(stream, 'Style', sections.style, false); | ||
printSection(stream, 'Test', sections.test, false); | ||
printSection(stream, 'Chore', sections.chore, false); | ||
printSection(stream, 'Docs', sections.docs, false); | ||
printSection(stream, 'Breaking Changes', sections.breaks, false); | ||
}; | ||
@@ -242,3 +257,2 @@ | ||
child.exec(GIT_TAG_CMD, function(code, stdout, stderr) { | ||
console.log('THemaster'); | ||
if (code ){ deferred.resolve(); | ||
@@ -260,3 +274,3 @@ }else{ deferred.resolve(stdout.replace('\n', '')); } | ||
if(typeof(tag) !== 'undefined'){ | ||
if(typeof(tag) !== 'undefined' && !IGNORE_TAGS){ | ||
console.log('Reading git log since', tag); | ||
@@ -267,3 +281,3 @@ fn = function(){ return readGitLog(GIT_LOG_CMD, tag);}; | ||
fn = function(){ return readGitLog(GIT_NOTAG_LOG_CMD);}; | ||
} | ||
} | ||
@@ -312,3 +326,4 @@ fn().then(function(commits) { | ||
exports.parseRawCommit = parseRawCommit; | ||
exports.organizeCommitsInSections = organizeCommitsInSections; | ||
exports.generate = generate; | ||
@@ -23,3 +23,38 @@ /* | ||
appName : 'My app - Changelog', | ||
grep_commits: '^fix|^feat|^docs|BREAKING' | ||
grep_commits: '^fix|^feat|^docs|BREAKING', | ||
sections: [ | ||
{ | ||
title: 'Bug Fixes', | ||
grep: '^fix' | ||
}, | ||
{ | ||
title: 'Features', | ||
grep: '^feat' | ||
}, | ||
{ | ||
title: 'Documentation', | ||
grep: '^docs' | ||
}, | ||
{ | ||
title: 'Breaking changes', | ||
grep: 'BREAKING' | ||
}, | ||
{ | ||
title: 'Refactor', | ||
grep: '^refactor' | ||
}, | ||
{ | ||
title: 'Style', | ||
grep: '^style' | ||
}, | ||
{ | ||
title: 'Test', | ||
grep: '^test' | ||
}, | ||
{ | ||
title: 'Chore', | ||
grep: '^chore' | ||
} | ||
] | ||
}; | ||
@@ -26,0 +61,0 @@ |
@@ -0,3 +1,7 @@ | ||
'use strict'; | ||
var fs = require('fs'), | ||
expect = require('chai').expect; | ||
describe('changelog.js', function() { | ||
var ch = require('./changelog'); | ||
var ch = require('../tasks/git_changelog_generate'); | ||
@@ -12,8 +16,8 @@ describe('parseRawCommit', function() { | ||
expect(msg.type).toBe('feat'); | ||
expect(msg.hash).toBe('9b1aff905b638aa274a5fc8f88662df446d374bd'); | ||
expect(msg.subject).toBe('broadcast $destroy event on scope destruction'); | ||
expect(msg.body).toBe('perf testing shows that in chrome this change adds 5-15% overhead\n' + | ||
expect(msg.type).to.equal('feat'); | ||
expect(msg.hash).to.equal('9b1aff905b638aa274a5fc8f88662df446d374bd'); | ||
expect(msg.subject).to.equal('broadcast $destroy event on scope destruction'); | ||
expect(msg.body).to.equal('perf testing shows that in chrome this change adds 5-15% overhead\n' + | ||
'when destroying 10k nested scopes where each scope has a $destroy listener\n') | ||
expect(msg.component).toBe('scope'); | ||
expect(msg.component).to.equal('scope'); | ||
}); | ||
@@ -29,6 +33,16 @@ | ||
expect(msg.closes).toEqual([123, 25]); | ||
expect(msg.closes[0]).to.equal(123); | ||
expect(msg.closes[1]).to.equal(25); | ||
}); | ||
it('should parse closed issues in the body comment', function() { | ||
var msg = ch.parseRawCommit( | ||
'13f31602f396bc269076ab4d389cfd8ca94b20ba\n' + | ||
'feat(ng-list): Allow custom separator and Closes #33\n'); | ||
expect(msg.closes[0]).to.equal(33); | ||
}); | ||
it('should parse breaking changes', function() { | ||
@@ -42,5 +56,44 @@ var msg = ch.parseRawCommit( | ||
expect(msg.breaking).toEqual(' first breaking change\nsomething else\nanother line with more info\n'); | ||
expect(msg.breaking).to.equal(' first breaking change\nsomething else\nanother line with more info\n'); | ||
}); | ||
it('Should organize commits', function() { | ||
var msg = ch.parseRawCommit( | ||
'13f31602f396bc269076ab4d389cfd8ca94b20ba\n' + | ||
'feat(ng-list): Allow custom separator\n' + | ||
'bla bla bla\n\n' + | ||
'BREAKING CHANGE: first breaking change\nsomething else\n' + | ||
'another line with more info\n'); | ||
var sections = { | ||
fix: {} | ||
}; | ||
var commits = []; | ||
for(var i = 0; i < 10; i++){ | ||
commits.push(ch.parseRawCommit( | ||
'13f31602f396bc269076ab4d389cfd8ca94b20ba\n' + | ||
'fix(myModule): Allow custom separator\n' + | ||
'bla bla bla\n\n')); | ||
} | ||
sections = ch.organizeCommitsInSections(commits, sections); | ||
expect(sections.fix.myModule.length).to.equal(10); | ||
}); | ||
}); | ||
}); | ||
describe('File creation', function(){ | ||
it('should create A CHANGELOG.md', function(){ | ||
var exists_file = fs.existsSync('CHANGELOG.md'); | ||
expect(exists_file).to.equal(true); | ||
}); | ||
it('should create A EXTENDEDCHANGELOG.md', function(){ | ||
var exists_file = fs.existsSync('EXTENDEDCHANGELOG.md'); | ||
expect(exists_file).to.equal(true); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26534
14
450
121
7