gregorian-calendar
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -17,2 +17,3 @@ var gulp = require('gulp'); | ||
var replace = require('gulp-replace'); | ||
var through2 = require('through2'); | ||
@@ -33,4 +34,28 @@ gulp.task('lint', function () { | ||
gulp.task('build', ['lint'], function () { | ||
gulp.task('build-locale', ['lint'], function () { | ||
var tag = 'gregorian-calendar'; | ||
gulp.src('./lib/' + tag + '/i18n/*.js') | ||
.pipe(replace(/@VERSION@/g, packageInfo.version)) | ||
.pipe(through2.obj(function (s, encoding, callback) { | ||
var name = tag + '/i18n/' + path.basename(s.path, '.js'); | ||
var contents = 'modulex.add("' + name + '",[], function(require, exports, module) {' + s.contents.toString('utf-8') + '});'; | ||
s.contents = new Buffer(contents, 'utf-8'); | ||
this.push(s); | ||
callback(); | ||
})) | ||
.pipe(rename(function (path) { | ||
path.basename += '-debug'; | ||
})) | ||
.pipe(gulp.dest(path.resolve(build, tag + '/i18n/'))) | ||
.pipe(replace(/@DEBUG@/g, '')) | ||
.pipe(uglify()) | ||
.pipe(rename(function (path) { | ||
path.basename = path.basename.replace(/-debug/, ''); | ||
})) | ||
.pipe(gulp.dest(path.resolve(build, tag + '/i18n/'))); | ||
}); | ||
gulp.task('build', ['lint', 'build-locale'], function () { | ||
var tag = 'gregorian-calendar'; | ||
var packages = {}; | ||
@@ -44,3 +69,4 @@ packages[tag] = { | ||
packages: packages | ||
} | ||
}, | ||
excludeModules: [tag + '/i18n/zh-cn'] | ||
})) | ||
@@ -47,0 +73,0 @@ .pipe(kclean({ |
module.exports = require('./lib/gregorian-calendar'); | ||
module.exports.locales = { | ||
'en-us': require('./lib/gregorian-calendar/i18n/en-us'), | ||
'zh-cn': require('./lib/gregorian-calendar/i18n/zh-cn') | ||
}; | ||
module.exports.version = require('./package.json').version; |
@@ -8,7 +8,6 @@ /** | ||
var Utils = require('./gregorian-calendar/utils'); | ||
var enUsLocale = require('./gregorian-calendar/i18n/en-us'); | ||
var zhCnLocale = require('./gregorian-calendar/i18n/zh-cn'); | ||
var requireFn = require; | ||
var defaultLocale; | ||
if (typeof process !== 'undefined') { | ||
defaultLocale = enUsLocale; | ||
defaultLocale = requireFn('./gregorian-calendar/i18n/en-us'); | ||
} else { | ||
@@ -1342,4 +1341,2 @@ defaultLocale = require('i18n!gregorian-calendar'); | ||
GregorianCalendar.version = '@VERSION@'; | ||
GregorianCalendar.enUsLocale = enUsLocale; | ||
GregorianCalendar.zhCnLocale = zhCnLocale; | ||
/* | ||
@@ -1346,0 +1343,0 @@ http://docs.oracle.com/javase/7/docs/api/java/util/GregorianCalendar.html |
{ | ||
"name": "gregorian-calendar", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": "yiminghe <yiminghe@gmail.com>", | ||
@@ -55,3 +55,4 @@ "engines": { | ||
"node-jscover-handler": "^1.0.3", | ||
"precommit-hook": "^1.0.7" | ||
"precommit-hook": "^1.0.7", | ||
"through2": "^0.6.2" | ||
}, | ||
@@ -58,0 +59,0 @@ "precommit": [ |
@@ -91,3 +91,2 @@ /** | ||
describe('WEEK_OF_MONTH', function () { | ||
@@ -94,0 +93,0 @@ it('simply works', function () { |
var GregorianCalendar = require('../../'); | ||
var date = new GregorianCalendar(); | ||
var date = new GregorianCalendar(GregorianCalendar.locales['zh-cn']); | ||
date.setTime(+new Date()); | ||
console.log(date.getDayOfWeek()); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113340
29
2698
30
5