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.
- Loading branch information
Showing
5 changed files
with
99 additions
and
1 deletion.
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,3 +7,4 @@ sauce_connect.log | |
.sauce-labs.creds | ||
npm-debug.log | ||
.build* | ||
temp |
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,58 @@ | ||
var compileModules = require('broccoli-es6-module-transpiler'); | ||
var compile6to5 = require('broccoli-6to5-transpiler'); | ||
var uglify = require('broccoli-uglify-js'); | ||
var merge = require('broccoli-merge-trees'); | ||
var Funnel = require('broccoli-funnel'); | ||
|
||
var testFiles = new Funnel('.', { | ||
include: [/^test\/(moment|qunit|helpers)/] | ||
}); | ||
|
||
var libAndTests = merge(['lib', testFiles]); | ||
|
||
var tests = compileModules(libAndTests, { | ||
formatter: 'bundle', | ||
output: 'test/moment-and-tests.js' | ||
}); | ||
|
||
function bundle (file) { | ||
var template = new Funnel('templates', { | ||
include : [new RegExp(file + ".js")] | ||
}); | ||
return compileModules(merge(['lib', template]), { | ||
formatter: 'bundle', | ||
output: file + '/moment.js' | ||
}); | ||
} | ||
|
||
var bundled = merge([ | ||
bundle('amd'), | ||
bundle('amd-named'), | ||
bundle('globals') | ||
]); | ||
|
||
var minified = uglify(bundled, { | ||
mangle: true, | ||
compress: { | ||
dead_code: false // jshint ignore:line | ||
}, | ||
output: { | ||
ascii_only: true // jshint ignore:line | ||
} | ||
}); | ||
|
||
var commonjsSource = compile6to5(libAndTests, { | ||
modules: 'commonInterop' | ||
}); | ||
|
||
var commonjs = new Funnel(commonjsSource, { | ||
destDir: "commonjs" | ||
}); | ||
|
||
var all = merge([minified, tests, commonjs]); | ||
|
||
var allWithoutMaps = new Funnel(all, { | ||
exclude: [/\.map$/] | ||
}); | ||
|
||
module.exports = allWithoutMaps; |
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
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,6 @@ | ||
export default function (array, callback) { | ||
var i; | ||
for (i = 0; i < array.length; i++) { | ||
callback(array[i], i, array); | ||
} | ||
} |
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,24 @@ | ||
/*global QUnit:false*/ | ||
|
||
import moment from "../moment"; | ||
|
||
export var test = QUnit.test; | ||
|
||
export function module (name, lifecycle) { | ||
QUnit.module(name, { | ||
setup : function () { | ||
moment.locale('en'); | ||
moment.createFromInputFallback = function () { | ||
throw new Error('input not handled by moment'); | ||
}; | ||
if (lifecycle && lifecycle.setup) { | ||
lifecycle.setup(); | ||
} | ||
}, | ||
teardown : function () { | ||
if (lifecycle && lifecycle.teardown) { | ||
lifecycle.teardown(); | ||
} | ||
} | ||
}); | ||
} |