{
- "name": "moment",
- "version": "2.15.1",
- "description": "Parse, validate, manipulate, and display dates",
- "homepage": "http://momentjs.com",
- "author": "Iskren Ivov Chernev <iskren.chernev@gmail.com> (https://github.com/ichernev)",
- "contributors": [
- "Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)",
- "Rocky Meza (http://rockymeza.com)",
- "Matt Johnson <mj1856@hotmail.com> (http://codeofmatt.com)",
- "Isaac Cambron <isaac@isaaccambron.com> (http://isaaccambron.com)",
- "Andre Polykanine <andre@oire.org> (https://github.com/oire)"
+ "name": "moment",
+ "version": "2.15.1",
+ "description": "Parse, validate, manipulate, and display dates",
+ "homepage": "http://momentjs.com",
+ "author": "Iskren Ivov Chernev <iskren.chernev@gmail.com> (https://github.com/ichernev)",
+ "contributors": [
+ "Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)",
+ "Rocky Meza (http://rockymeza.com)",
+ "Matt Johnson <mj1856@hotmail.com> (http://codeofmatt.com)",
+ "Isaac Cambron <isaac@isaaccambron.com> (http://isaaccambron.com)",
+ "Andre Polykanine <andre@oire.org> (https://github.com/oire)"
+ ],
+ "keywords": [
+ "moment",
+ "date",
+ "time",
+ "parse",
+ "format",
+ "validate",
+ "i18n",
+ "l10n",
+ "ender"
+ ],
+ "main": "./moment.js",
+ "jsnext:main": "./src/moment.js",
+ "typings": "./moment.d.ts",
+ "engines": {
+ "node": "*"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/moment/moment.git"
+ },
+ "bugs": {
+ "url": "https://github.com/moment/moment/issues"
+ },
+ "license": "MIT",
+ "devDependencies": {
+ "babel-core": "^6.17.0",
+ "babel-plugin-transform-es2015-modules-umd": "^6.12.0",
+ "babel-preset-es2015": "^6.16.0",
+ "benchmark": "latest",
+ "coveralls": "^2.11.2",
+ "es6-promise": "latest",
+ "esperanto": "latest",
+ "grunt": "~0.4",
+ "grunt-benchmark": "latest",
+ "grunt-cli": "latest",
+ "grunt-contrib-clean": "latest",
+ "grunt-contrib-concat": "latest",
+ "grunt-contrib-copy": "latest",
+ "grunt-contrib-jshint": "latest",
+ "grunt-contrib-uglify": "latest",
+ "grunt-contrib-watch": "latest",
+ "grunt-env": "latest",
+ "grunt-exec": "latest",
+ "grunt-jscs": "latest",
+ "grunt-karma": "latest",
+ "grunt-nuget": "latest",
+ "grunt-string-replace": "latest",
+ "karma": "latest",
+ "karma-chrome-launcher": "latest",
+ "karma-firefox-launcher": "latest",
+ "karma-qunit": "latest",
+ "karma-sauce-launcher": "latest",
+ "load-grunt-tasks": "latest",
+ "nyc": "^2.1.4",
+ "qunit": "^0.7.5",
+ "qunit-cli": "^0.1.4",
+ "spacejam": "latest",
+ "typescript": "^1.8.10",
+ "uglify-js": "latest"
+ },
+ "ender": "./ender.js",
+ "dojoBuild": "package.js",
+ "jspm": {
+ "files": [
+ "moment.js",
+ "moment.d.ts",
+ "locale"
],
- "keywords": [
- "moment",
- "date",
- "time",
- "parse",
- "format",
- "validate",
- "i18n",
- "l10n",
- "ender"
- ],
- "main": "./moment.js",
- "jsnext:main": "./src/moment.js",
- "typings": "./moment.d.ts",
- "engines": {
- "node": "*"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/moment/moment.git"
- },
- "bugs": {
- "url": "https://github.com/moment/moment/issues"
- },
- "license": "MIT",
- "devDependencies": {
- "uglify-js": "latest",
- "es6-promise": "latest",
- "grunt": "~0.4",
- "grunt-cli": "latest",
- "benchmark": "latest",
- "esperanto": "latest",
- "grunt-contrib-clean": "latest",
- "grunt-contrib-concat": "latest",
- "grunt-contrib-copy": "latest",
- "grunt-contrib-jshint": "latest",
- "grunt-contrib-uglify": "latest",
- "grunt-contrib-watch": "latest",
- "grunt-env": "latest",
- "grunt-jscs": "latest",
- "grunt-karma": "latest",
- "grunt-nuget": "latest",
- "grunt-benchmark": "latest",
- "grunt-string-replace": "latest",
- "grunt-exec": "latest",
- "load-grunt-tasks": "latest",
- "karma": "latest",
- "karma-chrome-launcher": "latest",
- "karma-firefox-launcher": "latest",
- "karma-qunit": "latest",
- "karma-sauce-launcher": "latest",
- "qunit": "^0.7.5",
- "qunit-cli": "^0.1.4",
- "spacejam": "latest",
- "typescript": "^1.8.10",
- "coveralls": "^2.11.2",
- "nyc": "^2.1.4"
- },
- "ender": "./ender.js",
- "dojoBuild": "package.js",
- "jspm": {
- "files": [
- "moment.js",
- "moment.d.ts",
- "locale"
- ],
- "map": {
- "moment": "./moment"
- },
- "buildConfig": {
- "uglify": true
- }
- },
- "scripts": {
- "test": "grunt test",
- "coverage": "nyc npm test && nyc report",
- "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
+ "map": {
+ "moment": "./moment"
},
- "spm": {
- "main": "moment.js",
- "output": [
- "locale/*.js"
- ]
+ "buildConfig": {
+ "uglify": true
}
+ },
+ "scripts": {
+ "test": "grunt test",
+ "coverage": "nyc npm test && nyc report",
+ "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
+ },
+ "spm": {
+ "main": "moment.js",
+ "output": [
+ "locale/*.js"
+ ]
+ }
}
module.exports = function (grunt) {
- var esperanto = require('esperanto');
var path = require('path');
+ var babel = require('babel-core');
var Promise = require('es6-promise').Promise;
var TMP_DIR = 'build/tmp';
}
function transpile(opts) {
- // base, entry, skip, headerFile, skipLines, target
+ // entry, skip, headerFile, skipLines, target
var umdName = opts.headerFile ? 'not_used' : opts.umdName,
headerFile = opts.headerFile ? opts.headerFile : 'templates/default.js',
header = getHeaderByFile(headerFile),
skipLines = opts.skipLines ? opts.skipLines : 5;
- return esperanto.bundle({
- base: opts.base,
- entry: opts.entry,
- skip: opts.skip || []
- }).then(function (bundle) {
- var umd = bundle.toUmd({name: umdName}),
- fixed = header + umd.code.split('\n').slice(skipLines).join('\n');
- if (opts.moveComments) {
- fixed = moveComments(fixed, opts.moveComments);
+ console.log('transpile entry' + opts.entry);
+ var promise = new Promise(function (resolve, reject) {
+ babel.transformFile(opts.entry, {
+ ignore: opts.skip || []
+ }, function (err, result) {
+ if (err) {
+ reject(err);
+ } else {
+ console.log(opts.target);
+ var fixed = header + result.code.split('\n').slice(skipLines).join('\n');
+ if (opts.moveComments) {
+ fixed = moveComments(fixed, opts.moveComments);
+ }
+ grunt.file.write(opts.target, fixed);
+ resolve();
}
- grunt.file.write(opts.target, fixed);
+ });
});
+ return promise;
}
function transpileMany(opts) {
promise = promise.then(function () {
return Promise.all(files.slice(i, i + batchSize).map(function (file) {
return transpile({
- base: opts.base,
entry: file,
headerFile: opts.headerFile,
skip: opts.skip,
if (grunt.file.exists(tmpDir)) {
return;
}
+ console.log('start writing files');
files.forEach(function (file) {
grunt.file.copy(path.join(base, file), path.join(tmpDir, file));
});
function transpileCode(opts) {
var entry = opts.entry || path.basename(opts.target);
prepareTemp(opts.base);
- grunt.file.write(path.join(TMP_DIR, entry), opts.code);
+ console.log('temp prepped');
+ var filePath = path.join(TMP_DIR, entry);
+ console.log(filePath);
+ console.log('code' + opts.code);
+ grunt.file.write(filePath, opts.code);
return transpile({
- base: TMP_DIR,
- entry: entry,
+ entry: filePath,
umdName: opts.umdName || 'not_used',
headerFile: opts.headerFile,
skipLines: opts.skipLines,
// Reset the language back to 'en', because every defineLocale
// also sets it.
'moment.locale(\'en\');'
- ]).join('\n');
+ ]).join('\n');
+ console.log(localeFiles);
return transpileCode({
base: 'src',
code: code,
- target: target,
skip: ['moment'],
headerFile: 'templates/locale-header.js',
- skipLines: 5
+ skipLines: 5,
+ target: target
});
}
importCode = files.map(function (file) {
var identifier = path.basename(file, '.js').replace('-', '_');
var fileNoExt = file.replace('.js', '');
- return 'import ' + identifier + ' from "./' + fileNoExt + '";';
+ return 'import ' + identifier + ' from "src/' + fileNoExt + '";';
}).join('\n'),
- code = 'import * as moment_export from "./moment";\n\n' +
+ code = 'import * as moment_export from "src/moment";\n\n' +
importCode + '\n\n' +
'export default moment_export;';
-
+ console.log(code);
return transpileCode({
base: 'src',
code: code,
grunt.log.ok('build/umd/locale/*.js');
}).then(function () {
return transpileMany({
- base: 'src',
- pattern: 'test/moment/*.js',
+ base: '',
+ pattern: 'src/test/moment/*.js',
headerFile: 'templates/test-header.js',
skipLines: 5,
moveComments: true,
grunt.log.ok('build/umd/test/moment/*.js');
}).then(function () {
return transpileMany({
- base: 'src',
- pattern: 'test/locale/*.js',
+ base: '',
+ pattern: 'src/test/locale/*.js',
headerFile: 'templates/test-header.js',
skipLines: 5,
moveComments: true,
grunt.log.ok('build/umd/test/locale/*.js');
}).then(function () {
return generateLocales('build/umd/min/locales.js',
- grunt.file.expand({cwd: 'src'}, 'locale/*.js'));
+ grunt.file.expand('src/locale/*.js'));
}).then(function () {
grunt.log.ok('build/umd/min/locales.js');
}).then(function () {