mod-build 3.6.60 → 3.6.61-beta.2

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,31 +1,33 @@
1
1
  var request = require('request');
2
2
  var source = require('vinyl-source-stream');
3
3
 
4
- function streamSharedCompsToDestination(gulp, siteSettings, fileName) {
5
- return new Promise(resolve => { // eslint-disable-line no-undef
6
- request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/shared-components/${fileName}`)
4
+ function streamSharedCompsToDestination(gulp, siteSettings, folder, fileName) {
5
+ return new Promise(resolve => {
6
+ request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/${fileName}`)
7
7
  .on('response', resp => {
8
8
  if (resp.statusCode !== 200) {
9
9
  throw new Error(`${resp.statusCode} Error while fetching ${fileName}`);
10
10
  }
11
11
  })
12
12
  .pipe(source(fileName))
13
- .pipe(gulp.dest(`${siteSettings.srcFolder}/shared-components/`))
13
+ .pipe(gulp.dest(`${siteSettings.srcFolder}/${folder}/`))
14
14
  .on('finish', resolve);
15
15
  });
16
16
  }
17
17
 
18
- function getListOfSharedComponents(gulp, gulpPlugins, siteSettings) {
19
- return new Promise(resolve => { // eslint-disable-line no-undef
20
- request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/shared-components/all.json`, function(err, resp, body) {
21
- if (resp.statusCode !== 200) {
22
- throw new Error(`${resp.statusCode}: Error while fetching shared-components/all.json`);
23
- }
24
- var listOfComponents = JSON.parse(body);
25
- const componentPromises = listOfComponents.map(function(resource) {
26
- return streamSharedCompsToDestination(gulp, siteSettings, `${resource}`);
18
+ function getListOfSharedComponents(gulp, gulpPlugins, siteSettings, componentFolders) {
19
+ return componentFolders.map(folder => {
20
+ return new Promise(resolve => {
21
+ request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/all.json`, function(err, resp, body) {
22
+ if (resp.statusCode !== 200) {
23
+ throw new Error(`${resp.statusCode}: Error while fetching ${folder}/all.json`);
24
+ }
25
+ var listOfComponents = JSON.parse(body);
26
+ const componentPromises = listOfComponents.map(function(resource) {
27
+ return streamSharedCompsToDestination(gulp, siteSettings, folder, `${resource}`);
28
+ });
29
+ resolve(Promise.all(componentPromises));
27
30
  });
28
- resolve(Promise.all(componentPromises)); // eslint-disable-line no-undef
29
31
  });
30
32
  });
31
33
  }
@@ -37,6 +39,8 @@ module.exports = function(gulp, gulpPlugins, siteSettings) {
37
39
  throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
38
40
  }
39
41
 
40
- return getListOfSharedComponents(gulp, gulpPlugins, siteSettings); // eslint-disable-line no-undef
42
+ const componentFolders = ['shared-components', 'accessible-components']
43
+
44
+ return getListOfSharedComponents(gulp, gulpPlugins, siteSettings, componentFolders);
41
45
  };
42
46
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.60",
3
+ "version": "3.6.61-beta.2",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",