gulp-i18n-leverage
Advanced tools
Comparing version
29
index.js
@@ -336,19 +336,32 @@ /* | ||
var i; | ||
var tmpContents; | ||
try { | ||
prevDefault = JSON.parse(fs.readFileSync(paths.srcDefaultPath, 'utf8')); | ||
prevDefault = JSON.parse(tmpContents = fs.readFileSync(paths.srcDefaultPath, 'utf8')); | ||
} | ||
catch (e) { | ||
prevDefault = {}; // presumably file not found | ||
if (!e.toString().match(/SyntaxError/) || tmpContents) { | ||
gutil.log(gutil.colors.cyan(paths.srcDefaultPath), | ||
gutil.colors.yellow(e.toString())); | ||
} | ||
prevDefault = { meta: {} }; // presumably file not found | ||
} | ||
try { | ||
currentDefault = JSON.parse(fs.readFileSync(paths.distDefaultPath, 'utf8')); | ||
currentDefault = JSON.parse(tmpContents = fs.readFileSync(paths.distDefaultPath, 'utf8')); | ||
} | ||
catch (e) { | ||
currentDefault = {}; // presumably file not found | ||
if (!e.toString().match(/SyntaxError/) || tmpContents) { | ||
gutil.log(gutil.colors.cyan(paths.distDefaultPath), | ||
gutil.colors.yellow(e.toString())); | ||
} | ||
currentDefault = { meta: {} }; // presumably file not found | ||
} | ||
for (i = 0; i < paths.ancestorSrcPaths.length; i++) { | ||
try { | ||
prevAncestors[i] = JSON.parse(fs.readFileSync(paths.ancestorSrcPaths[i], 'utf8')); | ||
prevAncestors[i] = JSON.parse(tmpContents = fs.readFileSync(paths.ancestorSrcPaths[i], 'utf8')); | ||
} | ||
catch (e) { | ||
if (!e.toString().match(/SyntaxError/) || tmpContents) { | ||
gutil.log(gutil.colors.cyan(paths.ancestorSrcPaths[i]), | ||
gutil.colors.yellow(e.toString())); | ||
} | ||
prevAncestors[i] = null; // presumably file not found | ||
@@ -362,3 +375,7 @@ } | ||
catch (e) { | ||
prevLocalized = {}; | ||
if (!e.toString().match(/SyntaxError/) || contents) { | ||
gutil.log(gutil.colors.cyan(paths.urlPath), | ||
gutil.colors.yellow(e.toString())); | ||
} | ||
prevLocalized = { meta: {} }; | ||
} | ||
@@ -365,0 +382,0 @@ prevLocalizedOriginal = deepcopy(prevLocalized); |
{ | ||
"name": "gulp-i18n-leverage", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Merge changes in default JSON into localized JSON for i18n-behavior", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
106860
0.82%2820
0.61%