See NPM acquisition.
var nbgv = require('nerdbank-gitversioning')
nbgv.getVersion()
.then(r => console.log(r))
.catch(e => console.error(e));
Will print out a JavaScript object resembling this:
{ "version": "0.0.1.24231",
"simpleVersion": "0.0.1",
"majorMinorVersion": "0.0",
"commitId": "a75ed9bf5388d6a6c89ea7377b2bc0217523c12d",
"commitIdShort": "a75ed9bf53",
"versionHeight": "1",
"semVer1": "0.0.1-ga75ed9bf53",
"semVer2": "0.0.1+ga75ed9bf53" }
Check out our instructions for gulp.