Merge pull request #1424 from checkr/cjford/optional-git-build-dependency

Allow successful npm build without .git
This commit is contained in:
Danny Coates 2019-12-10 09:38:24 -08:00 committed by GitHub
commit b8bd13c704
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,14 @@
const commit = require('git-rev-sync').short();
const gitRevSync = require('git-rev-sync');
const pkg = require('../package.json');
let commit = 'unknown';
try {
commit = gitRevSync.short();
} catch (e) {
console.warn('Error fetching current git commit: ' + e);
}
const version = JSON.stringify({
commit,
source: pkg.homepage,