mod-build 3.6.9 → 3.6.10--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 +4 -0
- package/gulp-tasks/grab-shared-scripts.js +132 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.6.10
|
|
4
|
+
|
|
5
|
+
- Adding `modutils` JS to the `grab-shared-scripts` gulp task. It will copy this version into the site's `resources/scripts/mod-utils` folder & then update the src in the `foot-assets` shared component.
|
|
6
|
+
|
|
3
7
|
## 3.6.9
|
|
4
8
|
|
|
5
9
|
- Adding `footer-component` JS + CSS & `abandonment` JS + CSS to the `grab-shared-scripts` gulp task. It will copy local versions into the site's `resources/` folder & then update the src or href as needed. `cache-bust` will also ignore the entire resources folder.
|
|
@@ -6,10 +6,13 @@ var tap = require('gulp-tap');
|
|
|
6
6
|
var path = require('path');
|
|
7
7
|
|
|
8
8
|
var modAlyticsFileName = '';
|
|
9
|
+
var modUtilsFileName = '';
|
|
9
10
|
var abandonmentJsFileName = '';
|
|
10
11
|
var footerComponentJsFileName = '';
|
|
11
12
|
var modFooterStylesFileName = '';
|
|
12
13
|
var qsFooterStylesFileName = '';
|
|
14
|
+
var modFormFileName = '';
|
|
15
|
+
var qsFormFileName = '';
|
|
13
16
|
|
|
14
17
|
function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
15
18
|
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
@@ -23,6 +26,24 @@ function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
|
|
30
|
+
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
31
|
+
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
32
|
+
.pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"/, '"resources/scripts/mod-utils/' + modUtilsFileName + '"'))
|
|
33
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"/, '"resources/scripts/footer/' + footerComponentJsFileName + '"'))
|
|
34
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(mod-form.*?)js"/, '"resources/scripts/mod-form/' + modFormFileName + '"'))
|
|
35
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(qs-form.*?)js"/, '"resources/scripts/mod-form/' + qsFormFileName + '"'))
|
|
36
|
+
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
37
|
+
} else {
|
|
38
|
+
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
39
|
+
.pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"/, '"/resources/scripts/mod-utils/' + modUtilsFileName + '"'))
|
|
40
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"/, '"/resources/scripts/footer/' + footerComponentJsFileName + '"'))
|
|
41
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(mod-form.*?)js"/, '"/resources/scripts/mod-form/' + modFormFileName + '"'))
|
|
42
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(qs-form.*?)js"/, '"/resources/scripts/mod-form/' + qsFormFileName + '"'))
|
|
43
|
+
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
26
47
|
function replaceAbandonmentJsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
27
48
|
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
28
49
|
return gulp.src(siteSettings.srcFolder + '/templates/abandonment/*.html')
|
|
@@ -35,18 +56,6 @@ function replaceAbandonmentJsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
35
56
|
}
|
|
36
57
|
}
|
|
37
58
|
|
|
38
|
-
function replaceFooterComponentJsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
39
|
-
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
40
|
-
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
41
|
-
.pipe(replace(/"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"/, '"resources/scripts/footer/' + footerComponentJsFileName + '"'))
|
|
42
|
-
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
43
|
-
} else {
|
|
44
|
-
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
45
|
-
.pipe(replace(/"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"/, '"/resources/scripts/footer/' + footerComponentJsFileName + '"'))
|
|
46
|
-
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
59
|
function replaceFooterStylesReference(gulp, gulpPlugins, siteSettings, siteData) {
|
|
51
60
|
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
52
61
|
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/' + footerComponentJsFileName)
|
|
@@ -111,6 +120,40 @@ function copyModalytics(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
111
120
|
});
|
|
112
121
|
}
|
|
113
122
|
|
|
123
|
+
function copyModutils(gulp, gulpPlugins, siteSettings, siteData) {
|
|
124
|
+
return new Promise(resolve => {
|
|
125
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-utils/modutils.min.js`)
|
|
126
|
+
.on('response', resp => {
|
|
127
|
+
if (resp.statusCode !== 200) {
|
|
128
|
+
throw new Error(`${resp.statusCode} Error while fetching modutils.min.js`);
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
.pipe(source('modutils.min.js'))
|
|
132
|
+
.pipe(hash({
|
|
133
|
+
hashLength: 20,
|
|
134
|
+
template: 'modutils-<%= hash %>.min.js'
|
|
135
|
+
}))
|
|
136
|
+
.pipe(tap(function(file, t){
|
|
137
|
+
modUtilsFileName = path.basename(file.path);
|
|
138
|
+
}))
|
|
139
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-utils`))
|
|
140
|
+
.on('finish', resolve);
|
|
141
|
+
})
|
|
142
|
+
.then(() => {
|
|
143
|
+
return new Promise(resolve => {
|
|
144
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-utils/modutils.min.js.map`)
|
|
145
|
+
.on('response', resp => {
|
|
146
|
+
if (resp.statusCode !== 200) {
|
|
147
|
+
throw new Error(`${resp.statusCode} Error while fetching modutils.min.js.map`);
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
.pipe(source('modutils.min.js.map'))
|
|
151
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-utils`))
|
|
152
|
+
.on('finish', resolve);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
114
157
|
function copyAbandonmentJs(gulp, gulpPlugins, siteSettings, siteData) {
|
|
115
158
|
return new Promise(resolve => {
|
|
116
159
|
request(`https://${siteSettings.nodeEnv}/quote/resources/shared-resources/scripts/abandonment/abandonment.min.js`)
|
|
@@ -172,8 +215,6 @@ function copyFooterComponentJs(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
172
215
|
.on('response', resp => {
|
|
173
216
|
if (resp.statusCode !== 200) {
|
|
174
217
|
throw new Error(`${resp.statusCode} Error while fetching footer-component.min.js.map`);
|
|
175
|
-
} else {
|
|
176
|
-
replaceFooterComponentJsSrc(gulp, gulpPlugins, siteSettings, siteData);
|
|
177
218
|
}
|
|
178
219
|
})
|
|
179
220
|
.pipe(source('footer-component.min.js.map'))
|
|
@@ -183,6 +224,76 @@ function copyFooterComponentJs(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
183
224
|
});
|
|
184
225
|
}
|
|
185
226
|
|
|
227
|
+
function copyModForm(gulp, gulpPlugins, siteSettings, siteData) {
|
|
228
|
+
return new Promise(resolve => {
|
|
229
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-form/mod-form.min.js`)
|
|
230
|
+
.on('response', resp => {
|
|
231
|
+
if (resp.statusCode !== 200) {
|
|
232
|
+
throw new Error(`${resp.statusCode} Error while fetching mod-form.min.js`);
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
.pipe(source('mod-form.min.js'))
|
|
236
|
+
.pipe(hash({
|
|
237
|
+
hashLength: 20,
|
|
238
|
+
template: 'mod-form-<%= hash %>.min.js'
|
|
239
|
+
}))
|
|
240
|
+
.pipe(tap(function(file, t){
|
|
241
|
+
modFormFileName = path.basename(file.path);
|
|
242
|
+
}))
|
|
243
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-form`))
|
|
244
|
+
.on('finish', resolve);
|
|
245
|
+
})
|
|
246
|
+
.then(() => {
|
|
247
|
+
return new Promise(resolve => {
|
|
248
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-form/mod-form.min.js.map`)
|
|
249
|
+
.on('response', resp => {
|
|
250
|
+
if (resp.statusCode !== 200) {
|
|
251
|
+
throw new Error(`${resp.statusCode} Error while fetching mod-form.min.js.map`);
|
|
252
|
+
}
|
|
253
|
+
})
|
|
254
|
+
.pipe(source('mod-form.min.js.map'))
|
|
255
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-form`))
|
|
256
|
+
.on('finish', resolve);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function copyQsForm(gulp, gulpPlugins, siteSettings, siteData) {
|
|
262
|
+
return new Promise(resolve => {
|
|
263
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-form/qs-form.min.js`)
|
|
264
|
+
.on('response', resp => {
|
|
265
|
+
if (resp.statusCode !== 200) {
|
|
266
|
+
throw new Error(`${resp.statusCode} Error while fetching qs-form.min.js`);
|
|
267
|
+
}
|
|
268
|
+
})
|
|
269
|
+
.pipe(source('qs-form.min.js'))
|
|
270
|
+
.pipe(hash({
|
|
271
|
+
hashLength: 20,
|
|
272
|
+
template: 'qs-form-<%= hash %>.min.js'
|
|
273
|
+
}))
|
|
274
|
+
.pipe(tap(function(file, t){
|
|
275
|
+
qsFormFileName = path.basename(file.path);
|
|
276
|
+
}))
|
|
277
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-form`))
|
|
278
|
+
.on('finish', resolve);
|
|
279
|
+
})
|
|
280
|
+
.then(() => {
|
|
281
|
+
return new Promise(resolve => {
|
|
282
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-form/qs-form.min.js.map`)
|
|
283
|
+
.on('response', resp => {
|
|
284
|
+
if (resp.statusCode !== 200) {
|
|
285
|
+
throw new Error(`${resp.statusCode} Error while fetching qs-form.min.js.map`);
|
|
286
|
+
} else {
|
|
287
|
+
replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData);
|
|
288
|
+
}
|
|
289
|
+
})
|
|
290
|
+
.pipe(source('qs-form.min.js.map'))
|
|
291
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-form`))
|
|
292
|
+
.on('finish', resolve);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
186
297
|
function copyFooterComponentStyles(gulp, gulpPlugins, siteSettings, siteData) {
|
|
187
298
|
return new Promise(resolve => {
|
|
188
299
|
request(`https://${siteSettings.nodeEnv}/quote/resources/shared-resources/styles/components/footer/mod-footer.min.css`)
|
|
@@ -235,6 +346,12 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
235
346
|
throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
|
|
236
347
|
}
|
|
237
348
|
|
|
238
|
-
return copyModalytics(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
349
|
+
return copyModalytics(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
350
|
+
copyAbandonmentJs(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
351
|
+
copyFooterComponentJs(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
352
|
+
copyFooterComponentStyles(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
353
|
+
copyModutils(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
354
|
+
copyModForm(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
355
|
+
copyQsForm(gulp, gulpPlugins, siteSettings, siteData);
|
|
239
356
|
};
|
|
240
357
|
};
|