Skip to content

Commit 23bfb7a

Browse files
committed
fix: get tag list
1 parent ad316f3 commit 23bfb7a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/utils.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,18 @@ const utils = {
107107
/**
108108
* 获取本地 git 目录的 tag 列表
109109
*
110-
* @param {string} options.dir git 目录
110+
* @param {Object} options 配置
111+
* @param {string} options.dir git 目录
111112
*
112113
* @return {Array}
113114
*/
114-
getTags({dir}) {
115-
return execSync(`cd ${dir} && git tag -l`).toString().split(/\n+/).filter(tag => !!tag).reverse();
115+
getTags(options) {
116+
const shell = [
117+
'cd {dir}',
118+
'git describe --tags `git rev-list --tags --abbrev=0` --abbrev=0 | uniq'
119+
].join(' && ');
120+
121+
return execSync(format(shell, options)).toString().split(/\n+/).filter(tag => !!tag);
116122
},
117123

118124
/**

0 commit comments

Comments
 (0)