mod-build 3.7.3 → 3.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.7.5
4
+
5
+ - fixed trade directory name issue for section deals pages
6
+
7
+ ## 3.7.4
8
+
9
+ - Added small enhancements in `grab-mhsadmin-data`
10
+
3
11
  ## 3.7.3
4
12
 
5
13
  - Added `grab-section-deals-components` and `grab-mhsadmin-data` tasks for section deals pages.
@@ -97,7 +97,8 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
97
97
  featured: [],
98
98
  top: [],
99
99
  recent: []
100
- }
100
+ },
101
+ defaultHomePage: 'home-services'
101
102
  };
102
103
  resolve();
103
104
  });
@@ -111,7 +112,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
111
112
  }
112
113
  const { page, sitemap } = siteData;
113
114
  const { articlesConfig } = page;
114
- const { siteDetails } = articlesConfig;
115
+ const { siteDetails, defaultHomePage } = articlesConfig;
115
116
  return request(siteSettings.endpoints.GET_SITE_DETAILS, async function(_xhr, response, body) {
116
117
  if (response.statusCode === 200) {
117
118
  let result = await JSON.parse(body);
@@ -122,9 +123,9 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
122
123
  siteDetails.vertical = await siteDetails?.data?.homepage?.hero?.heading;
123
124
  siteDetails.costCalculatorTheme = siteData.costCalculatorTheme ? siteData.costCalculatorTheme : siteDetails?.slug;
124
125
  siteDetails.domain = await siteDetails?.data?.domain?.replace(/\/*?$/, '');
125
- siteDetails.homepage = await siteDetails?.data?.homepage?.slug;
126
+ siteDetails.homepage = await siteDetails?.data?.homepage?.slug ? siteDetails?.data?.homepage?.slug : defaultHomePage;
126
127
  siteDetails.canonicalURL = await `${siteDetails?.domain}/${siteDetails?.homepage}/`;
127
- if (siteDetails.data.favicon && Object.keys(siteDetails.data.favicon).length) {
128
+ if (siteDetails?.data?.favicon && Object.keys(siteDetails.data.favicon).length) {
128
129
  page.headConfig.faviconPath = siteDetails.data.favicon.url ? siteDetails.data.favicon.url : page.headConfig.faviconPath;
129
130
  }
130
131
 
@@ -193,7 +194,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
193
194
 
194
195
  const _insertTrade = function(htmlString) {
195
196
  const markup = gulpPlugins.htmlParser.parse(htmlString);
196
- markup.querySelector('.btn--zip').setAttribute('data-service', trade.slug);
197
+ markup.querySelector('.btn--zip').setAttribute('data-service', trade.slug.toLowerCase().replaceAll(/[-|\s]/ig, '_'));
197
198
  markup.querySelector('.trade').textContent = trade.displayName;
198
199
  return markup;
199
200
  };
@@ -246,20 +247,20 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
246
247
  trade = '${trade}'
247
248
  }}{{/page.articlesConfig.articlesWithContractors.${trade}.${pageName}}}`;
248
249
  // make the directory by trade name
249
- fs.mkdir(`${templatesPath}/${siteDetails.homepage}/${trade}/`, { recursive: true }, async function(error) {
250
+ fs.mkdir(`${templatesPath}/${siteDetails.homepage}/${articleData.data.trade.slug}/`, { recursive: true }, async function(error) {
250
251
  if (error) {
251
252
  throw error;
252
253
  }
253
- fs.writeFile(`${templatesPath}/${siteDetails.homepage}/${trade}/index.html`, tradeHubFileContent, function(err) {
254
+ fs.writeFile(`${templatesPath}/${siteDetails.homepage}/${articleData.data.trade.slug}/index.html`, tradeHubFileContent, function(err) {
254
255
  if (err) {
255
256
  throw err;
256
257
  }
257
- fs.writeFile(`${templatesPath}/${siteDetails.homepage}/${trade}/${fileName}.html`, fileContent, function($err) {
258
+ fs.writeFile(`${templatesPath}/${siteDetails.homepage}/${articleData.data.trade.slug}/${fileName}.html`, fileContent, function($err) {
258
259
  if ($err) {
259
260
  throw $err;
260
261
  }
261
262
  templatesCount++;
262
- log.info(`Article template ${templatesCount?.toString()?.padStart(2, '0')}: ${templatesPath}${trade}/${siteDetails.homepage}/${fileName}.html`);
263
+ log.info(`Article template ${templatesCount?.toString()?.padStart(2, '0')}: ${templatesPath}${articleData.data.trade.slug}/${siteDetails.homepage}/${fileName}.html`);
263
264
  if (articleConfigsCount === templatesCount) {
264
265
  siteData.page.lastMod = formatDate(new Date().toLocaleDateString(dateLocalString, lastModDateOptions));
265
266
  done();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.7.3",
3
+ "version": "3.7.5",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",