mod-build 3.6.36-beta.1 → 3.6.36-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.
|
@@ -4,6 +4,8 @@ var replace = require('gulp-replace');
|
|
|
4
4
|
var hash = require('gulp-hash');
|
|
5
5
|
var tap = require('gulp-tap');
|
|
6
6
|
var path = require('path');
|
|
7
|
+
var size = require('gulp-size');
|
|
8
|
+
var buffer = require('gulp-buffer');
|
|
7
9
|
|
|
8
10
|
const fileNames = {
|
|
9
11
|
modAlyticsFileName: '',
|
|
@@ -28,7 +30,7 @@ function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
28
30
|
function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
|
|
29
31
|
const resourcePath = isQuotePageOrUseRelativePath ? '{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts' : '/resources/scripts';
|
|
30
32
|
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
31
|
-
.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
|
|
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) {
|
|
32
34
|
if (match.includes('mod-form')) {
|
|
33
35
|
if (match.includes('mod-form/form')) {
|
|
34
36
|
return `"${resourcePath}/mod-form/form/${fileNames.homeownerFormFileName}"`;
|
|
@@ -89,21 +91,23 @@ function getResource(url, config = {}, fn, fnArray) {
|
|
|
89
91
|
|
|
90
92
|
return new Promise(resolve => {
|
|
91
93
|
const file = getFileFromURL(url);
|
|
92
|
-
|
|
93
|
-
let stream = request(`${resourceURL}/${url}`)
|
|
94
|
+
request(`${resourceURL}/${url}`)
|
|
94
95
|
.on('response', resp => {
|
|
95
96
|
if (resp.statusCode !== 200) {
|
|
96
97
|
throw new Error(`${resp.statusCode} Error while fetching ${file}`);
|
|
97
98
|
}
|
|
98
99
|
})
|
|
99
100
|
.pipe(source(`${file}`))
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
101
|
+
.pipe(size())
|
|
102
|
+
.pipe(hash({
|
|
103
|
+
hashLength: 20,
|
|
104
|
+
algorithm: 'md5',
|
|
105
|
+
template: file.replace(/^([^.]*)\.(.*)$/, '$1-<%= hash %>.$2')
|
|
106
|
+
}))
|
|
107
|
+
.on('data', function(chunk) {
|
|
108
|
+
console.log(chunk);
|
|
109
|
+
})
|
|
110
|
+
.pipe(tap(function(file, t) {
|
|
107
111
|
fileNames[config.fileName] = path.basename(file.path);
|
|
108
112
|
}))
|
|
109
113
|
.pipe(config.gulp.dest(`${config.siteSettings.srcFolder}/resources/${config.dest}`))
|
|
@@ -259,7 +263,9 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
259
263
|
});
|
|
260
264
|
}
|
|
261
265
|
|
|
262
|
-
return Promise.all(getAllResources)
|
|
266
|
+
return Promise.all(getAllResources).then(function() {
|
|
267
|
+
console.log('ALL DONE!!!');
|
|
268
|
+
})
|
|
263
269
|
}());
|
|
264
270
|
};
|
|
265
271
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mod-build",
|
|
3
|
-
"version": "3.6.36-beta.
|
|
3
|
+
"version": "3.6.36-beta.3",
|
|
4
4
|
"description": "Share components for S3 sites.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"gulp": "^3.9.1",
|
|
20
20
|
"gulp-autoprefixer": "^3.1.1",
|
|
21
21
|
"gulp-babel": "^8.0.0",
|
|
22
|
+
"gulp-buffer": "0.0.2",
|
|
22
23
|
"gulp-clean-css": "^3.0.4",
|
|
23
24
|
"gulp-concat": "^2.6.1",
|
|
24
25
|
"gulp-cssmin": "^0.1.7",
|
|
@@ -64,7 +65,6 @@
|
|
|
64
65
|
"run-sequence": "^2.2.1",
|
|
65
66
|
"sass": "^1.49.9",
|
|
66
67
|
"should": "^11.2.1",
|
|
67
|
-
"through2": "^4.0.2",
|
|
68
68
|
"vinyl-source-stream": "^2.0.0",
|
|
69
69
|
"webpack-stream": "^5.2.1"
|
|
70
70
|
},
|