From 14f53fc0c28be4084778785aeace3763ed0d827f Mon Sep 17 00:00:00 2001 From: vince Date: Tue, 23 Jan 2018 15:09:53 +0100 Subject: [PATCH] feat add changelog generation support --- .changelogrc | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 2 +- template.md | 13 +++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .changelogrc create mode 100644 template.md diff --git a/.changelogrc b/.changelogrc new file mode 100644 index 000000000..67e6dcb29 --- /dev/null +++ b/.changelogrc @@ -0,0 +1,53 @@ +{ + "app_name": "", + "logo": "", + "intro": "", + "branch" : "master", + "repo_url": "https://github.com/Unitech/pm2", + "version_name" : "v2.9.2", + "tag": "2.9.1", + "file": "currentTagChangelog.md", + "template": "template.md", + "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" + }, + { + "title": "Branchs merged", + "grep": "^Merge branch" + }, + { + "title" : "Pull requests merged", + "grep": "^Merge pull request" + } + ] +} diff --git a/.gitignore b/.gitignore index 7903de4bc..31e1bf66d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ /node_modules *.log -*.log *.pid test/child *.iml @@ -15,3 +14,4 @@ package-lock.json .DS_Store *.swp *.swo +currentTagChangelog.md diff --git a/template.md b/template.md new file mode 100644 index 000000000..b82e71d2c --- /dev/null +++ b/template.md @@ -0,0 +1,13 @@ +<% if(logo) { %>pm2 logo <% } %> +<% if(logo) { %># <%= title %> <% } %> +<% if(intro) { %><%= '\n' %><%= intro %><%= '\n' %><% } %> +<% if(version && (version.name || version.number)) { %>##<% if(version.name){%> <%= version.name %><% } %> <% if(version.date){ %>( <%= version.date %> )<% } %><%= '\n' %><% } %> +<% _.forEach(sections, function(section){ + if(section.commitsCount > 0) { %> +## <%= section.title %> +<% _.forEach(section.commits, function(commit){ %> - <%= printCommit(commit, true) %><% }) %> +<% _.forEach(section.components, function(component){ %> - **<%= component.name %>** +<% _.forEach(component.commits, function(commit){ %> - <%= printCommit(commit, true) %><% }) %> +<% }) %> +<% } %> +<% }) %>