Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Fix file imports to enable Webpack support #46

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ language: node_js
sudo: false

node_js:
- 12
- 10
- 8
- 6
- 4

install:
- npm install
Expand Down
51 changes: 40 additions & 11 deletions build/moment-holiday-pkg.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/moment-holiday-pkg.min.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions build/moment-holiday-us.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/moment-holiday-us.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/moment-holiday.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/moment-holiday.min.js.map

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ function generate(locales, set, minify, filename) {

if (set) {
if (set.constructor !== Array) { set = [set]; }
append = "\n//! Set default locales\n(function() {\n var moment = (typeof require !== 'undefined' && require !== null) && !require.amd ? require('moment') : this.moment;";
append = "\n//! Set default locales\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('moment')) :\n typeof define === 'function' && define.amd ? define(['moment'], factory) :\n (global = global || self, factory(global.moment));\n}(this, (function (moment) {\n moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;";
set.forEach(function(l){ append += '\n moment.modifyHolidays.add("' + l + '");'; });
append += '\n}).call(this);';
append += '\n return moment;\n})));';
}

return gulp.src(files)
Expand All @@ -38,11 +38,12 @@ function generate(locales, set, minify, filename) {
.pipe(gulp.dest('build/'));
}

gulp.task('default', function() {
gulp.task('default', function(done) {
generate(argv.locale, argv.set, argv.min, argv.name);
done();
});

gulp.task('build', function() {
gulp.task('build', function(done) {
var locales = [];
var localePath = require('path').join(__dirname, 'locale');
require('fs').readdirSync(localePath).forEach(function(file){
Expand All @@ -51,6 +52,11 @@ gulp.task('build', function() {
});

generate(null, null, true, 'moment-holiday.js');
generate(null, null, false, 'moment-holiday.js');
generate(['Argentina', 'Easter'], 'Argentina', true, 'moment-holiday-ar.js');
generate(['Argentina', 'Easter'], 'Argentina', false, 'moment-holiday-ar.js');
generate(['United States', 'Easter'], 'United States', true, 'moment-holiday-us.js');
generate(locales, 'United States', true, 'moment-holiday-pkg.js');

done();
});
14 changes: 10 additions & 4 deletions locale/argentina.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
//! locale : Argentina
//! author : NahuelOvejero : https://github.com/NahuelOvejero

(function() {
var moment = (typeof require !== 'undefined' && require !== null) && !require.amd ? require('moment') : this.moment;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('moment')) :
typeof define === 'function' && define.amd ? define(['moment'], factory) :
(global = global || self, factory(global.moment)); // jshint ignore:line
}(this, (function (moment) {

moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;

moment.holidays.argentina = {
"Año Nuevo": {
Expand Down Expand Up @@ -71,5 +76,6 @@
}
};

if ((typeof module !== 'undefined' && module !== null ? module.exports : void 0) != null) { module.exports = moment; }
}).call(this);
return moment;

})));
14 changes: 10 additions & 4 deletions locale/canada.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
SK : Saskatchewan
*/

(function() {
var moment = (typeof require !== 'undefined' && require !== null) && !require.amd ? require('moment') : this.moment;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('moment')) :
typeof define === 'function' && define.amd ? define(['moment'], factory) :
(global = global || self, factory(global.moment)); // jshint ignore:line
}(this, (function (moment) {

moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;

moment.holidays.canada = {
"New Year's Day": {
Expand Down Expand Up @@ -109,5 +114,6 @@
}
};

if ((typeof module !== 'undefined' && module !== null ? module.exports : void 0) != null) { module.exports = moment; }
}).call(this);
return moment;

})));
19 changes: 13 additions & 6 deletions locale/colombia.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
(function() {
var moment = (typeof require !== 'undefined' && require !== null) && !require.amd ? require('moment') : this.moment;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('moment')) :
typeof define === 'function' && define.amd ? define(['moment'], factory) :
(global = global || self, factory(global.moment)); // jshint ignore:line
}(this, (function (moment) {

moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;

moment.holidays.colombia = {
"Día de los Reyes Magos": {
Expand Down Expand Up @@ -47,7 +52,7 @@
"Todos los Santos ": {
date: '11/6',
keywords: ['festividad', 'cristiana']
},
},
"Independencia de Cartagena":{
date: '11/13'
},
Expand All @@ -58,7 +63,9 @@
"Día de Navidad ": {
date: '12/8',
keywords: ['christmas', 'navidad', 'merryxmas']
}
}
};
if ((typeof module !== 'undefined' && module !== null ? module.exports : void 0) != null) { module.exports = moment; }
}).call(this);

return moment;

})));
14 changes: 10 additions & 4 deletions locale/croatia.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
//! locale : Croatia / Hrvatska
//! author : diomed : https://github.com/diomed

(function() {
var moment = (typeof require !== 'undefined' && require !== null) && !require.amd ? require('moment') : this.moment;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('moment')) :
typeof define === 'function' && define.amd ? define(['moment'], factory) :
(global = global || self, factory(global.moment)); // jshint ignore:line
}(this, (function (moment) {

moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;

moment.holidays.croatia = {
"Nova Godina": {
Expand Down Expand Up @@ -63,5 +68,6 @@
}
};

if ((typeof module !== 'undefined' && module !== null ? module.exports : void 0) != null) { module.exports = moment; }
}).call(this);
return moment;

})));
Loading