Permalink
Browse files

added a package.json file, i18n build

all cultures now produce a date-[culutre].js file
only the en-US culture produces a minified file though, due to issues with
uglify.

also only en-US runs the gulp tests
  • Loading branch information...
Peter Elliott
Peter Elliott committed Jun 12, 2015
1 parent 4db5781 commit e4807694bca3cd976bee538a44a34bbce2feb4ae
Showing with 44 additions and 95 deletions.
  1. +0 −26 LICENSE.txt
  2. +0 −64 TODO.txt
  3. +28 −5 gulpfile.js
  4. +16 −0 package.json
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
View
@@ -1,12 +1,16 @@
var fs = require('fs');
var gulp = require('gulp');
var jasmine = require('gulp-jasmine');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var runSequence = require('run-sequence');
var merge = require('merge-stream');
var corefiles = ['src/globalization/en-US.js','src/core.js','src/sugarpak.js','src/parser.js','src/time.js']
var gloablizationDir = 'src/globalization/';
var basefiles = ['src/core.js','src/sugarpak.js','src/parser.js','src/time.js'];
var corefiles = [gloablizationDir+'en-US.js'].concat(basefiles);
var globalizationFiles = fs.readdirSync(gloablizationDir);
var coretests = [
'test/core/index.js',
@@ -39,20 +43,39 @@ gulp.task('extendedtest', function() {
.pipe(jasmine());
});
gulp.task('build', ['coretest'], function() {
gulp.task('buildCore', ['coretest'], function() {
return gulp.src(corefiles)
.pipe(sourcemaps.init())
.pipe(concat('date.js'))
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist'))
.pipe(gulp.dest('./build'))
});
gulp.task('buildGlobal', ['coretest'], function() {
var tasks = globalizationFiles.map(function(culture){
var files = [gloablizationDir + culture].concat(basefiles);
return pipeline(files, culture);
});
return merge(tasks);
});
function pipeline(files, culture) {
return gulp.src(files)
// .pipe(sourcemaps.init())
.pipe(concat(culture ? 'date-'+culture : 'date.js'))
// .pipe(uglify())
// .pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./build'))
}
gulp.task('test', function() {
runSequence(['coretest'],['extendedtest']);
});
gulp.task('default', ['build']);
gulp.task('default', ['buildCore','buildGlobal']);
View
@@ -0,0 +1,16 @@
{
"name": "Datejs",
"version": "1.0.0",
"description": "A Date library for browsers",
"devDependencies": {
"gulp": "^3.9.0",
"gulp-jasmine": "^2.0.1",
"gulp-concat": "^2.5.2",
"gulp-sourcemaps": "^1.5.2",
"gulp-uglify": "^1.2.0",
"run-sequence": "^1.1.0",
"merge-stream": "^1.0.0"
},
"author": "",
"license": "Apache 2.0"
}

0 comments on commit e480769

Please sign in to comment.