1 Star 0 Fork 0

duheng/flash-ui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
changelogconfig.js 3.29 KB
一键复制 编辑 原始数据 按行查看 历史
duheng 提交于 2021-08-09 22:28 . init project
// From https://github.com/conventional-changelog-archived-repos/conventional-changelog-angular
'use strict';
var compareFunc = require('compare-func');
var Q = require('q');
var readFile = Q.denodeify(require('fs').readFile);
var resolve = require('path').resolve;
var path = require('path');
var pkgJson = {};
try {
pkgJson = require(path.resolve(
process.cwd(),
'./package.json'
));
} catch (err) {
console.error('no root package.json found');
}
var parserOpts = {
headerPattern: /^(\w*)(?:\((.*)\))?[\/|\:](.*)$/,
headerCorrespondence: [
'type',
'scope',
'subject'
],
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: ['header', 'hash']
};
var writerOpts = {
transform: function(commit) {
var discard = true;
var issues = [];
commit.notes.forEach(function(note) {
note.title = 'BREAKING CHANGES';
discard = false;
});
if (commit.type === 'feat' || commit.type === 'feature') {
commit.type = 'Features';
} else if (commit.type === 'fix') {
commit.type = 'Bug Fixes';
} else if (commit.type === 'perf') {
commit.type = 'Performance Improvements';
} else if (commit.type === 'revert') {
commit.type = 'Reverts';
} else if (discard) {
return;
} else if (commit.type === 'docs') {
commit.type = 'Documentation';
} else if (commit.type === 'style') {
commit.type = 'Styles';
} else if (commit.type === 'refactor') {
commit.type = 'Code Refactoring';
} else if (commit.type === 'test') {
commit.type = 'Tests';
} else if (commit.type === 'chore') {
commit.type = 'Chores';
}
if (commit.scope === '*') {
commit.scope = '';
}
if (typeof commit.hash === 'string') {
commit.hash = commit.hash.substring(0, 7);
}
if (typeof commit.subject === 'string') {
commit.subject = commit.subject.trim();
var url = 'http://172.16.0.244:8080/browse/';
// JIRA issue URLs.
commit.subject = commit.subject.replace(/(warp-[0-9]+)/gi, function(_, issue) {
issues.push(issue);
return '[' + issue.toUpperCase() + '](' + url + issue + ')';
});
}
// remove references that already appear in the subject
commit.references = commit.references.filter(function(reference) {
if (issues.indexOf(reference.issue) === -1) {
return true;
}
return false;
});
return commit;
},
groupBy: 'type',
commitGroupsSort: 'title',
commitsSort: ['scope', 'subject'],
noteGroupsSort: 'title',
notesSort: compareFunc
};
module.exports = Q.all([
readFile(resolve(__dirname, 'templates/template.hbs'), 'utf-8'),
readFile(resolve(__dirname, 'templates/header.hbs'), 'utf-8'),
readFile(resolve(__dirname, 'templates/commit.hbs'), 'utf-8'),
readFile(resolve(__dirname, 'templates/footer.hbs'), 'utf-8')
])
.spread(function(template, header, commit, footer) {
writerOpts.mainTemplate = template;
writerOpts.headerPartial = header;
writerOpts.commitPartial = commit;
writerOpts.footerPartial = footer;
return {
parserOpts: parserOpts,
writerOpts: writerOpts
};
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/dh1992/flash-ui.git
git@gitee.com:dh1992/flash-ui.git
dh1992
flash-ui
flash-ui
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385