mod-build 3.6.3--beta.2 → 3.6.3--beta.5

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.
@@ -5,15 +5,15 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
5
5
  var sequenceOpts;
6
6
 
7
7
  if (siteData.useTypescript) {
8
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'templates', 'styles', 'compile-prod', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'build-stat'];
8
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'templates', 'styles', 'compile-prod', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'build-stat'];
9
9
  } else if (siteData.isWhiteLabel) {
10
10
  if (siteData.isQSPage) {
11
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'templates', 'styles', 'grab-theme-json', 'combine-files', 'grab-images', 'copy-json', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'copy-files-to-build-path', 'cache-bust', 'grab-tooltips-json', 'build-stat'];
11
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'templates', 'styles', 'grab-theme-json', 'combine-files', 'grab-images', 'copy-json', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'copy-files-to-build-path', 'cache-bust', 'grab-tooltips-json', 'build-stat'];
12
12
  } else {
13
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'templates', 'styles', 'combine-files', 'grab-images', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'grab-tooltips-json', 'build-stat'];
13
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'templates', 'styles', 'combine-files', 'grab-images', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'grab-tooltips-json', 'build-stat'];
14
14
  }
15
15
  } else {
16
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'templates', 'styles', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'build-stat'];
16
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'templates', 'styles', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'brand', 'cache-bust', 'build-stat'];
17
17
  }
18
18
 
19
19
  runSequence(...sequenceOpts, function() {
@@ -1 +1,40 @@
1
- import fetch from "node-fetch";
1
+ var request = require('request');
2
+ var source = require('vinyl-source-stream');
3
+
4
+ function copyCurrentModalytics(gulp, gulpPlugins, siteSettings) {
5
+ return new Promise(resolve => {
6
+ request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/mod-alytics-version.txt`, function(err, resp, body) {
7
+ if (resp.statusCode !== 200) {
8
+ throw new Error(`${resp.statusCode}: Error while fetching mod-alytics-version.txt`);
9
+ }
10
+ var modalyticsVersion = body.split("/");
11
+ var file = modalyticsVersion[modalyticsVersion.length - 1];
12
+ resolve(file.replace(/\s+/g, ''));
13
+ })
14
+
15
+ })
16
+ .then((result) => {
17
+ return new Promise(resolve => {
18
+ request(`https://${siteSettings.nodeEnv}/quote/resources/mod-alytics/${result}`)
19
+ .on('response', resp => {
20
+ if (resp.statusCode !== 200) {
21
+ throw new Error(`${resp.statusCode} Error while fetching ${result}`);
22
+ }
23
+ })
24
+ .pipe(source(result))
25
+ .pipe(gulp.dest(`${siteSettings.srcFolder}/resources/scripts/mod-alytics`))
26
+ .on('finish', resolve);
27
+ });
28
+ });
29
+ }
30
+
31
+ module.exports = function(gulp, gulpPlugins, siteSettings) {
32
+ return function() {
33
+ const { nodeEnv } = siteSettings;
34
+ if (!nodeEnv) {
35
+ throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
36
+ }
37
+
38
+ return copyCurrentModalytics(gulp, gulpPlugins, siteSettings);
39
+ };
40
+ };
@@ -4,11 +4,11 @@ module.exports.src = function(gulp, gulpPlugins, siteSettings, siteData) {
4
4
  var runSequence = require('run-sequence');
5
5
  var sequenceOpts;
6
6
  if (siteData.useTypescript) {
7
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'templates', 'styles', 'compile', 'grab-tooltips-json', 'combine-files', 'grab-images', 'js-lint'];
7
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'templates', 'styles', 'compile', 'grab-tooltips-json', 'combine-files', 'grab-images', 'js-lint'];
8
8
  } else if (siteData.isQSPage) {
9
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'templates', 'styles', 'grab-theme-json', 'grab-tooltips-json', 'combine-files', 'grab-images', 'js-lint'];
9
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'templates', 'styles', 'grab-theme-json', 'grab-tooltips-json', 'combine-files', 'grab-images', 'js-lint'];
10
10
  } else {
11
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'templates', 'styles', 'grab-tooltips-json', 'combine-files', 'grab-images', 'js-lint'];
11
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'templates', 'styles', 'grab-tooltips-json', 'combine-files', 'grab-images', 'js-lint'];
12
12
  }
13
13
  runSequence(...sequenceOpts, () => {
14
14
  // Run a BrowserSync server
@@ -42,7 +42,7 @@ module.exports = function() {
42
42
  }
43
43
  },
44
44
 
45
- // Grab component scss files from CDN so they can be swapped into build
45
+ // Grab component files from CDN so they can be swapped into build
46
46
  'grab-shared-components': {
47
47
  subtasks: [],
48
48
  func: function(opts) {
@@ -56,6 +56,20 @@ module.exports = function() {
56
56
  }
57
57
  },
58
58
 
59
+ // Grab shared scripts from CDN so they can swapped into build
60
+ 'grab-shared-scripts': {
61
+ subtasks: [],
62
+ func: function(opts) {
63
+ if ('undefined' === typeof opts.gulpTasksFolderPath) {
64
+ opts.gulpTasksFolderPath = '.';
65
+ }
66
+
67
+ if (opts.siteData.useCDN) {
68
+ return require(opts.gulpTasksFolderPath + '/grab-shared-scripts')(opts.gulp, opts.gulpPlugins, opts.gulpSettings, opts.siteData);
69
+ }
70
+ }
71
+ },
72
+
59
73
  // Link scss files
60
74
  'sass-lint': {
61
75
  subtasks: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.3--beta.2",
3
+ "version": "3.6.3--beta.5",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -52,7 +52,7 @@
52
52
  "jquery": "^3.2.1",
53
53
  "lodash": "^4.17.15",
54
54
  "lodash.merge": "^4.6.2",
55
- "node-fetch": "^3.2.10",
55
+ "node-fetch": "^2.6.7",
56
56
  "nouislider": "^10.1.0",
57
57
  "path": "^0.12.7",
58
58
  "request": "^2.88.0",