mod-build 3.6.1 → 3.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.6.2
|
|
4
|
+
|
|
5
|
+
- Adding `check-seasonal-variations` to grab seasons json; loop through the siteData for `seasonalVariations: {}`; find any active seasons; merge the json objects and adjust json content accordingly;
|
|
6
|
+
|
|
3
7
|
## 3.5.7
|
|
4
8
|
|
|
5
9
|
- Making `maxRecursion` for our file include plugin in template.js a lot higher
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function getActiveSeasons() {
|
|
2
|
+
var seasons = require(`../src/data/seasons.js`);
|
|
3
|
+
const today = new Date();
|
|
4
|
+
const year = today.getFullYear();
|
|
5
|
+
let activeSeason = [];
|
|
6
|
+
|
|
7
|
+
for (const key in seasons) {
|
|
8
|
+
var seasonName = key;
|
|
9
|
+
var dateRanges = seasons[key];
|
|
10
|
+
var startDate = new Date(`${Object.values(dateRanges)[0]}-${year}`);
|
|
11
|
+
var endDate = new Date(`${Object.values(dateRanges)[1]}-${year}`);
|
|
12
|
+
|
|
13
|
+
if (startDate < today && today < endDate) {
|
|
14
|
+
activeSeason.push(seasonName)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return activeSeason;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = getActiveSeasons;
|
package/gulp-tasks/templates.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
var merge = require('lodash.merge');
|
|
2
|
+
|
|
1
3
|
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
2
4
|
// Merge site's data with shared data
|
|
3
5
|
/* eslint brace-style: 0 */
|
|
@@ -12,6 +14,19 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
12
14
|
var qsFooterData = require('../src/data/components/qs-footer.js');
|
|
13
15
|
var quoteFooterData = require('../src/data/components/quote-footer.js');
|
|
14
16
|
|
|
17
|
+
// Checking for seasonal variations in the template.js + updating content
|
|
18
|
+
var checkSeasonalVariations = require('./check-seasonal-variations.js');
|
|
19
|
+
const activeSeason = checkSeasonalVariations();
|
|
20
|
+
if (activeSeason.length !== 0){
|
|
21
|
+
if (siteData.seasonalVariations) {
|
|
22
|
+
activeSeason.forEach(season => {
|
|
23
|
+
if (season in siteData.seasonalVariations) {
|
|
24
|
+
siteData = merge(siteData, siteData.seasonalVariations[season]);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
15
30
|
var templatesData = Object.assign(commonData(), qsFooterData(siteData), quoteFooterData(siteData), siteData, { isLocal, nodeEnv, assetsPath, buildPath });
|
|
16
31
|
|
|
17
32
|
// This is helper function to evaluate JS expressions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mod-build",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.2",
|
|
4
4
|
"description": "Share components for S3 sites.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"imagemin-webp": "^5.1.0",
|
|
52
52
|
"jquery": "^3.2.1",
|
|
53
53
|
"lodash": "^4.17.15",
|
|
54
|
+
"lodash.merge": "^4.6.2",
|
|
54
55
|
"nouislider": "^10.1.0",
|
|
55
56
|
"request": "^2.88.0",
|
|
56
57
|
"run-sequence": "^2.2.1",
|