mod-build 4.0.0-alpha.20d → 4.0.0-alpha.20f

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "4.0.0-alpha.20d",
3
+ "version": "4.0.0-alpha.20f",
4
4
  "description": "Share components for S3 sites.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,6 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import { seasons } from "../data/seasons.js";
3
3
  import gulpHandlebarsFileInclude from "gulp-handlebars-file-include";
4
+ import merge from "lodash.merge";
4
5
 
5
6
  export function getFileFromURL(url) {
6
7
  return url.split('/').pop();
@@ -181,10 +182,7 @@ export const updateConfig = (config) => {
181
182
  const configData = fs.readFileSync('src/.tmp/config.json', 'utf8');
182
183
  const parsedConfig = JSON.parse(configData);
183
184
 
184
- mergedConfig = {
185
- ...parsedConfig,
186
- ...mergedConfig,
187
- };
185
+ mergedConfig = merge(mergedConfig, parsedConfig);
188
186
 
189
187
  // overwrite the config file with new data
190
188
  fs.writeFileSync('src/.tmp/config.json', JSON.stringify(mergedConfig, null, 2));
@@ -75,22 +75,18 @@ const fetchTcpaFromSitegenie = async (config, tempConfig) => {
75
75
 
76
76
  console.log('Starting fetch-tcpa-from-sitegenie: ', url);
77
77
 
78
- await new Promise(function(resolve) {
79
- axios.get(url).then(async resp => {
80
- if (resp.status !== 200) {
81
- throw new Error(`${resp.status}: Error while fetching TCPA`);
82
- }
78
+ axios.get(url).then(async resp => {
79
+ if (resp.status !== 200) {
80
+ throw new Error(`${resp.status}: Error while fetching TCPA`);
81
+ }
83
82
 
84
- const responseJson = resp.data;
85
- let finalTCPA = await (company === 'Modernize' || config.useModernizeInTCPA) ? responseJson.tcpa.replace(/QuinStreet/g, 'Modernize') : responseJson.tcpa;
86
- const removeInlineStyleRegex = / style="[^"]*"/g;
87
- finalTCPA = finalTCPA.replace(removeInlineStyleRegex, '');
88
- tempConfig.tcpaText = await finalTCPA;
89
- resolve();
90
- }).catch(error => {
91
- console.error(error);
92
- resolve();
93
- });
83
+ const responseJson = resp.data;
84
+ let finalTCPA = await (company === 'Modernize' || config.useModernizeInTCPA) ? responseJson.tcpa.replace(/QuinStreet/g, 'Modernize') : responseJson.tcpa;
85
+ const removeInlineStyleRegex = / style="[^"]*"/g;
86
+ finalTCPA = finalTCPA.replace(removeInlineStyleRegex, '');
87
+ tempConfig.tcpaText = await finalTCPA;
88
+ }).catch(error => {
89
+ console.error(error);
94
90
  });
95
91
  };
96
92