]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fixes for generateMomentWithLocales 2393/head
authorDennis <me@dennislin.io>
Thu, 28 May 2015 21:48:01 +0000 (14:48 -0700)
committerDennis <me@dennislin.io>
Thu, 28 May 2015 21:48:01 +0000 (14:48 -0700)
tasks/transpile.js

index e0db865bcd85d57049fe656b99fbe26df6460280..d253407d1dc0bdebf57ee64a8bcc37bec51a6add 100644 (file)
@@ -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');