From 13eb140a83f3ebad569f50c10e260788f213e152 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Wed, 3 Jan 2018 15:25:29 -0500 Subject: [PATCH] don't write out strings from find_locale_strings during tests but we still want to run the rest of the script as it ensures we wrapped all strings --- package.json | 2 +- tasks/find_locale_strings.js | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 26da4f3e43b..a84b02157d0 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "test-image": "node tasks/test_image.js", "test-image-gl2d": "node tasks/test_image.js gl2d_* --queue", "test-export": "node tasks/test_export.js", - "test-syntax": "node tasks/test_syntax.js && npm run find-strings", + "test-syntax": "node tasks/test_syntax.js && npm run find-strings -- --no-output", "test-bundle": "node tasks/test_bundle.js", "test": "npm run test-jasmine && npm run test-bundle && npm run test-image && npm run test-image-gl2d && npm run test-syntax && npm run lint", "start-test_dashboard": "node devtools/test_dashboard/server.js", diff --git a/tasks/find_locale_strings.js b/tasks/find_locale_strings.js index ff1da8552e3..ae3b3d5d214 100644 --- a/tasks/find_locale_strings.js +++ b/tasks/find_locale_strings.js @@ -13,6 +13,8 @@ var EXIT_CODE = 0; var localizeRE = /(^|[\.])(_|localize)$/; +var noOutput = process.argv.indexOf('--no-output') !== -1; + // main findLocaleStrings(); @@ -70,11 +72,16 @@ function findLocaleStrings() { } if(!EXIT_CODE) { - var strings = Object.keys(dict).sort().map(function(k) { - return k + spaces(maxLen - k.length) + ' // ' + dict[k]; - }).join('\n'); - common.writeFile(constants.pathToTranslationKeys, strings); - console.log('ok find_locale_strings'); + if(noOutput) { + console.log('ok find_locale_strings - no output requested.'); + } + else { + var strings = Object.keys(dict).sort().map(function(k) { + return k + spaces(maxLen - k.length) + ' // ' + dict[k]; + }).join('\n'); + common.writeFile(constants.pathToTranslationKeys, strings); + console.log('ok find_locale_strings - wrote new key file.'); + } } }); }