mod-build 3.6.3--beta.4 → 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.
- package/gulp-tasks/build.js +4 -4
- package/gulp-tasks/grab-shared-scripts.js +36 -3
- package/gulp-tasks/tasks.js +15 -1
- package/package.json +1 -1
package/gulp-tasks/build.js
CHANGED
|
@@ -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,7 +1,40 @@
|
|
|
1
|
-
|
|
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
|
+
}
|
|
2
30
|
|
|
3
31
|
module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
4
32
|
return function() {
|
|
5
|
-
|
|
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);
|
|
6
39
|
};
|
|
7
|
-
};
|
|
40
|
+
};
|
package/gulp-tasks/tasks.js
CHANGED
|
@@ -42,7 +42,7 @@ module.exports = function() {
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
|
|
45
|
-
// Grab component
|
|
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: [],
|