mod-build 3.6.9--beta.2 → 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 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.
@@ -11,6 +11,8 @@ var abandonmentJsFileName = '';
11
11
  var footerComponentJsFileName = '';
12
12
  var modFooterStylesFileName = '';
13
13
  var qsFooterStylesFileName = '';
14
+ var modFormFileName = '';
15
+ var qsFormFileName = '';
14
16
 
15
17
  function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
16
18
  if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
@@ -60,6 +62,30 @@ function replaceFooterComponentJsSrc(gulp, gulpPlugins, siteSettings, siteData)
60
62
  }
61
63
  }
62
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
+
63
89
  function replaceFooterStylesReference(gulp, gulpPlugins, siteSettings, siteData) {
64
90
  if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
65
91
  return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/' + footerComponentJsFileName)
@@ -232,6 +258,78 @@ function copyFooterComponentJs(gulp, gulpPlugins, siteSettings, siteData) {
232
258
  });
233
259
  }
234
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
+
235
333
  function copyFooterComponentStyles(gulp, gulpPlugins, siteSettings, siteData) {
236
334
  return new Promise(resolve => {
237
335
  request(`https://${siteSettings.nodeEnv}/quote/resources/shared-resources/styles/components/footer/mod-footer.min.css`)
@@ -284,6 +382,12 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
284
382
  throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
285
383
  }
286
384
 
287
- return copyModalytics(gulp, gulpPlugins, siteSettings, siteData) && copyAbandonmentJs(gulp, gulpPlugins, siteSettings, siteData) && copyFooterComponentJs(gulp, gulpPlugins, siteSettings, siteData) && copyFooterComponentStyles(gulp, gulpPlugins, siteSettings, siteData) && copyModutils(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);
288
392
  };
289
393
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.9--beta.2",
3
+ "version": "3.6.10--beta.1",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"