mod-build 3.6.94-beta.7 → 3.6.94-beta.9
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 +1 -1
- package/gulp-tasks/js-lint.js +1 -1
- package/gulp-tasks/minify.js +4 -2
- package/gulp-tasks/templates.js +8 -49
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/gulp-tasks/js-lint.js
CHANGED
package/gulp-tasks/minify.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
let uglify = require('gulp-uglify-es').default;
|
|
2
|
+
|
|
1
3
|
const babelOpts = {
|
|
2
4
|
presets: ['@babel/preset-env']
|
|
3
5
|
};
|
|
@@ -12,7 +14,7 @@ module.exports.html = function(gulp, gulpPlugins, siteSettings) {
|
|
|
12
14
|
searchPath: [siteSettings.tmpFolder, './']
|
|
13
15
|
}))
|
|
14
16
|
.pipe(gulpPlugins.if('*.js', gulpPlugins.babel(babelOpts)))
|
|
15
|
-
.pipe(gulpPlugins.if('*.js',
|
|
17
|
+
.pipe(gulpPlugins.if('*.js', uglify()))
|
|
16
18
|
.pipe(gulpPlugins.if('*.css', gulpPlugins.cleanCss(cleanCssOpts)))
|
|
17
19
|
.pipe(gulpPlugins.if('*.css', gulpPlugins.csso()))
|
|
18
20
|
.pipe(gulpPlugins.revReplace())
|
|
@@ -39,7 +41,7 @@ module.exports.js = function(gulp, gulpPlugins, siteSettings) {
|
|
|
39
41
|
return function() {
|
|
40
42
|
return gulp.src([siteSettings.srcFolder + '/**/*.js', '!' + siteSettings.srcFolder + '/data/**/*.js'])
|
|
41
43
|
.pipe(gulpPlugins.babel(babelOpts))
|
|
42
|
-
.pipe(
|
|
44
|
+
.pipe(uglify())
|
|
43
45
|
.on('error', function(err) {
|
|
44
46
|
console.log(err);
|
|
45
47
|
this.end();
|
package/gulp-tasks/templates.js
CHANGED
|
@@ -19,54 +19,13 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
19
19
|
// Checking for seasonal variations in the template.js + updating content
|
|
20
20
|
var checkSeasonalVariations = require('./check-seasonal-variations.js');
|
|
21
21
|
const activeSeason = checkSeasonalVariations();
|
|
22
|
-
const HVAC_INTEREST = 'HVACInterest';
|
|
23
|
-
const SEASON = 'warmerWeather';
|
|
24
|
-
const CENTRAL_AC = 'Central AC';
|
|
25
|
-
const CENTRAL_HEATING = 'Central Heating';
|
|
26
|
-
siteData.isWarmWeather = false; // will use this variable in site level to update the hero title/subtitle wherever required
|
|
27
22
|
if (activeSeason.length !== 0) {
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const spaces = '.*?';
|
|
35
|
-
|
|
36
|
-
const regex = new RegExp(`${heating}${spaces}${and}${spaces}${ac}`, 'gm');
|
|
37
|
-
// Find and reverse the required words in the string using regex group capture
|
|
38
|
-
const processedData = data.replaceAll(regex, '$3 $2 $1');
|
|
39
|
-
// Convert data into JSON
|
|
40
|
-
siteData = JSON.parse(processedData);
|
|
41
|
-
// Find the HVACInterest step and reverse the options array
|
|
42
|
-
if (siteData.steps && (siteData.steps.items && siteData.steps.items.length)) {
|
|
43
|
-
siteData.steps.items.forEach(function(step) {
|
|
44
|
-
const isHvacInterestStep = step && (step.stepName && step.stepName === HVAC_INTEREST) || (step.attributes && step.attributes.data && step.attributes.data['step-name'] === HVAC_INTEREST);
|
|
45
|
-
if (isHvacInterestStep) {
|
|
46
|
-
const stepFields = step.fields || step.stepContent.fields;
|
|
47
|
-
if (stepFields && stepFields.length) {
|
|
48
|
-
stepFields.forEach(function(field) {
|
|
49
|
-
const firstOption = field.options[0];
|
|
50
|
-
const lastOption = field.options[field.options.length - 1];
|
|
51
|
-
const firstOptionIsCentralHeating = (firstOption.attributes && firstOption.attributes.value === CENTRAL_HEATING) || firstOption.value === CENTRAL_HEATING;
|
|
52
|
-
const lastOptionIsCentralAC = (lastOption.attributes && lastOption.attributes.value === CENTRAL_AC) || lastOption.value === CENTRAL_AC;
|
|
53
|
-
// if the first option is central heating & last option is central ac then only swap those options
|
|
54
|
-
if (firstOptionIsCentralHeating && lastOptionIsCentralAC) {
|
|
55
|
-
field.options[0] = lastOption;
|
|
56
|
-
field.options[field.options.length - 1] = firstOption;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
field.options.some(function(option) {
|
|
60
|
-
if (option.checked) {
|
|
61
|
-
option.checked = false;
|
|
62
|
-
field.options[0].checked = true;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
23
|
+
if (siteData.seasonalVariations) {
|
|
24
|
+
activeSeason.forEach(season => {
|
|
25
|
+
if (season in siteData.seasonalVariations) {
|
|
26
|
+
siteData = merge(siteData, siteData.seasonalVariations[season]);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
70
29
|
}
|
|
71
30
|
}
|
|
72
31
|
|
|
@@ -255,7 +214,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
255
214
|
console.time('Finished fetch-default-form-config after');
|
|
256
215
|
console.log('Starting fetch-default-form-config: ');
|
|
257
216
|
await new Promise((resolve) => {
|
|
258
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/steps/defaultFormFieldConfig.json`, async function(
|
|
217
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/steps/defaultFormFieldConfig.json`, async function(err, xhr, response) {
|
|
259
218
|
if (xhr.statusCode !== 200) {
|
|
260
219
|
throw new Error(`${xhr.statusCode}: Error while fetching ${folder}/defaultFormFieldConfig.json`);
|
|
261
220
|
}
|
|
@@ -294,7 +253,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
294
253
|
console.time('Finished fetch-tcpa-from-sitegenie after');
|
|
295
254
|
console.log('Starting fetch-tcpa-from-sitegenie: ',url);
|
|
296
255
|
await new Promise(function(resolve) {
|
|
297
|
-
request(reqConfig, async function(
|
|
256
|
+
request(reqConfig, async function(err, xhr, response) {
|
|
298
257
|
if (xhr.statusCode !== 200) {
|
|
299
258
|
throw new Error(`${xhr.statusCode}: Error while fetching TCPA`);
|
|
300
259
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mod-build",
|
|
3
|
-
"version": "3.6.94-beta.
|
|
3
|
+
"version": "3.6.94-beta.9",
|
|
4
4
|
"description": "Share components for S3 sites.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"gulp-size": "^2.1.0",
|
|
51
51
|
"gulp-sourcemaps": "^2.6.0",
|
|
52
52
|
"gulp-tap": "^2.0.0",
|
|
53
|
-
"gulp-uglify": "^
|
|
53
|
+
"gulp-uglify-es": "^3.0.0",
|
|
54
54
|
"gulp-useref": "^5.0.0",
|
|
55
55
|
"husky": "^1.3.1",
|
|
56
56
|
"imagemin-mozjpeg": "^7.0.0",
|