mod-build 3.6.9 → 3.6.10--beta.1
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 +154 -1
- 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,18 @@ function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
function replaceModutilsSrc(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(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
34
|
+
} else {
|
|
35
|
+
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
36
|
+
.pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"/, '"/resources/scripts/mod-utils/' + modUtilsFileName + '"'))
|
|
37
|
+
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
function replaceAbandonmentJsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
27
42
|
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
28
43
|
return gulp.src(siteSettings.srcFolder + '/templates/abandonment/*.html')
|
|
@@ -47,6 +62,30 @@ function replaceFooterComponentJsSrc(gulp, gulpPlugins, siteSettings, siteData)
|
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
64
|
|
|
65
|
+
function replaceModFormSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
66
|
+
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
67
|
+
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
68
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"/, '"resources/scripts/mod-form/' + modFormFileName + '"'))
|
|
69
|
+
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
70
|
+
} else {
|
|
71
|
+
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
72
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"/, '"/resources/scripts/mod-form/' + modFormFileName + '"'))
|
|
73
|
+
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function replaceQsFormSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
78
|
+
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
79
|
+
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
80
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"/, '"resources/scripts/mod-form/' + qsFormFileName + '"'))
|
|
81
|
+
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
82
|
+
} else {
|
|
83
|
+
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
84
|
+
.pipe(replace(/"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"/, '"/resources/scripts/mod-form/' + qsFormFileName + '"'))
|
|
85
|
+
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
50
89
|
function replaceFooterStylesReference(gulp, gulpPlugins, siteSettings, siteData) {
|
|
51
90
|
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
52
91
|
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/' + footerComponentJsFileName)
|
|
@@ -111,6 +150,42 @@ function copyModalytics(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
111
150
|
});
|
|
112
151
|
}
|
|
113
152
|
|
|
153
|
+
function copyModutils(gulp, gulpPlugins, siteSettings, siteData) {
|
|
154
|
+
return new Promise(resolve => {
|
|
155
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-utils/modutils.min.js`)
|
|
156
|
+
.on('response', resp => {
|
|
157
|
+
if (resp.statusCode !== 200) {
|
|
158
|
+
throw new Error(`${resp.statusCode} Error while fetching modutils.min.js`);
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
.pipe(source('modutils.min.js'))
|
|
162
|
+
.pipe(hash({
|
|
163
|
+
hashLength: 20,
|
|
164
|
+
template: 'modutils-<%= hash %>.min.js'
|
|
165
|
+
}))
|
|
166
|
+
.pipe(tap(function(file, t){
|
|
167
|
+
modUtilsFileName = path.basename(file.path);
|
|
168
|
+
}))
|
|
169
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-utils`))
|
|
170
|
+
.on('finish', resolve);
|
|
171
|
+
})
|
|
172
|
+
.then(() => {
|
|
173
|
+
return new Promise(resolve => {
|
|
174
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-utils/modutils.min.js.map`)
|
|
175
|
+
.on('response', resp => {
|
|
176
|
+
if (resp.statusCode !== 200) {
|
|
177
|
+
throw new Error(`${resp.statusCode} Error while fetching modutils.min.js.map`);
|
|
178
|
+
} else {
|
|
179
|
+
replaceModutilsSrc(gulp, gulpPlugins, siteSettings, siteData);
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
.pipe(source('modutils.min.js.map'))
|
|
183
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-utils`))
|
|
184
|
+
.on('finish', resolve);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
114
189
|
function copyAbandonmentJs(gulp, gulpPlugins, siteSettings, siteData) {
|
|
115
190
|
return new Promise(resolve => {
|
|
116
191
|
request(`https://${siteSettings.nodeEnv}/quote/resources/shared-resources/scripts/abandonment/abandonment.min.js`)
|
|
@@ -183,6 +258,78 @@ function copyFooterComponentJs(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
183
258
|
});
|
|
184
259
|
}
|
|
185
260
|
|
|
261
|
+
function copyModForm(gulp, gulpPlugins, siteSettings, siteData) {
|
|
262
|
+
return new Promise(resolve => {
|
|
263
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/shared-resources/scripts/mod-form/mod-form.min.js`)
|
|
264
|
+
.on('response', resp => {
|
|
265
|
+
if (resp.statusCode !== 200) {
|
|
266
|
+
throw new Error(`${resp.statusCode} Error while fetching mod-form.min.js`);
|
|
267
|
+
}
|
|
268
|
+
})
|
|
269
|
+
.pipe(source('mod-form.min.js'))
|
|
270
|
+
.pipe(hash({
|
|
271
|
+
hashLength: 20,
|
|
272
|
+
template: 'mod-form-<%= hash %>.min.js'
|
|
273
|
+
}))
|
|
274
|
+
.pipe(tap(function(file, t){
|
|
275
|
+
modFormFileName = 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/shared-resources/scripts/mod-form/mod-form.min.js.map`)
|
|
283
|
+
.on('response', resp => {
|
|
284
|
+
if (resp.statusCode !== 200) {
|
|
285
|
+
throw new Error(`${resp.statusCode} Error while fetching mod-form.min.js.map`);
|
|
286
|
+
} else {
|
|
287
|
+
replaceModFormSrc(gulp, gulpPlugins, siteSettings, siteData);
|
|
288
|
+
}
|
|
289
|
+
})
|
|
290
|
+
.pipe(source('mod-form.min.js.map'))
|
|
291
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-form`))
|
|
292
|
+
.on('finish', resolve);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function copyQsForm(gulp, gulpPlugins, siteSettings, siteData) {
|
|
298
|
+
return new Promise(resolve => {
|
|
299
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/shared-resources/scripts/mod-form/qs-form.min.js`)
|
|
300
|
+
.on('response', resp => {
|
|
301
|
+
if (resp.statusCode !== 200) {
|
|
302
|
+
throw new Error(`${resp.statusCode} Error while fetching qs-form.min.js`);
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
.pipe(source('qs-form.min.js'))
|
|
306
|
+
.pipe(hash({
|
|
307
|
+
hashLength: 20,
|
|
308
|
+
template: 'qs-form-<%= hash %>.min.js'
|
|
309
|
+
}))
|
|
310
|
+
.pipe(tap(function(file, t){
|
|
311
|
+
qsFormFileName = path.basename(file.path);
|
|
312
|
+
}))
|
|
313
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-form`))
|
|
314
|
+
.on('finish', resolve);
|
|
315
|
+
})
|
|
316
|
+
.then(() => {
|
|
317
|
+
return new Promise(resolve => {
|
|
318
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/shared-resources/scripts/mod-form/qs-form.min.js.map`)
|
|
319
|
+
.on('response', resp => {
|
|
320
|
+
if (resp.statusCode !== 200) {
|
|
321
|
+
throw new Error(`${resp.statusCode} Error while fetching qs-form.min.js.map`);
|
|
322
|
+
} else {
|
|
323
|
+
replaceQsFormSrc(gulp, gulpPlugins, siteSettings, siteData);
|
|
324
|
+
}
|
|
325
|
+
})
|
|
326
|
+
.pipe(source('qs-form.min.js.map'))
|
|
327
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-form`))
|
|
328
|
+
.on('finish', resolve);
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
186
333
|
function copyFooterComponentStyles(gulp, gulpPlugins, siteSettings, siteData) {
|
|
187
334
|
return new Promise(resolve => {
|
|
188
335
|
request(`https://${siteSettings.nodeEnv}/quote/resources/shared-resources/styles/components/footer/mod-footer.min.css`)
|
|
@@ -235,6 +382,12 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
235
382
|
throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
|
|
236
383
|
}
|
|
237
384
|
|
|
238
|
-
return copyModalytics(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
385
|
+
return copyModalytics(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
386
|
+
copyAbandonmentJs(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
387
|
+
copyFooterComponentJs(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
388
|
+
copyFooterComponentStyles(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
389
|
+
copyModutils(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
390
|
+
copyModForm(gulp, gulpPlugins, siteSettings, siteData) &&
|
|
391
|
+
copyQsForm(gulp, gulpPlugins, siteSettings, siteData);
|
|
239
392
|
};
|
|
240
393
|
};
|