Skip to content

Commit

Permalink
Fall back to "0.0.0" if no latest version is found
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Dec 10, 2018
1 parent d11a5a8 commit ab4c1e7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/version.js
Expand Up @@ -29,7 +29,7 @@ const parse = async options => {
const npmVersion = _.get(options, 'npm.version');

const latestTag = await getLatestTag();
const latestVersion = isValid(latestTag) ? latestTag : npmVersion;
const latestVersion = (isValid(latestTag) ? latestTag : npmVersion) || '0.0.0';

if (latestTag && npmVersion) {
if (!isValid(latestTag)) {
Expand All @@ -41,6 +41,10 @@ const parse = async options => {
}
}

if (!latestTag && !npmVersion) {
warn(`Could not find latest Git tag or package.json#version. Using "0.0.0" as latest version.`);
}

if (!increment) {
return {
latestVersion,
Expand Down

0 comments on commit ab4c1e7

Please sign in to comment.