mod-build 3.6.3--beta.10 → 3.6.3--beta.11

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.
@@ -1,6 +1,8 @@
1
1
  var request = require('request');
2
2
  var source = require('vinyl-source-stream');
3
3
  var replace = require('gulp-replace');
4
+ var hash = require('gulp-hash');
5
+ var filenames = require("gulp-filenames");
4
6
 
5
7
  function replaceModalyticsSrcInHead(gulp, gulpPlugins, siteSettings, siteData, result) {
6
8
  if (siteData.siteData && siteData.siteData.isQuotePage === true) {
@@ -16,44 +18,53 @@ function replaceModalyticsSrcInHead(gulp, gulpPlugins, siteSettings, siteData, r
16
18
 
17
19
  function copyCurrentModalytics(gulp, gulpPlugins, siteSettings, siteData) {
18
20
  return new Promise(resolve => {
19
- request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/mod-alytics-version.txt`, function(err, resp, body) {
20
- if (resp.statusCode !== 200) {
21
- throw new Error(`${resp.statusCode}: Error while fetching mod-alytics-version.txt`);
22
- }
23
- resolve(body.replace(/\s+/g, ''));
24
- })
25
-
26
- })
27
- .then((result) => {
28
- // copy over main file
29
- return new Promise(resolve => {
30
- request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/${result}`)
31
- .on('response', resp => {
32
- if (resp.statusCode !== 200) {
33
- throw new Error(`${resp.statusCode} Error while fetching ${result}`);
34
- } else {
35
- replaceModalyticsSrcInHead(gulp, gulpPlugins, siteSettings, siteData, result);
36
- }
37
- })
38
- .pipe(source(result))
39
- .pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-alytics`))
40
- resolve(result)
41
- });
21
+ request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/modalytics.min.js`)
22
+ .on('response', resp => {
23
+ if (resp.statusCode !== 200) {
24
+ throw new Error(`${resp.statusCode} Error while fetching modalytics.min.js`);
25
+ }
26
+ })
27
+ .pipe(source('modalytics.min.js'))
28
+ .pipe(hash({
29
+ hashLength: 20,
30
+ template: 'modalytics-<%= hash %>.min.js'
31
+ }))
32
+ // .pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-alytics`))
33
+ .on('finish', function(e){
34
+
35
+ console.log('finished!');
36
+ });
42
37
  })
43
- .then((result) => {
44
- // copy over source map
45
- return new Promise(resolve => {
46
- request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/${result}.map`)
47
- .on('response', resp => {
48
- if (resp.statusCode !== 200) {
49
- throw new Error(`${resp.statusCode} Error while fetching ${result}`);
50
- }
51
- })
52
- .pipe(source(`${result}.map`))
53
- .pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-alytics`))
54
- .on('finish', resolve);
55
- });
56
- });
38
+ // .then((result) => {
39
+ // // copy over main file
40
+ // return new Promise(resolve => {
41
+ // request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/${result}`)
42
+ // .on('response', resp => {
43
+ // if (resp.statusCode !== 200) {
44
+ // throw new Error(`${resp.statusCode} Error while fetching ${result}`);
45
+ // } else {
46
+ // replaceModalyticsSrcInHead(gulp, gulpPlugins, siteSettings, siteData, result);
47
+ // }
48
+ // })
49
+ // .pipe(source(result))
50
+ // .pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-alytics`))
51
+ // resolve(result)
52
+ // });
53
+ // })
54
+ // .then((result) => {
55
+ // // copy over source map
56
+ // return new Promise(resolve => {
57
+ // request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/${result}.map`)
58
+ // .on('response', resp => {
59
+ // if (resp.statusCode !== 200) {
60
+ // throw new Error(`${resp.statusCode} Error while fetching ${result}`);
61
+ // }
62
+ // })
63
+ // .pipe(source(`${result}.map`))
64
+ // .pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-alytics`))
65
+ // .on('finish', resolve);
66
+ // });
67
+ // });
57
68
  }
58
69
 
59
70
  module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.3--beta.10",
3
+ "version": "3.6.3--beta.11",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -23,6 +23,7 @@
23
23
  "gulp-csso": "^3.0.0",
24
24
  "gulp-eslint": "^5.0.0",
25
25
  "gulp-eslint-threshold": "^0.1.1",
26
+ "gulp-filenames": "^4.0.1",
26
27
  "gulp-filter": "^5.0.0",
27
28
  "gulp-handlebars-file-include": "^1.0.0",
28
29
  "gulp-hash": "^4.2.2",