Warning only if building in dev mode without Leanplum config.

This commit is contained in:
Brendon Duncan 2018-09-13 13:13:16 +12:00
commit 14eb2d2617

View file

@ -417,15 +417,20 @@ module.exports = function(grunt) {
// Release desktop
grunt.registerTask('build-desktop-release', ['build-desktop', 'sign-desktop']);
function processLeanplumConfig(content, env) {
var leanplumConfig = {};
try {
leanplumConfig = grunt.file.readJSON('../leanplum-config.json');
} catch (e) {
// Without this, there is no clue on the console about what happened.
console.error('Error reading JSON', e);
throw e;
// Without this, there is no clue on the console about what happened.
if (env === 'prod') {
console.error('Error reading JSON', e);
throw e;
} else { // Allow people to build if they don't care about Leanplum
console.warn('Failed to read Leanplum config JSON', e);
return content;
}
}
var leanplumForEnv = env === 'prod' ? leanplumConfig.prod : leanplumConfig.dev;