Caught error where git couldn't be used to get version

This commit is contained in:
Stefan Zermatten
2020-11-10 14:37:32 +02:00
parent be7d7f898f
commit c7436ffb1e

View File

@@ -1,6 +1,16 @@
const VERSION = Meteor.isClient ? 'CLIENT' : process.env.SOURCE_VERSION || require('child_process')
.execSync('git rev-parse --short HEAD')
.toString().trim();
const VERSION = Meteor.isClient ?
'CLIENT' :
process.env.SOURCE_VERSION || getVersionFromGit();
export default VERSION;
function getVersionFromGit(){
try {
return require('child_process')
.execSync('git rev-parse --short HEAD')
.toString().trim();
} catch (e){
return 'GIT_VERSION_FAIL'
}
}