mod-build 3.6.40-beta.4 → 3.6.40-beta.5

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.
@@ -3,7 +3,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings) {
3
3
  return function() {
4
4
  return gulp.src(siteSettings.distFolder + '/**')
5
5
  .pipe(gulpPlugins.revAll.revision({
6
- dontSearchFile: [/(resources)\/.*/, /(scripts\/components)\/.*/],
6
+ dontSearchFile: [/(resources)\/.*/],
7
7
  dontRenameFile: [/^\/favicon.ico$/g, '.html', '.txt', /modlogo([\w|\s|-])*\.(?:svg)/g, /(resources)\/.*/],
8
8
  dontUpdateReference: [/^\/favicon.ico$/g, '.html', '.txt', /modlogo([\w|\s|-])*\.(?:svg)/g, /(resources)\/.*/],
9
9
  transformFilename: function (file, hash) {
@@ -27,7 +27,8 @@ function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
27
27
  .pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/head'));
28
28
  }
29
29
  function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
30
- const resourcePath = isQuotePageOrUseRelativePath ? '{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts' : '/resources/scripts';
30
+ console.log('>> STARTING Replacing Foot Asset Scripts');
31
+ const resourcePath = isQuotePageOrUseRelativePath ? '{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts' : '/resources/scripts';
31
32
  return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
32
33
  .pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"|"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/mod-form.*?)js"|"(?:(?!"|")[\s\S])+(qs-form.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/form.*?)js"/g, function(match) {
33
34
  if (match.includes('mod-form')) {
@@ -42,9 +43,12 @@ function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
42
43
  return `"${resourcePath}/mod-utils/${fileNames.modUtilsFileName}"`;
43
44
  } else if (match.includes('footer-component')) {
44
45
  return `"${resourcePath}/footer/${fileNames.footerComponentJsFileName}"`;
45
- }
46
+ }
46
47
  }))
47
- .pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
48
+ .pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'))
49
+ .on('end', function() {
50
+ console.log('>> FINISHED Replacing Foot Asset Scripts');
51
+ });
48
52
  }
49
53
  function replaceAbandonmentJsCssSrc(gulp, gulpPlugins, siteSettings, siteData) {
50
54
  const jsResourcePath = isQuotePageOrUseRelativePath ? 'resources/scripts/abandonment/' : '/resources/scripts/abandonment/';
@@ -107,36 +111,39 @@ function getResource(url, config = {}, fn, fnArray) {
107
111
  fileNames[config.fileName] = path.basename(file.path);
108
112
  }))
109
113
  .pipe(config.gulp.dest(`${config.siteSettings.srcFolder}/resources/${config.dest}`))
110
- .on('finish', resolve);
114
+ .on('finish', function(){
115
+ console.log(fileNames[config.fileName]);
116
+ resolve();
117
+ });
111
118
  })
112
- .then(() => {
113
- if (!config.mapUrl) { return false };
114
- const file = getFileFromURL(config.mapUrl);
115
- return new Promise((resolve) => {
116
- request(`${resourceURL}/${config.mapUrl}`)
117
- .on('response', (resp) => {
118
- if (resp.statusCode !== 200) {
119
- throw new Error(`${resp.statusCode} Error while fetching ${file}`);
120
- } else {
121
- if (typeof fn === 'function') {
122
- fn.call(null, config.gulp, config.gulpSettings, config.siteSettings, config.siteData);
123
- }
119
+ .then(() => {
120
+ if (!config.mapUrl) { return false };
121
+ const file = getFileFromURL(config.mapUrl);
122
+ return new Promise((resolve) => {
123
+ request(`${resourceURL}/${config.mapUrl}`)
124
+ .on('response', (resp) => {
125
+ if (resp.statusCode !== 200) {
126
+ throw new Error(`${resp.statusCode} Error while fetching ${file}`);
127
+ } else {
128
+ if (typeof fn === 'function') {
129
+ fn.call(null, config.gulp, config.gulpSettings, config.siteSettings, config.siteData);
124
130
  }
125
- })
126
- .pipe(source(file))
127
- .pipe(config.gulp.dest(`${config.siteSettings.srcFolder}/resources/${config.dest}`))
128
- .on('finish', resolve);
129
- });
130
- })
131
- .then(() => {
132
- if (fnArray && fnArray.length) {
133
- fnArray.map(function(fn) {
134
- if (typeof fn === 'function') {
135
- fn.call(null, config.gulp, config.gulpSettings, config.siteSettings, config.siteData)
136
131
  }
137
- });
138
- }
132
+ })
133
+ .pipe(source(file))
134
+ .pipe(config.gulp.dest(`${config.siteSettings.srcFolder}/resources/${config.dest}`))
135
+ .on('finish', resolve);
139
136
  });
137
+ })
138
+ .then(() => {
139
+ if (fnArray && fnArray.length) {
140
+ fnArray.map(function(fn) {
141
+ if (typeof fn === 'function') {
142
+ fn.call(null, config.gulp, config.gulpSettings, config.siteSettings, config.siteData)
143
+ }
144
+ });
145
+ }
146
+ });
140
147
  }
141
148
  const TASKS = {
142
149
  copyModalytics: {
@@ -206,7 +213,7 @@ const TASKS = {
206
213
  dest: 'scripts/mod-form',
207
214
  mapUrl: 'mod-form/qs-form.min.js.map',
208
215
  },
209
- srcReplaceFn: replaceFootAssetScripts,
216
+ srcReplaceFn: null,
210
217
  additionalSrcReplaceFns: []
211
218
  },
212
219
  copyHomeownerForm: {
@@ -216,7 +223,7 @@ const TASKS = {
216
223
  dest: 'scripts/mod-form/form',
217
224
  mapUrl: 'mod-form/form/homeowner.min.js.map',
218
225
  },
219
- srcReplaceFn: null,
226
+ srcReplaceFn: replaceFootAssetScripts,
220
227
  additionalSrcReplaceFns: []
221
228
  },
222
229
  copyModFooterComponentStyles: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.40-beta.4",
3
+ "version": "3.6.40-beta.5",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",