From c7436ffb1e785bab3e45c1559956dc00204402d5 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Tue, 10 Nov 2020 14:37:32 +0200 Subject: [PATCH] Caught error where git couldn't be used to get version --- app/imports/constants/VERSION.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/imports/constants/VERSION.js b/app/imports/constants/VERSION.js index 5adefb3b..6994932c 100644 --- a/app/imports/constants/VERSION.js +++ b/app/imports/constants/VERSION.js @@ -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' + } +}