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

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,61 +1,55 @@
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');
4
5
 
5
- function replaceModalyticsSrcInHead(gulp, gulpPlugins, siteSettings, siteData, result) {
6
+ function replaceModalyticsSrcInHead(gulp, gulpPlugins, siteSettings, siteData) {
6
7
  if (siteData.siteData && siteData.siteData.isQuotePage === true) {
7
8
  return gulp.src(siteSettings.srcFolder + '/shared-components/head/head.html')
8
- .pipe(replace(/".*(modalytics).*"/, `"resources/scripts/mod-alytics/${result}"`))
9
+ .pipe(replace(/".*(modalytics).*"/, '"resources/scripts/mod-alytics/modalytics.min.js"'))
9
10
  .pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/head'));
10
11
  } else {
11
12
  return gulp.src(siteSettings.srcFolder + '/shared-components/head/head.html')
12
- .pipe(replace(/".*(modalytics).*"/, `"/resources/scripts/mod-alytics/${result}"`))
13
+ .pipe(replace(/".*(modalytics).*"/, '"/resources/scripts/mod-alytics/modalytics.min.js"'))
13
14
  .pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/head'));
14
15
  }
15
16
  }
16
17
 
17
18
  function copyCurrentModalytics(gulp, gulpPlugins, siteSettings, siteData) {
18
19
  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
- });
20
+ request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/modalytics.min.js`)
21
+ .on('response', resp => {
22
+ if (resp.statusCode !== 200) {
23
+ throw new Error(`${resp.statusCode} Error while fetching modalytics.min.js`);
24
+ }
25
+ })
26
+ .pipe(source('modalytics.min.js'))
27
+ .pipe(hash({
28
+ hashLength: 20,
29
+ template: 'modalytics-<%= hash %>.min.js'
30
+ }))
31
+ .pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-alytics`))
32
+ resolve()
42
33
  })
43
- .then((result) => {
34
+ .then(() => {
44
35
  // copy over source map
45
36
  return new Promise(resolve => {
46
- request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/${result}.map`)
37
+ request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/modalytics.min.js.map`)
47
38
  .on('response', resp => {
48
39
  if (resp.statusCode !== 200) {
49
- throw new Error(`${resp.statusCode} Error while fetching ${result}`);
40
+ throw new Error(`${resp.statusCode} Error while fetching modalytics.min.js.map`);
50
41
  }
51
42
  })
52
- .pipe(source(`${result}.map`))
43
+ .pipe(source('modalytics.min.js.map'))
53
44
  .pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-alytics`))
54
45
  .on('finish', resolve);
55
46
  });
56
- });
47
+ })
48
+ .then(() => {
49
+ console.log('supppp');
50
+ console.log(gulp.src(`${siteSettings.srcFolder}/resources/scripts/mod-alytics/*.min.js`));
51
+ })
57
52
  }
58
-
59
53
  module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
60
54
  return function() {
61
55
  const { nodeEnv } = siteSettings;
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.12",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -25,7 +25,6 @@
25
25
  "gulp-eslint-threshold": "^0.1.1",
26
26
  "gulp-filter": "^5.0.0",
27
27
  "gulp-handlebars-file-include": "^1.0.0",
28
- "gulp-hash": "^4.2.2",
29
28
  "gulp-htmlmin": "^3.0.0",
30
29
  "gulp-if": "^2.0.2",
31
30
  "gulp-imagemin": "^3.2.0",
@@ -45,6 +44,7 @@
45
44
  "gulp-sass-variables": "^1.2.0",
46
45
  "gulp-size": "^2.1.0",
47
46
  "gulp-sourcemaps": "^2.6.0",
47
+ "gulp-tap": "^2.0.0",
48
48
  "gulp-uglify": "^2.1.2",
49
49
  "gulp-useref": "^5.0.0",
50
50
  "husky": "^1.3.1",