refactor: harmonize git utils function names

This commit is contained in:
Pierre Vanduynslager
2018-11-19 18:34:16 -05:00
parent e594638a96
commit 9f5645cfa0
6 changed files with 57 additions and 57 deletions
+3 -3
View File
@@ -2,7 +2,7 @@ const {escapeRegExp, template} = require('lodash');
const semver = require('semver');
const pLocate = require('p-locate');
const debug = require('debug')('semantic-release:get-last-release');
const {gitTags, isRefInHistory, gitTagHead} = require('./git');
const {getTags, isRefInHistory, getTagHead} = require('./git');
/**
* Last release.
@@ -30,7 +30,7 @@ module.exports = async ({cwd, env, options: {tagFormat}, logger}) => {
// The `tagFormat` is compiled with space as the `version` as it's an invalid tag character,
// so it's guaranteed to no be present in the `tagFormat`.
const tagRegexp = `^${escapeRegExp(template(tagFormat)({version: ' '})).replace(' ', '(.+)')}`;
const tags = (await gitTags({cwd, env}))
const tags = (await getTags({cwd, env}))
.map(tag => ({gitTag: tag, version: (tag.match(tagRegexp) || new Array(2))[1]}))
.filter(
tag => tag.version && semver.valid(semver.clean(tag.version)) && !semver.prerelease(semver.clean(tag.version))
@@ -43,7 +43,7 @@ module.exports = async ({cwd, env, options: {tagFormat}, logger}) => {
if (tag) {
logger.log(`Found git tag ${tag.gitTag} associated with version ${tag.version}`);
return {gitHead: await gitTagHead(tag.gitTag, {cwd, env}), ...tag};
return {gitHead: await getTagHead(tag.gitTag, {cwd, env}), ...tag};
}
logger.log('No git tag version found');