]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
[misc] Build es bundle (unused for now)
authorIskren Chernev <iskren.chernev@gmail.com>
Fri, 1 May 2020 18:32:18 +0000 (21:32 +0300)
committerIskren Chernev <iskren.chernev@gmail.com>
Fri, 1 May 2020 18:32:18 +0000 (21:32 +0300)
tasks/transpile.js
templates/empty.js [new file with mode: 0644]

index 586c7dba282499aabfc41e3e46afcf4301acb41a..9f594d7bca426935e671df10091ae51bb3f56f29 100644 (file)
@@ -37,7 +37,7 @@ module.exports = function (grunt) {
                 ],
             },
             bundleOpts = {
-                format: 'umd',
+                format: opts.format != null ? opts.format : 'umd',
                 name: opts.umdName != null ? opts.umdName : 'not_used',
             };
 
@@ -81,6 +81,7 @@ module.exports = function (grunt) {
             entry: entry,
             skipMoment: opts.skipMoment != null ? opts.skipMoment : false,
             umdName: umdName,
+            format: opts.format,
         }).then(function (code) {
             var fixed = header + code.split('\n').slice(skipLines).join('\n');
             if (opts.moveComments) {
@@ -193,6 +194,21 @@ module.exports = function (grunt) {
             .then(function () {
                 grunt.log.ok('build/umd/moment.js');
             })
+            .then(function () {
+                return transpile({
+                    base: 'src',
+                    entry: 'moment.js',
+                    umdName: 'moment',
+                    headerFile: 'templates/empty.js',
+                    target: 'build/esm/moment.js',
+                    format: 'es',
+                    skipLines: 0,
+                    moveComments: true,
+                });
+            })
+            .then(function () {
+                grunt.log.ok('build/esm/moment.js');
+            })
             .then(function () {
                 return transpileMany({
                     base: 'src',
diff --git a/templates/empty.js b/templates/empty.js
new file mode 100644 (file)
index 0000000..e69de29