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 // Release desktop
grunt.registerTask('build-desktop-release', ['build-desktop', 'sign-desktop']); grunt.registerTask('build-desktop-release', ['build-desktop', 'sign-desktop']);
function processLeanplumConfig(content, env) { function processLeanplumConfig(content, env) {
var leanplumConfig = {}; var leanplumConfig = {};
try { try {
leanplumConfig = grunt.file.readJSON('../leanplum-config.json'); leanplumConfig = grunt.file.readJSON('../leanplum-config.json');
} catch (e) { } catch (e) {
// Without this, there is no clue on the console about what happened. // Without this, there is no clue on the console about what happened.
console.error('Error reading JSON', e); if (env === 'prod') {
throw e; 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; var leanplumForEnv = env === 'prod' ? leanplumConfig.prod : leanplumConfig.dev;