Warning only if building in dev mode without Leanplum config.
This commit is contained in:
parent
9d401e255c
commit
14eb2d2617
1 changed files with 9 additions and 4 deletions
13
Gruntfile.js
13
Gruntfile.js
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue