mod-build 3.6.61-beta.1 → 3.6.61-beta.3
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 +6 -2
- package/gulp-tasks/grab-shared-components.js +19 -15
- package/gulp-tasks/grab-shared-scripts.js +22 -4
- package/gulp-tasks/templates.js +17 -19
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## 3.6.61
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
|
|
5
|
+
- Adding the accessible components to the `grab-shared-components` task
|
|
6
|
+
|
|
7
|
+
## 3.6.60
|
|
8
|
+
|
|
9
|
+
- Adding consoles allllll throughout the `grab-shared-scripts` task. It is still breaking down somewhere; and the first step to trying to force-fail our builds is figure out where the issue is
|
|
7
10
|
|
|
8
11
|
## 3.6.59
|
|
9
12
|
|
|
@@ -19,6 +22,7 @@
|
|
|
19
22
|
- adding `!window.Modalytics.privacyPreferencesDetected` conditional to check privacy settings to not load Heap for modernize.com
|
|
20
23
|
|
|
21
24
|
## 3.6.55
|
|
25
|
+
|
|
22
26
|
- Added conditional to check if `siteData` is empty — so our `fetchTcpaFromSitegenie()` and `getDefaultFormFieldConfig()` functions won't try to run on modify.modernize.com
|
|
23
27
|
|
|
24
28
|
## 3.6.54
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
var request = require('request');
|
|
2
2
|
var source = require('vinyl-source-stream');
|
|
3
3
|
|
|
4
|
-
function streamSharedCompsToDestination(gulp, siteSettings, fileName) {
|
|
5
|
-
return new Promise(resolve => {
|
|
6
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site
|
|
4
|
+
function streamSharedCompsToDestination(gulp, siteSettings, folder, fileName) {
|
|
5
|
+
return new Promise(resolve => {
|
|
6
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/${fileName}`)
|
|
7
7
|
.on('response', resp => {
|
|
8
8
|
if (resp.statusCode !== 200) {
|
|
9
9
|
throw new Error(`${resp.statusCode} Error while fetching ${fileName}`);
|
|
10
10
|
}
|
|
11
11
|
})
|
|
12
12
|
.pipe(source(fileName))
|
|
13
|
-
.pipe(gulp.dest(`${siteSettings.srcFolder}
|
|
13
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/${folder}/`))
|
|
14
14
|
.on('finish', resolve);
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function getListOfSharedComponents(gulp, gulpPlugins, siteSettings) {
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
function getListOfSharedComponents(gulp, gulpPlugins, siteSettings, componentFolders) {
|
|
19
|
+
return componentFolders.map(folder => {
|
|
20
|
+
return new Promise(resolve => {
|
|
21
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/all.json`, function(err, resp, body) {
|
|
22
|
+
if (resp.statusCode !== 200) {
|
|
23
|
+
throw new Error(`${resp.statusCode}: Error while fetching ${folder}/all.json`);
|
|
24
|
+
}
|
|
25
|
+
var listOfComponents = JSON.parse(body);
|
|
26
|
+
const componentPromises = listOfComponents.map(function(resource) {
|
|
27
|
+
return streamSharedCompsToDestination(gulp, siteSettings, folder, `${resource}`);
|
|
28
|
+
});
|
|
29
|
+
resolve(Promise.all(componentPromises));
|
|
27
30
|
});
|
|
28
|
-
resolve(Promise.all(componentPromises)); // eslint-disable-line no-undef
|
|
29
31
|
});
|
|
30
32
|
});
|
|
31
33
|
}
|
|
@@ -37,6 +39,8 @@ module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
|
37
39
|
throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
const componentFolders = ['shared-components', 'accessible-components']
|
|
43
|
+
|
|
44
|
+
return getListOfSharedComponents(gulp, gulpPlugins, siteSettings, componentFolders);
|
|
41
45
|
};
|
|
42
46
|
};
|
|
@@ -21,26 +21,30 @@ var pathSubdirectory = '';
|
|
|
21
21
|
|
|
22
22
|
function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
23
23
|
const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.src}}{{this.src}}{{/if}}resources/scripts/mod-alytics/` : '/resources/scripts/mod-alytics/';
|
|
24
|
+
console.log(`>> VARIABLE modAlyticsFileName = ${fileNames.modAlyticsFileName}`)
|
|
24
25
|
return gulp.src(siteSettings.srcFolder + '/shared-components/head/head.html')
|
|
25
26
|
.pipe(replace(/".*(modalytics).*"/, `"${resourcePath}${fileNames.modAlyticsFileName}"`))
|
|
26
27
|
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/head'));
|
|
27
28
|
}
|
|
28
29
|
function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
|
|
29
|
-
console.log('>> STARTING
|
|
30
|
+
console.log('>> STARTING replacing foot asset scripts');
|
|
30
31
|
const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#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\/form.*?)js"/g, function(match) {
|
|
33
34
|
if (match.includes('mod-form/form')) {
|
|
35
|
+
console.log(`>> VARIABLE homeownerFormFileName = ${fileNames.homeownerFormFileName}`);
|
|
34
36
|
return `"${resourcePath}/mod-form/form/${fileNames.homeownerFormFileName}"`;
|
|
35
37
|
} else if (match.includes('modutils') || match.includes('mod-utils')) {
|
|
38
|
+
console.log(`>> VARIABLE modUtilsFileName = ${fileNames.modUtilsFileName}`)
|
|
36
39
|
return `"${resourcePath}/mod-utils/${fileNames.modUtilsFileName}"`;
|
|
37
40
|
} else if (match.includes('footer-component')) {
|
|
41
|
+
console.log(`>> VARIABLE footerComponentJsFileName = ${fileNames.footerComponentJsFileName}`)
|
|
38
42
|
return `"${resourcePath}/footer/${fileNames.footerComponentJsFileName}"`;
|
|
39
43
|
}
|
|
40
44
|
}))
|
|
41
45
|
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'))
|
|
42
46
|
.on('end', function() {
|
|
43
|
-
console.log('>> FINISHED
|
|
47
|
+
console.log('>> FINISHED replacing foot asset scripts');
|
|
44
48
|
});
|
|
45
49
|
}
|
|
46
50
|
function replaceAbandonmentJsCssSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
@@ -52,6 +56,8 @@ function replaceAbandonmentJsCssSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
52
56
|
.pipe(gulp.dest(siteSettings.srcFolder + '/templates/abandonment'));
|
|
53
57
|
}
|
|
54
58
|
function replaceFooterStylesReference(gulp, gulpPlugins, siteSettings, siteData) {
|
|
59
|
+
console.log(`>> VARIABLE modFooterStylesFileName (main styles) = ${fileNames.modFooterStylesFileName}`)
|
|
60
|
+
console.log(`>> VARIABLE qsFooterStylesFileName (main styles) = ${fileNames.qsFooterStylesFileName}`)
|
|
55
61
|
if (siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
56
62
|
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/' + fileNames.footerComponentJsFileName)
|
|
57
63
|
.pipe(replace(/concat\((?:(?!concat\(|\))[\s\S])+(components\/footer\/mod.*?)\)/, `concat("${pathSubdirectory}resources/styles/components/footer/` + fileNames.modFooterStylesFileName + '")'))
|
|
@@ -65,6 +71,8 @@ function replaceFooterStylesReference(gulp, gulpPlugins, siteSettings, siteData)
|
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
function replaceFooterStylesReferenceInMap(gulp, gulpPlugins, siteSettings, siteData) {
|
|
74
|
+
console.log(`>> VARIABLE modFooterStylesFileName (map styles) = ${fileNames.modFooterStylesFileName}`)
|
|
75
|
+
console.log(`>> VARIABLE qsFooterStylesFileName (map styles) = ${fileNames.qsFooterStylesFileName}`)
|
|
68
76
|
if (siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
|
|
69
77
|
return gulp.src(siteSettings.srcFolder + '/resources/scripts/footer/footer-component.min.js.map')
|
|
70
78
|
.pipe(replace(/\`(?:(?!\`|\`)[\s\S])+(components\/footer\/mod.*?)\`/, '`' + pathSubdirectory + 'resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '`'))
|
|
@@ -125,7 +133,10 @@ function getResource(url, config = {}, fn, fnArray) {
|
|
|
125
133
|
})
|
|
126
134
|
.pipe(source(file))
|
|
127
135
|
.pipe(config.gulp.dest(`${config.siteSettings.srcFolder}/resources/${config.dest}`))
|
|
128
|
-
.on('finish',
|
|
136
|
+
.on('finish', function(){
|
|
137
|
+
console.log(`>> SUCCESSFULLY copied map file = ${file}`);
|
|
138
|
+
resolve();
|
|
139
|
+
});
|
|
129
140
|
});
|
|
130
141
|
})
|
|
131
142
|
.then(() => {
|
|
@@ -242,7 +253,14 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
242
253
|
});
|
|
243
254
|
}
|
|
244
255
|
|
|
245
|
-
return Promise.all(getAllResources)
|
|
256
|
+
return Promise.all(getAllResources)
|
|
257
|
+
.then(() => {
|
|
258
|
+
console.log(`>> FILENAMES object = ${JSON.stringify(fileNames)}`);
|
|
259
|
+
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
260
|
+
.on('data', function (file) {
|
|
261
|
+
console.log(`>> FOOT ASSETS HTML = ${file.contents.toString()}`);
|
|
262
|
+
});
|
|
263
|
+
})
|
|
246
264
|
}());
|
|
247
265
|
};
|
|
248
266
|
};
|
package/gulp-tasks/templates.js
CHANGED
|
@@ -186,13 +186,13 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
186
186
|
return steps;
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
-
var getDefaultFormFieldConfig = async function() {
|
|
189
|
+
var getDefaultFormFieldConfig = async function(folder) {
|
|
190
190
|
console.time('Finished fetch-default-form-config after');
|
|
191
191
|
console.log('Starting fetch-default-form-config: ');
|
|
192
192
|
await new Promise((resolve) => {
|
|
193
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/
|
|
193
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/steps/defaultFormFieldConfig.json`, async function(err, xhr, response) {
|
|
194
194
|
if (xhr.statusCode !== 200) {
|
|
195
|
-
throw new Error(`${xhr.statusCode}: Error while fetching
|
|
195
|
+
throw new Error(`${xhr.statusCode}: Error while fetching ${folder}/defaultFormFieldConfig.json`);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
const defaultConfig = await JSON.parse(response);
|
|
@@ -244,7 +244,11 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
244
244
|
return async function() {
|
|
245
245
|
if (Object.keys(siteData).length > 0) {
|
|
246
246
|
if (!templatesData.doNotUseDefaultFieldConfig && !templatesData.defaultConfigCompleted) {
|
|
247
|
-
|
|
247
|
+
if (templatesData.useAccessibleFormConfig) {
|
|
248
|
+
await getDefaultFormFieldConfig('accessible-components');
|
|
249
|
+
} else {
|
|
250
|
+
await getDefaultFormFieldConfig('shared-components');
|
|
251
|
+
}
|
|
248
252
|
}
|
|
249
253
|
|
|
250
254
|
if (!templatesData.tcpaText && templatesData.primary_trade) {
|
|
@@ -252,20 +256,14 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
252
256
|
}
|
|
253
257
|
}
|
|
254
258
|
|
|
255
|
-
return
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
.pipe(gulp.dest(siteSettings.tmpFolder))
|
|
265
|
-
.on('finish', function() {
|
|
266
|
-
resolve();
|
|
267
|
-
console.log('Templates completed')
|
|
268
|
-
});
|
|
269
|
-
});
|
|
259
|
+
return gulp.src([
|
|
260
|
+
siteSettings.srcFolder + '/' + siteSettings.templatesSubfolder + '/**/*.html',
|
|
261
|
+
'!' + siteSettings.srcFolder + '/' + siteSettings.templatesSubfolder + '/_partials/**/*.html'
|
|
262
|
+
])
|
|
263
|
+
.pipe(gulpPlugins.handlebarsFileInclude(templatesData, {
|
|
264
|
+
maxRecursion: 500,
|
|
265
|
+
handlebarsHelpers: handlebarsHelpers
|
|
266
|
+
}))
|
|
267
|
+
.pipe(gulp.dest(siteSettings.tmpFolder));
|
|
270
268
|
};
|
|
271
269
|
};
|