mod-build 3.6.9 → 3.6.10
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 +50 -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,6 +6,7 @@ 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 = '';
|
|
@@ -23,6 +24,18 @@ function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
function replaceModutilsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
28
|
+
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
29
|
+
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
30
|
+
.pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"/, '"resources/scripts/mod-utils/' + modUtilsFileName + '"'))
|
|
31
|
+
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
32
|
+
} else {
|
|
33
|
+
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
34
|
+
.pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"/, '"/resources/scripts/mod-utils/' + modUtilsFileName + '"'))
|
|
35
|
+
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
function replaceAbandonmentJsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
27
40
|
if (siteData.siteData && siteData.siteData.isQuotePage === true || siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
28
41
|
return gulp.src(siteSettings.srcFolder + '/templates/abandonment/*.html')
|
|
@@ -111,6 +124,42 @@ function copyModalytics(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
111
124
|
});
|
|
112
125
|
}
|
|
113
126
|
|
|
127
|
+
function copyModutils(gulp, gulpPlugins, siteSettings, siteData) {
|
|
128
|
+
return new Promise(resolve => {
|
|
129
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-utils/modutils.min.js`)
|
|
130
|
+
.on('response', resp => {
|
|
131
|
+
if (resp.statusCode !== 200) {
|
|
132
|
+
throw new Error(`${resp.statusCode} Error while fetching modutils.min.js`);
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
.pipe(source('modutils.min.js'))
|
|
136
|
+
.pipe(hash({
|
|
137
|
+
hashLength: 20,
|
|
138
|
+
template: 'modutils-<%= hash %>.min.js'
|
|
139
|
+
}))
|
|
140
|
+
.pipe(tap(function(file, t){
|
|
141
|
+
modUtilsFileName = path.basename(file.path);
|
|
142
|
+
}))
|
|
143
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-utils`))
|
|
144
|
+
.on('finish', resolve);
|
|
145
|
+
})
|
|
146
|
+
.then(() => {
|
|
147
|
+
return new Promise(resolve => {
|
|
148
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-utils/modutils.min.js.map`)
|
|
149
|
+
.on('response', resp => {
|
|
150
|
+
if (resp.statusCode !== 200) {
|
|
151
|
+
throw new Error(`${resp.statusCode} Error while fetching modutils.min.js.map`);
|
|
152
|
+
} else {
|
|
153
|
+
replaceModutilsSrc(gulp, gulpPlugins, siteSettings, siteData);
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
.pipe(source('modutils.min.js.map'))
|
|
157
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-utils`))
|
|
158
|
+
.on('finish', resolve);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
114
163
|
function copyAbandonmentJs(gulp, gulpPlugins, siteSettings, siteData) {
|
|
115
164
|
return new Promise(resolve => {
|
|
116
165
|
request(`https://${siteSettings.nodeEnv}/quote/resources/shared-resources/scripts/abandonment/abandonment.min.js`)
|
|
@@ -235,6 +284,6 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
235
284
|
throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
|
|
236
285
|
}
|
|
237
286
|
|
|
238
|
-
return copyModalytics(gulp, gulpPlugins, siteSettings, siteData) && copyAbandonmentJs(gulp, gulpPlugins, siteSettings, siteData) && copyFooterComponentJs(gulp, gulpPlugins, siteSettings, siteData) && copyFooterComponentStyles(gulp, gulpPlugins, siteSettings, siteData);
|
|
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);
|
|
239
288
|
};
|
|
240
289
|
};
|