get-project-version
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -42,7 +42,16 @@ 'use strict'; | ||
const regexVarCommit = /\{\{ *commit *\}\}/i; | ||
const commit = options.commit || _gitRevSync2.default.short(options.cwd); | ||
const tag = options.tag || _gitRevSync2.default.tag(options.cwd); | ||
const resultVersion = regexVersion.exec(tag); | ||
let commit; | ||
let tag; | ||
let resultVersion; | ||
let version; | ||
try { | ||
commit = options.commit || _gitRevSync2.default.short(options.cwd); | ||
tag = options.tag || _gitRevSync2.default.tag(options.cwd); | ||
resultVersion = regexVersion.exec(tag); | ||
} catch (error) { | ||
commit = 'no commit'; | ||
} | ||
// if git tag does not have a version number read in from package.json | ||
@@ -49,0 +58,0 @@ if (resultVersion) { |
{ | ||
"name": "get-project-version", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "This module will return the current project version string. The version string is made of the last git tag or package.json version (if no git tag exists) and the last commit hash.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
12709
87