From: Dennis Date: Thu, 28 May 2015 21:48:01 +0000 (-0700) Subject: Fixes for generateMomentWithLocales X-Git-Tag: 2.10.5~36^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32e14790c4989e2f38569da09ead7f330dc54ba3;p=thirdparty%2Fmoment.git Fixes for generateMomentWithLocales --- diff --git a/tasks/transpile.js b/tasks/transpile.js index e0db865bc..d253407d1 100644 --- a/tasks/transpile.js +++ b/tasks/transpile.js @@ -141,7 +141,15 @@ module.exports = function (grunt) { throw new Error('Failed to detect get default crap, check /tmp/crap.js'); } code = code.replace(getDefaultRegExp, ''); - code = code.replace('var moment_with_locales = ' + crap[1], 'var moment_with_locales = ' + crap[2]); + + var buildExportVars = ['moment_with_locales', 'moment_with_locales_custom']; + buildExportVars.forEach(function (buildExportVar) { + var languageReset = buildExportVar + '.locale(\'en\');'; + code = code.replace('var ' + buildExportVar + ' = ' + crap[1] + ';', + 'var ' + buildExportVar + ' = ' + crap[2] + ';\n' + + ' ' + languageReset); + }); + if (code.match('get default')) { grunt.file.write('/tmp/crap.js', code); throw new Error('Stupid shit es6 get default plaguing the code, check /tmp/crap.js');