forked from moment/moment
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move es6 files to src, add transpile and qtest grunt tasks
- Loading branch information
Showing
129 changed files
with
77 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ sauce_connect.log | |
.sauce-labs.creds | ||
npm-debug.log | ||
.build* | ||
temp | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module.exports = function (grunt) { | ||
grunt.task.registerTask("qtest", "run tests locally", function () { | ||
|
||
var done = this.async(); | ||
|
||
var testrunner = require("qunit"); | ||
|
||
testrunner.options.log.assertions = false; | ||
testrunner.options.log.tests = false; | ||
testrunner.options.log.summary = false; | ||
testrunner.options.log.testing = false; | ||
|
||
testrunner.run({ | ||
code: "build/umd/moment.js", | ||
tests: grunt.file.expand("build/umd/test/moment/*.js"), | ||
}, function(err, report) { | ||
if (err) { | ||
done(err); | ||
return; | ||
} | ||
var err = null; | ||
if (report.failed !== 0) { | ||
err = new Error(report.failed + " tests failed"); | ||
} | ||
done(err); | ||
}); | ||
|
||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module.exports = function (grunt) { | ||
var esperanto = require('esperanto'); | ||
var Promise = require('es6-promise').Promise; | ||
|
||
grunt.task.registerTask('transpile', 'convert es6 to umd', function () { | ||
var done = this.async(); | ||
|
||
grunt.file.delete("build"); | ||
|
||
esperanto.bundle({ | ||
base: 'src', // optional, defaults to current dir | ||
entry: 'moment.js' // the '.js' is optional | ||
}).then(function(bundle) { | ||
var umd = bundle.toUmd({name: 'moment'}); | ||
grunt.file.write('build/umd/moment.js', umd.code); | ||
}).then(function() { | ||
var files = grunt.file.expand({cwd: 'src'}, "test/moment/*.js"); | ||
var header = grunt.file.read('templates/test-header.js'); | ||
|
||
return Promise.all(files.map(function (file) { | ||
return esperanto.bundle({ | ||
base: 'src', | ||
entry: file, | ||
skip: ['moment'] | ||
}).then(function (bundle) { | ||
var umd = bundle.toUmd({name: 'not_used'}); | ||
var fixed = header + umd.code.split('\n').slice(5).join('\n'); | ||
grunt.file.write('build/umd/' + file, fixed); | ||
}); | ||
})); | ||
|
||
}).catch(function() { | ||
}).then(done); | ||
|
||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../moment')) : | ||
typeof define === 'function' && define.amd && define(['../../moment'], factory); | ||
}(this, function (moment) { 'use strict'; |