fix: simplify get-tags
algorithm
This commit is contained in:
parent
131734873e
commit
00420a83c0
@ -14,15 +14,10 @@ module.exports = async ({cwd, env, options: {tagFormat}}, branches) => {
|
|||||||
return pReduce(
|
return pReduce(
|
||||||
branches,
|
branches,
|
||||||
async (branches, branch) => {
|
async (branches, branch) => {
|
||||||
const branchTags = await Promise.all(
|
const branchTags = (await getTags(branch.name, {cwd, env})).reduce((tags, tag) => {
|
||||||
(await getTags(branch.name, {cwd, env}))
|
|
||||||
.map(tag => {
|
|
||||||
const [, version, channel] = tag.match(tagRegexp) || [];
|
const [, version, channel] = tag.match(tagRegexp) || [];
|
||||||
return {gitTag: tag, version, channel};
|
return version && semver.valid(semver.clean(version)) ? [...tags, {gitTag: tag, version, channel}] : tags;
|
||||||
})
|
}, []);
|
||||||
.filter(({version}) => version && semver.valid(semver.clean(version)))
|
|
||||||
.map(async ({gitTag, ...rest}) => ({gitTag, ...rest}))
|
|
||||||
);
|
|
||||||
|
|
||||||
debug('found tags for branch %s: %o', branch.name, branchTags);
|
debug('found tags for branch %s: %o', branch.name, branchTags);
|
||||||
return [...branches, {...branch, tags: branchTags}];
|
return [...branches, {...branch, tags: branchTags}];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user