mod-build 3.7.22 → 3.7.23-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,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.7.23
4
+ - Added `geolocation.min.js` to the `grab-shared-scripts` task to grab & hash that file during build (and removed it from being pulled down during the `grab-cdn` task).
5
+
3
6
  ## 3.7.22
4
7
  - Added extra conditions for `addTcpaAboveCta` and `addTcpaBelowCta` helper functions to not break when required data is not passed.
5
8
 
@@ -65,13 +65,6 @@ module.exports = function(gulp, _gulpPlugins, siteSettings, siteData) {
65
65
  externalResources = { ...externalResources, ...remoteFilesForLocalDev };
66
66
  }
67
67
 
68
- // Geolocation js
69
- Object.assign(externalResources, {
70
- '/quote/resources/shared-resources/scripts/geolocation/geolocation.min.js': [
71
- 'resources/scripts/geolocation/', 'geolocation.min.js'
72
- ]
73
- });
74
-
75
68
  const totalRequests = Object.keys(externalResources).length;
76
69
  return await new Promise(async function(resolve) {
77
70
  const sequentialRequests = async function(key, index) {
@@ -7,6 +7,7 @@ var path = require('path');
7
7
  var buffer = require('gulp-buffer');
8
8
 
9
9
  const fileNames = {
10
+ geolocationFileName: '',
10
11
  modAlyticsFileName: '',
11
12
  modUtilsFileName: '',
12
13
  abandonmentJsFileName: '',
@@ -22,12 +23,20 @@ var resourceURL = '';
22
23
  var pathSubdirectory = '';
23
24
  var componentFolderPath = '';
24
25
 
25
- function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
26
- const doNotIncludeSrc = siteData.siteData && siteData.siteData.isPathSubdirectory || siteData && siteData.isPathSubdirectory;
27
- const resourcePath = isQuotePageOrUseRelativePath ? `${doNotIncludeSrc ? '' : '{{#if this.src}}{{this.src}}{{/if}}'}resources/scripts/mod-alytics/` : '/resources/scripts/mod-alytics/';
26
+ function replaceHeadScripts(gulp, gulpPlugins, siteSettings, siteData) {
27
+ const resourcePath = isQuotePageOrUseRelativePath ? '{{#if this.src}}{{this.src}}{{/if}}resources/scripts' : '/resources/scripts';
28
28
  return gulp.src(`${siteSettings.srcFolder}/${componentFolderPath}/head/head.html`)
29
- .pipe(replace(/".*(modalytics).*"/, `"${resourcePath}${fileNames.modAlyticsFileName}"`))
30
- .pipe(gulp.dest(`${siteSettings.srcFolder}/${componentFolderPath}/head`));
29
+ .pipe(replace(/"(?:(?!"|")[\s\S])+(modalytics.*?)js"|"(?:(?!"|")[\s\S])+(geolocation.*?)js"/g, function(match) {
30
+ if (match.includes('modalytics')) {
31
+ return `"${resourcePath}/mod-alytics/${fileNames.modAlyticsFileName}"`;
32
+ } else if (match.includes('geolocation')) {
33
+ return `"${resourcePath}/geolocation/${fileNames.geolocationFileName}"`;
34
+ }
35
+ }))
36
+ .pipe(gulp.dest(`${siteSettings.srcFolder}/${componentFolderPath}/head`))
37
+ .on('end', function() {
38
+ console.log('>> FINISHED replacing foot asset scripts');
39
+ });
31
40
  }
32
41
  function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
33
42
  const resourcePath = isQuotePageOrUseRelativePath ? '{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts' : '/resources/scripts';
@@ -187,6 +196,16 @@ const TASKS = {
187
196
  srcReplaceFn: replaceFootAssetScripts,
188
197
  additionalSrcReplaceFns: []
189
198
  },
199
+ copyGeolocation: {
200
+ url: 'shared-resources/scripts/geolocation/geolocation.min.js',
201
+ config: {
202
+ fileName: 'geolocationFileName',
203
+ dest: 'scripts/geolocation',
204
+ mapUrl: 'shared-resources/scripts/geolocation/geolocation.min.js.map',
205
+ },
206
+ srcReplaceFn: null,
207
+ additionalSrcReplaceFns: []
208
+ },
190
209
  copyModalytics: {
191
210
  url: 'mod-alytics/modalytics.min.js',
192
211
  config: {
@@ -194,7 +213,7 @@ const TASKS = {
194
213
  dest: 'scripts/mod-alytics',
195
214
  mapUrl: 'mod-alytics/modalytics.min.js.map',
196
215
  },
197
- srcReplaceFn: replaceModalyticsSrc,
216
+ srcReplaceFn: replaceHeadScripts,
198
217
  additionalSrcReplaceFns: []
199
218
  },
200
219
  copyAbandonmentComponentStyles: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.7.22",
3
+ "version": "3.7.23-beta.1",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",