mod-build 4.0.19 → 4.0.20-beta.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 +9 -5
- package/gulp-tasks/templates.js +50 -9
- package/package.json +32 -32
- package/tasks/templates.js +50 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 4.0.20
|
|
2
|
+
|
|
3
|
+
- Seasonal updates enhancements
|
|
4
|
+
|
|
1
5
|
## 4.0.18
|
|
2
6
|
|
|
3
7
|
- Add `stylelint` plugin and default settings to show CSS warnings during build
|
|
@@ -65,13 +69,13 @@
|
|
|
65
69
|
## 4.0.0-beta.5
|
|
66
70
|
|
|
67
71
|
- Updated the `transformIndexHtml` hook to use the `writeBundle` hook in the ViteConfig.
|
|
68
|
-
|
|
72
|
+
- This change ensures that all assets are transformed before adding the `pathSubdirectory` to the assets and local resources.
|
|
69
73
|
|
|
70
74
|
- Updated the `grab-shared-scripts` task to run more sequentially.
|
|
71
|
-
|
|
75
|
+
- All files are now downloaded and hashed before going through the functions to replace local paths.
|
|
72
76
|
|
|
73
77
|
- Changed global resources to download to the site's `/public` folder instead of inside `/src`.
|
|
74
|
-
|
|
78
|
+
- This prevents Vite from bundling them during the build process as they are static JS files.
|
|
75
79
|
|
|
76
80
|
## 4.0.0-beta.3
|
|
77
81
|
|
|
@@ -82,8 +86,8 @@
|
|
|
82
86
|
|
|
83
87
|
## 4.0.0-beta.1
|
|
84
88
|
|
|
85
|
-
See https://quinstreet.atlassian.net/wiki/spaces/FEE/pages/8100970716/Mod-build+Vite+Version+4
|
|
89
|
+
See <https://quinstreet.atlassian.net/wiki/spaces/FEE/pages/8100970716/Mod-build+Vite+Version+4>
|
|
86
90
|
|
|
87
91
|
## 4.0.0-alpha.1
|
|
88
92
|
|
|
89
|
-
Brand new build process using Vite 5, Node 18+. Gulp 4 is used as a task runner to grab shared assets.
|
|
93
|
+
Brand new build process using Vite 5, Node 18+. Gulp 4 is used as a task runner to grab shared assets.
|
package/gulp-tasks/templates.js
CHANGED
|
@@ -19,13 +19,54 @@ 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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
+
if (activeSeason.length !== 0) {
|
|
28
|
+
if (activeSeason.includes(SEASON)) {
|
|
29
|
+
siteData.isWarmWeather = true;
|
|
30
|
+
const data = JSON.stringify(siteData, null, 4);
|
|
31
|
+
const heating = '(Heating|heating|calentadores|Calentadores|calefactores|Calefactores)';
|
|
32
|
+
const and = '(\\s&\\s|\\sand\\s|and|\\sy\\s)'; // eslint-disable-line no-useless-escape
|
|
33
|
+
const ac = '(AC|Cooling|cooling|aires.*?acondicionados|Aires.*?Acondicionados)';
|
|
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
|
+
}
|
|
29
70
|
}
|
|
30
71
|
}
|
|
31
72
|
|
|
@@ -203,7 +244,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
203
244
|
console.time('Finished fetch-default-form-config after');
|
|
204
245
|
console.log('Starting fetch-default-form-config: ');
|
|
205
246
|
await new Promise((resolve) => {
|
|
206
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/steps/defaultFormFieldConfig.json`, async function(
|
|
247
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/steps/defaultFormFieldConfig.json`, async function(_err, xhr, response) {
|
|
207
248
|
if (xhr.statusCode !== 200) {
|
|
208
249
|
throw new Error(`${xhr.statusCode}: Error while fetching ${folder}/defaultFormFieldConfig.json`);
|
|
209
250
|
}
|
|
@@ -239,7 +280,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
239
280
|
console.time('Finished fetch-tcpa-from-sitegenie after');
|
|
240
281
|
console.log('Starting fetch-tcpa-from-sitegenie: ',url);
|
|
241
282
|
await new Promise(function(resolve) {
|
|
242
|
-
request(url, async function(
|
|
283
|
+
request(url, async function(_err, xhr, response) {
|
|
243
284
|
if (xhr.statusCode !== 200) {
|
|
244
285
|
throw new Error(`${xhr.statusCode}: Error while fetching TCPA`);
|
|
245
286
|
}
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
2
|
+
"name": "mod-build",
|
|
3
|
+
"version": "4.0.20-beta.2",
|
|
4
|
+
"description": "Share components for S3 sites.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "export NODE_ENV=qa.modernize.com IS_LOCAL=true && vite",
|
|
8
|
+
"build": "export NODE_ENV=modernize.com && vite build",
|
|
9
|
+
"preview": "export NODE_ENV=modernize.com && vite build && vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@namics/stylelint-bem": "^10.0.0",
|
|
13
|
+
"@vituum/vite-plugin-handlebars": "^1.1.0",
|
|
14
|
+
"axios": "^1.6.2",
|
|
15
|
+
"eslint": "^8.57.0",
|
|
16
|
+
"glob": "^10.3.10",
|
|
17
|
+
"gulp": "^4.0.2",
|
|
18
|
+
"gulp-handlebars-file-include": "^1.0.0",
|
|
19
|
+
"gulp-hash": "^4.2.2",
|
|
20
|
+
"gulp-replace": "^1.1.4",
|
|
21
|
+
"gulp-tap": "^2.0.0",
|
|
22
|
+
"lodash.merge": "^4.6.2",
|
|
23
|
+
"lodash.mergewith": "^4.6.2",
|
|
24
|
+
"sass": "^1.69.5",
|
|
25
|
+
"stylelint": "^16.6.1",
|
|
26
|
+
"stylelint-config-standard-scss": "^13.1.0",
|
|
27
|
+
"stylelint-order": "^6.0.4",
|
|
28
|
+
"vite": "^5.0.0",
|
|
29
|
+
"vite-plugin-eslint": "^1.8.1",
|
|
30
|
+
"vite-plugin-static-copy": "^1.0.0",
|
|
31
|
+
"vite-plugin-stylelint": "^5.3.1",
|
|
32
|
+
"vituum": "^1.1.0"
|
|
33
|
+
}
|
|
34
34
|
}
|
package/tasks/templates.js
CHANGED
|
@@ -113,7 +113,7 @@ const fetchTcpaFromSitegenie = async (config, tempConfig) => {
|
|
|
113
113
|
} else {
|
|
114
114
|
console.log('Response error...using default TCPA language');
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
|
|
117
117
|
let defaultTcpa = JSON.parse(fs.readFileSync('src/resources/data/tcpa.json', 'utf8'));
|
|
118
118
|
tempConfig.tcpaText = defaultTcpa.tcpaText;
|
|
119
119
|
resolve(error);
|
|
@@ -137,13 +137,54 @@ export default async function(config) {
|
|
|
137
137
|
...{ isLocal, nodeEnv, assetsPath, buildPath },
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
const HVAC_INTEREST = 'HVACInterest';
|
|
141
|
+
const SEASON = 'warmerWeather';
|
|
142
|
+
const CENTRAL_AC = 'Central AC';
|
|
143
|
+
const CENTRAL_HEATING = 'Central Heating';
|
|
144
|
+
tempConfig.isWarmWeather = false; // will use this variable in site level to update the hero title/subtitle wherever required
|
|
145
|
+
if (activeSeason.length !== 0) {
|
|
146
|
+
if (activeSeason.includes(SEASON)) {
|
|
147
|
+
tempConfig.isWarmWeather = true;
|
|
148
|
+
const data = JSON.stringify(tempConfig, null, 4);
|
|
149
|
+
const heating = '(Heating|heating|calentadores|Calentadores|calefactores|Calefactores)';
|
|
150
|
+
const and = '(\\s&\\s|\\sand\\s|and|\\sy\\s)'; // eslint-disable-line no-useless-escape
|
|
151
|
+
const ac = '(AC|Cooling|cooling|aires.*?acondicionados|Aires.*?Acondicionados)';
|
|
152
|
+
const spaces = '.*?';
|
|
153
|
+
|
|
154
|
+
const regex = new RegExp(`${heating}${spaces}${and}${spaces}${ac}`, 'gm');
|
|
155
|
+
// Find and reverse the required words in the string using regex group capture
|
|
156
|
+
const processedData = data.replaceAll(regex, '$3 $2 $1');
|
|
157
|
+
// Convert data into JSON
|
|
158
|
+
tempConfig = JSON.parse(processedData);
|
|
159
|
+
// Find the HVACInterest step and reverse the options array
|
|
160
|
+
if (tempConfig.steps && (tempConfig.steps.items && tempConfig.steps.items.length)) {
|
|
161
|
+
tempConfig.steps.items.forEach(function(step) {
|
|
162
|
+
const isHvacInterestStep = step && (step.stepName && step.stepName === HVAC_INTEREST) || (step.attributes && step.attributes.data && step.attributes.data['step-name'] === HVAC_INTEREST);
|
|
163
|
+
if (isHvacInterestStep) {
|
|
164
|
+
const stepFields = step.fields || step.stepContent.fields;
|
|
165
|
+
if (stepFields && stepFields.length) {
|
|
166
|
+
stepFields.forEach(function(field) {
|
|
167
|
+
const firstOption = field.options[0];
|
|
168
|
+
const lastOption = field.options[field.options.length - 1];
|
|
169
|
+
const firstOptionIsCentralHeating = (firstOption.attributes && firstOption.attributes.value === CENTRAL_HEATING) || firstOption.value === CENTRAL_HEATING;
|
|
170
|
+
const lastOptionIsCentralAC = (lastOption.attributes && lastOption.attributes.value === CENTRAL_AC) || lastOption.value === CENTRAL_AC;
|
|
171
|
+
// if the first option is central heating & last option is central ac then only swap those options
|
|
172
|
+
if (firstOptionIsCentralHeating && lastOptionIsCentralAC) {
|
|
173
|
+
field.options[0] = lastOption;
|
|
174
|
+
field.options[field.options.length - 1] = firstOption;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
field.options.some(function(option) {
|
|
178
|
+
if (option.checked) {
|
|
179
|
+
option.checked = false;
|
|
180
|
+
field.options[0].checked = true;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
147
188
|
}
|
|
148
189
|
}
|
|
149
190
|
|
|
@@ -158,7 +199,7 @@ export default async function(config) {
|
|
|
158
199
|
if (!config.tcpaText && config.primary_trade && !tempConfigCreated) {
|
|
159
200
|
await fetchTcpaFromSitegenie(config, tempConfig);
|
|
160
201
|
}
|
|
161
|
-
}
|
|
202
|
+
}
|
|
162
203
|
|
|
163
204
|
if (!tempConfigCreated) {
|
|
164
205
|
if (!fs.existsSync(`${defaultSettings.srcFolder}/${defaultSettings.tmpFolder}`)) {
|