mod-build 4.0.91 → 4.0.92

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.
Files changed (137) hide show
  1. package/package.json +1 -2
  2. package/public/resources/scripts/abandonment/abandonment-a4bbb36fbc8ed64042b8.min.js +2 -0
  3. package/public/resources/scripts/abandonment/abandonment.min.js +2 -0
  4. package/public/resources/scripts/callrail/callrail-14011d73b50a928de4b4.min.js +2 -0
  5. package/public/resources/scripts/callrail/callrail.min.js +2 -0
  6. package/public/resources/scripts/footer/footer-component-46dc0d7ca6af4fc3b76b.min.js +2 -0
  7. package/public/resources/scripts/footer/footer-component.min.js +2 -0
  8. package/public/resources/scripts/geolocation/geolocation.min.js +2 -0
  9. package/public/resources/scripts/helpers/addVWOTestQueryParam.min.js +2 -0
  10. package/public/resources/scripts/helpers/addVWOTestQueryParam.min.js.map +1 -0
  11. package/public/resources/scripts/helpers/additionalOpts.min.js +2 -0
  12. package/public/resources/scripts/helpers/additionalOpts.min.js.map +1 -0
  13. package/public/resources/scripts/helpers/calls-only.min.js +2 -0
  14. package/public/resources/scripts/helpers/calls-only.min.js.map +1 -0
  15. package/public/resources/scripts/helpers/getPhoneAssignmentData.min.js +2 -0
  16. package/public/resources/scripts/helpers/getPhoneAssignmentData.min.js.map +1 -0
  17. package/public/resources/scripts/helpers/initNumericOnlyFields.min.js +2 -0
  18. package/public/resources/scripts/helpers/initNumericOnlyFields.min.js.map +1 -0
  19. package/public/resources/scripts/helpers/initQSForm.min.js +2 -0
  20. package/public/resources/scripts/helpers/initQSForm.min.js.map +1 -0
  21. package/public/resources/scripts/helpers/initQuadTransform.min.js +2 -0
  22. package/public/resources/scripts/helpers/initQuadTransform.min.js.map +1 -0
  23. package/public/resources/scripts/helpers/isZipCodeValid.min.js +2 -0
  24. package/public/resources/scripts/helpers/isZipCodeValid.min.js.map +1 -0
  25. package/public/resources/scripts/helpers/observeVWOVariation.min.js +2 -0
  26. package/public/resources/scripts/helpers/observeVWOVariation.min.js.map +1 -0
  27. package/public/resources/scripts/helpers/opts.min.js +2 -0
  28. package/public/resources/scripts/helpers/opts.min.js.map +1 -0
  29. package/public/resources/scripts/jornaya.hbs +35 -0
  30. package/public/resources/scripts/jornaya.html +35 -0
  31. package/public/resources/scripts/mod-alytics/modalytics-be44027508c0438f6709.min.js +2 -0
  32. package/public/resources/scripts/mod-alytics/modalytics.min.js +2 -0
  33. package/public/resources/scripts/mod-form/form/contractor-0918337caf3dfede1609.min.js +2 -0
  34. package/public/resources/scripts/mod-form/form/contractor.min.js +2 -0
  35. package/public/resources/scripts/mod-form/form/homeowner-19a121b0e596042326f4.min.js +2 -0
  36. package/public/resources/scripts/mod-form/form/homeowner.min.js +2 -0
  37. package/public/resources/scripts/mod-utils/modutils-bc275eb41af515f626ef.min.js +2 -0
  38. package/public/resources/scripts/mod-utils/modutils.min.js +2 -0
  39. package/public/resources/scripts/trusted-form.hbs +38 -0
  40. package/public/resources/scripts/trusted-form.html +38 -0
  41. package/public/resources/styles/components/abandonment/abandonment-8a673f060817db6cb7dc.min.css +1 -0
  42. package/public/resources/styles/components/abandonment/abandonment.min.css +1 -0
  43. package/public/resources/styles/components/footer/mod-footer-d233fa64b6c8297c70ec.min.css +1 -0
  44. package/public/resources/styles/components/footer/mod-footer.min.css +1 -0
  45. package/public/resources/styles/components/footer/qs-footer-926e67c28d10c729db46.min.css +1 -0
  46. package/public/resources/styles/components/footer/qs-footer.min.css +1 -0
  47. package/src/resources/data/tcpa.json +4 -0
  48. package/src/resources/templates/modals/about/index.hbs +9 -0
  49. package/src/resources/templates/modals/about/index.html +9 -0
  50. package/src/resources/templates/modals/contact-us/index.hbs +348 -0
  51. package/src/resources/templates/modals/contact-us/index.html +348 -0
  52. package/src/resources/templates/modals/e-sign-consent/index.hbs +35 -0
  53. package/src/resources/templates/modals/e-sign-consent/index.html +35 -0
  54. package/src/resources/templates/modals/faq/index.hbs +9 -0
  55. package/src/resources/templates/modals/faq/index.html +9 -0
  56. package/src/resources/templates/modals/privacy/index.hbs +237 -0
  57. package/src/resources/templates/modals/privacy/index.html +237 -0
  58. package/src/resources/templates/modals/terms/index.hbs +167 -0
  59. package/src/resources/templates/modals/terms/index.html +167 -0
  60. package/src/scripts/retry-fetch.js +39 -0
  61. package/src/shared-components/call-tracking/_call-tracking.scss +311 -0
  62. package/src/shared-components/call-tracking/call-tracking-icon.html +8 -0
  63. package/src/shared-components/call-tracking/call-tracking.html +81 -0
  64. package/src/shared-components/call-tracking/phone.svg +6 -0
  65. package/src/shared-components/card-button/_card-button.scss +49 -0
  66. package/src/shared-components/card-button/card-button.html +9 -0
  67. package/src/shared-components/carousel/_carousel.scss +106 -0
  68. package/src/shared-components/carousel/carousel.html +23 -0
  69. package/src/shared-components/carousel/carousel.js +3573 -0
  70. package/src/shared-components/carousel/carousel.js.map +1 -0
  71. package/src/shared-components/carousel/carousel.min.js +2 -0
  72. package/src/shared-components/carousel/carousel.min.js.map +1 -0
  73. package/src/shared-components/carousel/carousel.min.min.js +2 -0
  74. package/src/shared-components/carousel/carousel.min.min.js.map +1 -0
  75. package/src/shared-components/checkbox/_checkbox.scss +130 -0
  76. package/src/shared-components/checkbox/checkbox.html +10 -0
  77. package/src/shared-components/consent-capture/tcpa.html +12 -0
  78. package/src/shared-components/expand-collapse/_expand-collapse.scss +93 -0
  79. package/src/shared-components/expand-collapse/expand-collapse.html +8 -0
  80. package/src/shared-components/expand-collapse/expand-collapse.js +40 -0
  81. package/src/shared-components/expand-collapse/expand-collapse.min.js +2 -0
  82. package/src/shared-components/expand-collapse/expand-collapse.min.js.map +1 -0
  83. package/src/shared-components/featured-block/_featured-block.scss +191 -0
  84. package/src/shared-components/featured-block/featured-block.html +80 -0
  85. package/src/shared-components/foot-assets/foot-assets.html +107 -0
  86. package/src/shared-components/form-tcpa/form-tcpa-spanish.html +61 -0
  87. package/src/shared-components/form-tcpa/form-tcpa.html +55 -0
  88. package/src/shared-components/gtm-body/gtm-body.html +4 -0
  89. package/src/shared-components/head/head.html +195 -0
  90. package/src/shared-components/header/_header.scss +200 -0
  91. package/src/shared-components/header/header.html +79 -0
  92. package/src/shared-components/hero/_hero.scss +276 -0
  93. package/src/shared-components/hero/hero.html +136 -0
  94. package/src/shared-components/how-it-works/_how-it-works.scss +138 -0
  95. package/src/shared-components/how-it-works/how-it-works.html +19 -0
  96. package/src/shared-components/input/_input.scss +242 -0
  97. package/src/shared-components/input/input.html +30 -0
  98. package/src/shared-components/preloader/_preloader.scss +61 -0
  99. package/src/shared-components/preloader/preloader.html +49 -0
  100. package/src/shared-components/progress-bar/_progress-bar.scss +142 -0
  101. package/src/shared-components/progress-bar/progress-bar.html +20 -0
  102. package/src/shared-components/progress-bar/progress-bar.js +26 -0
  103. package/src/shared-components/progress-bar/progress-bar.min.js +2 -0
  104. package/src/shared-components/progress-bar/progress-bar.min.js.map +1 -0
  105. package/src/shared-components/radio-button/_radio-button.scss +577 -0
  106. package/src/shared-components/radio-button/radio-button.html +25 -0
  107. package/src/shared-components/reviews/_reviews.scss +79 -0
  108. package/src/shared-components/reviews/reviews.html +27 -0
  109. package/src/shared-components/section-deals/sitemap.xml +9 -0
  110. package/src/shared-components/select/_select.scss +61 -0
  111. package/src/shared-components/select/select.html +8 -0
  112. package/src/shared-components/steps/_steps.scss +431 -0
  113. package/src/shared-components/steps/defaultFormFieldConfig.json +64 -0
  114. package/src/shared-components/steps/step-fields.html +36 -0
  115. package/src/shared-components/steps/steps.html +136 -0
  116. package/src/shared-components/textarea/_textarea.scss +96 -0
  117. package/src/shared-components/textarea/textarea.html +13 -0
  118. package/src/shared-components/theme-toggle/_theme-toggle.scss +68 -0
  119. package/src/shared-components/theme-toggle/theme-toggle.html +34 -0
  120. package/src/shared-components/tile/_tile.scss +117 -0
  121. package/src/shared-components/tile/tile.html +27 -0
  122. package/src/shared-components/value-props/_value-props.scss +99 -0
  123. package/src/shared-components/value-props/value-props.html +17 -0
  124. package/src/shared-components/zip-control/_zip-control.scss +42 -0
  125. package/src/shared-components/zip-control/zip-control.html +21 -0
  126. package/tasks/add-editorconfig.js +3 -3
  127. package/tasks/get-default-trade-questions.js +8 -8
  128. package/tasks/grab-b2b-data.js +9 -30
  129. package/tasks/grab-cdn.js +4 -13
  130. package/tasks/grab-code-review-rules.js +4 -3
  131. package/tasks/grab-form-helpers.js +11 -27
  132. package/tasks/grab-global-fonts.js +7 -13
  133. package/tasks/grab-jsdoc.js +10 -30
  134. package/tasks/grab-shared-components.js +10 -19
  135. package/tasks/grab-shared-scripts.js +8 -21
  136. package/tasks/templates.js +28 -41
  137. package/src/scripts/retry-axios.js +0 -23
@@ -1,16 +1,16 @@
1
1
  import { defaultSettings } from '../src/data/config.js';
2
2
  import { promises as fs } from 'node:fs';
3
- import axios from 'axios';
4
3
 
5
4
  async function addEditorConfig(defaultSettings) {
6
5
  try {
7
- const response = await axios.get(`https://${defaultSettings.nodeEnv}/quote/resources/mod-site/configurations/editorconfig.editorconfig`);
6
+ const response = await fetch(`https://${defaultSettings.nodeEnv}/quote/resources/mod-site/configurations/editorconfig.editorconfig`);
8
7
 
9
8
  if (response.status !== 200) {
10
9
  throw new Error(`${response.status}: Error while fetching editorconfig`);
11
10
  }
12
11
 
13
- await fs.writeFile('.editorconfig', response.data, 'utf8');
12
+ const text = await response.text();
13
+ await fs.writeFile('.editorconfig', text, 'utf8');
14
14
  } catch (error) {
15
15
  console.error('Error occurred:', error.message);
16
16
  }
@@ -1,6 +1,5 @@
1
1
  /* globals Promise */
2
2
  import merge from 'lodash.merge';
3
- import axios from 'axios';
4
3
  import { defaultSettings } from '../src/data/config.js';
5
4
 
6
5
  function mergeDefaultTradeQuestionsConfigOnSteps(config, steps) {
@@ -182,25 +181,26 @@ export default async function(config) {
182
181
  const tradeQuestionsURL = `https://${defaultSettings.nodeEnv}/${resourcePath}/${trade?.replace(/\s/g, '_')}.json`;
183
182
  await new Promise(async (resolve) => {
184
183
  console.log(`Started fetching common questions config...\n ${commonQuestionsURL}`);
185
- await axios.get(commonQuestionsURL)
184
+ await fetch(commonQuestionsURL)
186
185
  .then(async (resp) => {
187
186
  if (resp.status !== 200) {
188
187
  throw new Error(`${resp.status}: Error while fetching ${commonQuestionsURL}`);
189
188
  }
190
189
 
191
- commonQuestions = { ...commonQuestions, ...resp.data };
190
+ const commonData = await resp.json();
191
+ commonQuestions = { ...commonQuestions, ...commonData };
192
192
 
193
193
  console.log('Finished fetching common questions config...');
194
194
  console.log(`Started fetching ${trade} questions config...\n ${tradeQuestionsURL}`);
195
- await axios.get(tradeQuestionsURL)
196
- .then((response) => {
197
- if (resp.status !== 200) {
198
- throw new Error(`${resp.status}: Error while fetching ${tradeQuestionsURL}`);
195
+ await fetch(tradeQuestionsURL)
196
+ .then(async (response) => {
197
+ if (response.status !== 200) {
198
+ throw new Error(`${response.status}: Error while fetching ${tradeQuestionsURL}`);
199
199
  }
200
200
 
201
201
  console.log(`Finished fetching ${trade} questions config...`);
202
202
 
203
- const steps = response.data;
203
+ const steps = await response.json();
204
204
  steps.OwnHome = commonQuestions.OwnHome;
205
205
  steps.BuyTimeframe = commonQuestions.BuyTimeframe;
206
206
 
@@ -1,16 +1,11 @@
1
1
  import { defaultSettings } from '../src/data/config.js';
2
- import axios from 'axios';
3
- import { createWriteStream } from 'node:fs';
4
- import * as stream from 'node:stream';
5
- import { promisify } from 'node:util';
2
+ import { createRetryFetch } from '../src/scripts/retry-fetch.js';
6
3
  import fs from 'node:fs';
7
- import { responseInterceptor } from '../src/scripts/retry-axios.js';
4
+ import { promises as fsPromises } from 'node:fs';
8
5
 
9
- const axiosInstance = axios.create();
10
- const axiosResponseInterceptor = responseInterceptor(axiosInstance);
6
+ const fetchWithRetry = createRetryFetch();
11
7
 
12
8
  function streamToDestination(inputPath, destPath, fileName) {
13
- const finished = promisify(stream.finished);
14
9
  const url = `https://${defaultSettings.nodeEnv}${inputPath}`;
15
10
 
16
11
  return new Promise(resolve => {
@@ -18,33 +13,19 @@ function streamToDestination(inputPath, destPath, fileName) {
18
13
  fs.mkdirSync(`${destPath}`, { recursive: true });
19
14
  }
20
15
 
21
- const writer = createWriteStream(`${destPath}${fileName}`);
22
- const options = {
23
- url,
24
- method: 'get',
25
- responseType: 'stream',
26
- };
16
+ const filePath = `${destPath}${fileName}`;
27
17
 
28
- // Collect data chunks to parse JSON
29
- let jsonData = '';
30
-
31
- axiosInstance(options).then(resp => {
18
+ fetchWithRetry(url).then(async resp => {
32
19
  if (resp.status !== 200) {
33
20
  throw new Error(`${resp.status}: Error while fetching ${url}`);
34
21
  }
35
22
 
36
- // Capture data while streaming to file
37
- resp.data.on('data', chunk => {
38
- jsonData += chunk.toString();
39
- });
40
-
41
- resp.data.pipe(writer);
23
+ const text = await resp.text();
24
+ await fsPromises.writeFile(filePath, text, 'utf8');
42
25
  console.log(`${url} created...`);
43
- return finished(writer);
44
- }).then(() => {
45
- // Parse the JSON data we collected
26
+
46
27
  try {
47
- const parsedData = JSON.parse(jsonData);
28
+ const parsedData = JSON.parse(text);
48
29
  resolve(parsedData);
49
30
  } catch (error) {
50
31
  console.error(`Error parsing JSON from ${url}:`, error.message);
@@ -53,8 +34,6 @@ function streamToDestination(inputPath, destPath, fileName) {
53
34
  }).catch(error => {
54
35
  console.error(`Error fetching ${url}:`, error.message);
55
36
  process.exit(1);
56
- }).finally(() => {
57
- axiosInstance.interceptors.response.eject(axiosResponseInterceptor);
58
37
  });
59
38
  });
60
39
  }
package/tasks/grab-cdn.js CHANGED
@@ -1,14 +1,12 @@
1
1
  import { defaultSettings } from '../src/data/config.js';
2
- import axios from 'axios';
2
+ import { createRetryFetch, streamResponseToWriter } from '../src/scripts/retry-fetch.js';
3
3
  import { createWriteStream } from 'node:fs';
4
4
  import * as stream from 'node:stream';
5
5
  import { promisify } from 'node:util';
6
6
  import fs from 'node:fs';
7
7
  import path from 'node:path';
8
- import { responseInterceptor } from '../src/scripts/retry-axios.js';
9
8
 
10
- const axiosInstance = axios.create();
11
- const axiosResponseInterceptor = responseInterceptor(axiosInstance);
9
+ const fetchWithRetry = createRetryFetch();
12
10
 
13
11
  async function duplicateHtmlFilestoHbs(externalResources) {
14
12
  for (const inputPath in externalResources) {
@@ -42,17 +40,12 @@ function streamToDestination(inputPath, destPath, fileName) {
42
40
  resolve();
43
41
  } else {
44
42
  const writer = createWriteStream(`${destPath}${fileName}`);
45
- const options = {
46
- url,
47
- method: 'get',
48
- responseType: 'stream',
49
- };
50
43
 
51
- axiosInstance(options).then(resp => {
44
+ fetchWithRetry(url).then(async resp => {
52
45
  if (resp.status !== 200) {
53
46
  throw new Error(`${resp.status}: Error while fetching ${url}`);
54
47
  }
55
- resp.data.pipe(writer);
48
+ await streamResponseToWriter(resp, writer);
56
49
  console.log(`${destPath}${fileName} created...`);
57
50
  return finished(writer);
58
51
  }).then(() => {
@@ -60,8 +53,6 @@ function streamToDestination(inputPath, destPath, fileName) {
60
53
  }).catch(error => {
61
54
  console.error(error);
62
55
  process.exit(1);
63
- }).finally(() => {
64
- axiosInstance.interceptors.response.eject(axiosResponseInterceptor);
65
56
  });
66
57
  }
67
58
  });
@@ -1,18 +1,19 @@
1
1
  import { defaultSettings } from '../src/data/config.js';
2
2
  import { promises as fs } from 'node:fs';
3
- import axios from 'axios';
4
3
 
5
4
  async function grabRules() {
6
5
  try {
7
6
  const url = `https://${defaultSettings.nodeEnv}/quote/resources/mod-site/code-review-rules/review-agent.md`;
8
- const response = await axios.get(url);
7
+ const response = await fetch(url);
9
8
 
10
9
  if (response.status !== 200) {
11
10
  throw new Error(`${response.status}: Error while fetching review-agent.md`);
12
11
  }
13
12
 
13
+ const text = await response.text();
14
+
14
15
  await fs.mkdir('.rovodev', { recursive: true });
15
- await fs.writeFile('.rovodev/.review-agent.md', response.data, 'utf8');
16
+ await fs.writeFile('.rovodev/.review-agent.md', text, 'utf8');
16
17
  } catch (error) {
17
18
  console.error('Error occurred:', error.message);
18
19
  }
@@ -1,16 +1,13 @@
1
1
  import { defaultSettings } from '../src/data/config.js';
2
- import axios from 'axios';
2
+ import { createRetryFetch, streamResponseToWriter } from '../src/scripts/retry-fetch.js';
3
3
  import { createWriteStream } from 'node:fs';
4
4
  import * as stream from 'node:stream';
5
5
  import { promisify } from 'node:util';
6
6
  import fs from 'node:fs';
7
- import { responseInterceptor } from '../src/scripts/retry-axios.js';
8
7
 
9
8
  const resourcePath = 'quote/resources/mod-form/form';
10
- const axiosInstance = axios.create();
11
- const helpersAxiosInstance = axios.create();
12
- const axiosResponseInterceptor = responseInterceptor(axiosInstance);
13
- const helpersAxiosResponseInterceptor = responseInterceptor(helpersAxiosInstance);
9
+ const fetchWithRetryStream = createRetryFetch();
10
+ const fetchWithRetryList = createRetryFetch();
14
11
 
15
12
  // helper to allow us to define an "end" event to multiple streams
16
13
  const streamToDestination = (destPath, fileName) => {
@@ -32,18 +29,13 @@ const streamToDestination = (destPath, fileName) => {
32
29
  if (fs.existsSync(`${folderPath}/${fileName}`)) {
33
30
  resolve();
34
31
  } else {
35
- const writer = createWriteStream(`${folderPath}/${fileName}`)
36
- const options = {
37
- url,
38
- method: 'get',
39
- responseType: 'stream'
40
- };
32
+ const writer = createWriteStream(`${folderPath}/${fileName}`);
41
33
 
42
- axiosInstance(options).then(resp => {
34
+ fetchWithRetryStream(url).then(async resp => {
43
35
  if (resp.status !== 200) {
44
36
  throw new Error(`${resp.status}: Error while fetching ${url}`);
45
37
  }
46
- resp.data.pipe(writer);
38
+ await streamResponseToWriter(resp, writer);
47
39
  console.log(`${destPath}${fileName} created...`);
48
40
  return finished(writer);
49
41
  }).then(() => {
@@ -51,8 +43,6 @@ const streamToDestination = (destPath, fileName) => {
51
43
  }).catch(error => {
52
44
  console.error(error);
53
45
  process.exit(1);
54
- }).finally(() => {
55
- axiosInstance.interceptors.response.eject(axiosResponseInterceptor);
56
46
  });
57
47
  }
58
48
  });
@@ -61,24 +51,18 @@ const streamToDestination = (destPath, fileName) => {
61
51
  async function getHelpers() {
62
52
  let helpers = [];
63
53
  await new Promise(resolve => {
64
- const options = {
65
- url: `https://${defaultSettings.nodeEnv}/${resourcePath}/chunks.txt`,
66
- method: 'get'
67
- }
54
+ const url = `https://${defaultSettings.nodeEnv}/${resourcePath}/chunks.txt`;
68
55
 
69
- helpersAxiosInstance(options).then(resp => {
56
+ fetchWithRetryList(url).then(async resp => {
70
57
  if (resp.status !== 200) {
71
- throw new Error(`${resp.status}: Error while fetching ${options.url}`);
58
+ throw new Error(`${resp.status}: Error while fetching ${url}`);
72
59
  }
73
- helpers = resp.data.split('\n');
74
- resolve();
75
- }).then(() => {
60
+ const text = await resp.text();
61
+ helpers = text.split('\n');
76
62
  resolve();
77
63
  }).catch(error => {
78
64
  console.error(error);
79
65
  resolve();
80
- }).finally(() => {
81
- helpersAxiosInstance.interceptors.response.eject(helpersAxiosResponseInterceptor);
82
66
  });
83
67
  });
84
68
 
@@ -1,11 +1,10 @@
1
1
  import { defaultSettings } from '../src/data/config.js';
2
- import axios from 'axios';
2
+ import { createRetryFetch, streamResponseToWriter } from '../src/scripts/retry-fetch.js';
3
3
  import { createWriteStream } from 'node:fs';
4
4
  import * as stream from 'node:stream';
5
5
  import { promisify } from 'node:util';
6
6
  import fs from 'node:fs';
7
7
  import path from 'node:path';
8
- import { responseInterceptor } from '../src/scripts/retry-axios.js';
9
8
  import addFilesToGitignore from './add-files-to-gitignore.js';
10
9
 
11
10
  // Font variants and extensions to download for each font
@@ -13,8 +12,7 @@ const fontVariants = ['regular', 'bold'];
13
12
  const fontExtensions = ['ttf', 'woff2'];
14
13
  const finished = promisify(stream.finished);
15
14
 
16
- const axiosInstance = axios.create();
17
- responseInterceptor(axiosInstance);
15
+ const fetchWithRetry = createRetryFetch();
18
16
 
19
17
  const getFontPath = (...parts) => path.join(
20
18
  defaultSettings.publicFolder,
@@ -32,8 +30,8 @@ const directoryHasItems = (dirPath) => {
32
30
  const getFontDownloadUrls = async (fontName) => {
33
31
  try {
34
32
  const url = `https://gwfh.mranftl.com/api/fonts/${fontName}?subsets=latin`;
35
- const response = await axiosInstance.get(url);
36
- const fontData = response.data;
33
+ const response = await fetchWithRetry(url);
34
+ const fontData = await response.json();
37
35
 
38
36
  if (!fontData?.variants) {
39
37
  throw new Error('Invalid font data received');
@@ -77,11 +75,7 @@ const downloadFontFile = async (fontName, variant, extension, downloadUrl) => {
77
75
  }
78
76
 
79
77
  try {
80
- const resp = await axiosInstance({
81
- url: downloadUrl,
82
- method: 'get',
83
- responseType: 'stream'
84
- });
78
+ const resp = await fetchWithRetry(downloadUrl);
85
79
 
86
80
  if (resp.status !== 200) {
87
81
  throw new Error(`${resp.status}: Error while fetching ${downloadUrl}`);
@@ -89,7 +83,7 @@ const downloadFontFile = async (fontName, variant, extension, downloadUrl) => {
89
83
 
90
84
  console.log(`Downloading ${filePath}...`);
91
85
  const writer = createWriteStream(filePath);
92
- resp.data.pipe(writer);
86
+ await streamResponseToWriter(resp, writer);
93
87
  await finished(writer);
94
88
  console.log(`${filePath} downloaded successfully`);
95
89
  } catch (error) {
@@ -145,4 +139,4 @@ export default async function(config) {
145
139
 
146
140
  await Promise.all(fontNames.map(downloadFont));
147
141
  await updateGitignore(fontNames);
148
- }
142
+ }
@@ -1,17 +1,14 @@
1
1
  import { defaultSettings } from '../src/data/config.js';
2
- import axios from 'axios';
2
+ import { createRetryFetch, streamResponseToWriter } from '../src/scripts/retry-fetch.js';
3
3
  import fs, { createWriteStream } from 'node:fs';
4
4
  import * as stream from 'node:stream';
5
5
  import { promisify } from 'node:util';
6
6
  import path from 'node:path';
7
- import { responseInterceptor } from '../src/scripts/retry-axios.js';
8
7
  import addFilesToGitignore from './add-files-to-gitignore.js';
9
8
 
10
9
  const resourcePath = 'quote/resources/mod-form';
11
- const axiosInstance = axios.create();
12
- const jsdocAxiosInstance = axios.create();
13
- const axiosResponseInterceptor = responseInterceptor(axiosInstance);
14
- const jsdocResponseInterceptor = responseInterceptor(jsdocAxiosInstance);
10
+ const fetchWithRetryStream = createRetryFetch();
11
+ const fetchWithRetryJson = createRetryFetch();
15
12
 
16
13
  // Helper to stream a JSDoc file to the destination directory
17
14
  const streamToDestination = async (filePath) => {
@@ -39,56 +36,40 @@ const streamToDestination = async (filePath) => {
39
36
  }
40
37
 
41
38
  const writer = createWriteStream(fileFullPath);
42
- const options = {
43
- url,
44
- method: 'get',
45
- responseType: 'stream'
46
- };
47
39
 
48
40
  try {
49
- const resp = await axiosInstance(options);
41
+ const resp = await fetchWithRetryStream(url);
50
42
 
51
43
  if (resp.status !== 200) {
52
44
  throw new Error(`${resp.status}: Error while fetching ${url}`);
53
45
  }
54
46
 
55
- resp.data.pipe(writer);
47
+ await streamResponseToWriter(resp, writer);
56
48
  console.log(`${fileFullPath} created...`);
57
49
  await finished(writer);
58
50
  } catch (error) {
59
51
  console.error(error);
60
52
  process.exit(1);
61
- } finally {
62
- axiosInstance.interceptors.response.eject(axiosResponseInterceptor);
63
53
  }
64
54
  }
65
55
 
66
56
  async function getJSDocFiles() {
67
57
  // Add cachebuster to avoid server/browser caching issues
68
58
  const cachebuster = Math.round(Date.now() / 1000);
69
- const options = {
70
- url: `https://${defaultSettings.nodeEnv}/${resourcePath}/jsdoc.json?cb=${cachebuster}`,
71
- method: 'get'
72
- }
59
+ const url = `https://${defaultSettings.nodeEnv}/${resourcePath}/jsdoc.json?cb=${cachebuster}`;
73
60
 
74
61
  try {
75
- const resp = await jsdocAxiosInstance(options);
62
+ const resp = await fetchWithRetryJson(url);
76
63
 
77
64
  if (resp.status !== 200) {
78
- throw new Error(`${resp.status}: Error while fetching ${options.url}`);
79
- }
80
-
81
- // axios may parse JSON automatically, so check if it's already an object
82
- if (typeof resp.data === 'string') {
83
- return JSON.parse(resp.data);
65
+ throw new Error(`${resp.status}: Error while fetching ${url}`);
84
66
  }
85
67
 
86
- return resp.data;
68
+ const text = await resp.text();
69
+ return JSON.parse(text);
87
70
  } catch (error) {
88
71
  console.error(error);
89
72
  throw error;
90
- } finally {
91
- jsdocAxiosInstance.interceptors.response.eject(jsdocResponseInterceptor);
92
73
  }
93
74
  }
94
75
 
@@ -113,4 +94,3 @@ export default async function grabJSDoc() {
113
94
  ];
114
95
  await addFilesToGitignore(gitignoreFiles, 'JSDoc generated files');
115
96
  }
116
-
@@ -1,15 +1,13 @@
1
1
  import { defaultSettings } from '../src/data/config.js';
2
- import axios from 'axios';
2
+ import { createRetryFetch, streamResponseToWriter } from '../src/scripts/retry-fetch.js';
3
3
  import { createWriteStream } from 'node:fs';
4
4
  import * as stream from 'node:stream';
5
5
  import { promisify } from 'node:util';
6
6
  import fs from 'node:fs';
7
- import { responseInterceptor } from '../src/scripts/retry-axios.js';
8
7
 
9
8
  const resourcePath = 'quote/resources/mod-site';
10
9
 
11
- const axiosInstance = axios.create();
12
- const axiosResponseInterceptor = responseInterceptor(axiosInstance);
10
+ const fetchWithRetry = createRetryFetch();
13
11
 
14
12
  const streamSharedCompsToDestination = (defaultSettings, folder, fileName) => {
15
13
  const finished = promisify(stream.finished);
@@ -27,24 +25,20 @@ const streamSharedCompsToDestination = (defaultSettings, folder, fileName) => {
27
25
  resolve();
28
26
  } else {
29
27
  const writer = createWriteStream(`${folderPath}/${fileName}`);
30
- const options = {
31
- url: `https://${defaultSettings.nodeEnv}/${resourcePath}/${folder}/${fileName}`,
32
- method: 'get',
33
- responseType: 'stream'
34
- };
28
+ const url = `https://${defaultSettings.nodeEnv}/${resourcePath}/${folder}/${fileName}`;
35
29
 
36
- axios(options).then(resp => {
30
+ fetch(url).then(async resp => {
37
31
  if (resp.status !== 200) {
38
- throw new Error(`${resp.status}: Error while fetching ${options.url}`);
32
+ throw new Error(`${resp.status}: Error while fetching ${url}`);
39
33
  }
40
34
  console.log(`${folderPath}/${fileName} created...`);
41
- resp.data.pipe(writer);
35
+ await streamResponseToWriter(resp, writer);
42
36
  return finished(writer);
43
37
  }).then(() => {
44
38
  resolve();
45
39
  }).catch(error => {
46
40
  console.error(error);
47
- throw new Error(`${error?.response?.statusText} [${error?.status}]: Error while fetching ${options.url}`);
41
+ throw new Error(`${error.message}: Error while fetching ${url}`);
48
42
  });
49
43
  }
50
44
  });
@@ -58,12 +52,12 @@ const getListOfSharedComponents = (defaultSettings, componentFolders) => {
58
52
  }
59
53
 
60
54
  return new Promise(resolve => {
61
- axiosInstance.get(`https://${defaultSettings.nodeEnv}/${resourcePath}/${folder}/all.json`)
62
- .then(resp => {
55
+ fetchWithRetry(`https://${defaultSettings.nodeEnv}/${resourcePath}/${folder}/all.json`)
56
+ .then(async resp => {
63
57
  if (resp.status !== 200) {
64
58
  throw new Error(`${resp.status}: Error while fetching ${folder}/all.json`);
65
59
  }
66
- const listOfComponents = resp.data;
60
+ const listOfComponents = await resp.json();
67
61
  const componentPromises = listOfComponents.map(resource => {
68
62
  return streamSharedCompsToDestination(defaultSettings, folder, `${resource}`);
69
63
  });
@@ -73,9 +67,6 @@ const getListOfSharedComponents = (defaultSettings, componentFolders) => {
73
67
  .catch(err => {
74
68
  console.log(defaultSettings.nodeEnv);
75
69
  throw new Error(`Error while fetching ${folder}/all.json: ${err.message}`);
76
- })
77
- .finally(() => {
78
- axiosInstance.interceptors.response.eject(axiosResponseInterceptor);
79
70
  });
80
71
  });
81
72
  });
@@ -1,5 +1,5 @@
1
1
  import { defaultSettings } from '../src/data/config.js';
2
- import axios from 'axios';
2
+ import { createRetryFetch, streamResponseToWriter } from '../src/scripts/retry-fetch.js';
3
3
  import { createWriteStream } from 'node:fs';
4
4
  import * as stream from 'node:stream';
5
5
  import { promisify } from 'node:util';
@@ -9,8 +9,6 @@ import tap from 'gulp-tap';
9
9
  import hash from 'gulp-hash';
10
10
  import replace from 'gulp-replace';
11
11
  import { getFileFromURL } from '../src/scripts/utils.js';
12
- import { responseInterceptor } from '../src/scripts/retry-axios.js';
13
-
14
12
  let fileNames = {};
15
13
  let componentFolderPath = '';
16
14
  let replacementFunctions = [];
@@ -18,8 +16,7 @@ let replacementFunctions = [];
18
16
  let pathSubdirectory = '';
19
17
  let useAccessibleComponents = false;
20
18
 
21
- const axiosInstance = axios.create();
22
- const axiosResponseInterceptor = responseInterceptor(axiosInstance);
19
+ const fetchWithRetry = createRetryFetch();
23
20
 
24
21
  function replaceHeadScripts(gulp, defaultSettings) {
25
22
  const resourcePath = '/resources/scripts';
@@ -225,18 +222,14 @@ function getResource(task, fileNames, resourcePath = 'quote/resources') {
225
222
  if (fs.existsSync(`${task.config.defaultSettings.publicFolder}/resources/${config.dest}/${file}`)) {
226
223
  resolve();
227
224
  } else {
228
- const options = {
229
- url: `https://${task.config.defaultSettings.nodeEnv}/${resourcePath}/${url}`,
230
- method: 'get',
231
- responseType: 'stream'
232
- }
233
- axiosInstance(options).then(resp => {
225
+ const resourceUrl = `https://${task.config.defaultSettings.nodeEnv}/${resourcePath}/${url}`;
226
+ fetchWithRetry(resourceUrl).then(async resp => {
234
227
  if (resp.status !== 200) {
235
228
  throw new Error(`${resp.status}: Error while fetching ${url}`);
236
229
  }
237
230
 
238
231
  const writer = createWriteStream(`${task.config.defaultSettings.publicFolder}/resources/${config.dest}/${file}`);
239
- resp.data.pipe(writer);
232
+ await streamResponseToWriter(resp, writer);
240
233
  console.log(`${task.config.defaultSettings.publicFolder}/resources/${config.dest}/${file} created...`);
241
234
  return finished(writer);
242
235
  })
@@ -268,17 +261,14 @@ function getResource(task, fileNames, resourcePath = 'quote/resources') {
268
261
  const mapFileUrl = `${url}.map`;
269
262
  const mapFile = getFileFromURL(mapFileUrl);
270
263
 
271
- return axiosInstance({
272
- url: `https://${task.config.defaultSettings.nodeEnv}/${resourcePath}/${mapFileUrl}`,
273
- method: 'get',
274
- responseType: 'stream'
275
- }).then(resp => {
264
+ const mapUrl = `https://${task.config.defaultSettings.nodeEnv}/${resourcePath}/${mapFileUrl}`;
265
+ return fetchWithRetry(mapUrl).then(async resp => {
276
266
  if (resp.status !== 200) {
277
267
  throw new Error(`${resp.status}: Error while fetching map file ${mapFileUrl}`);
278
268
  }
279
269
 
280
270
  const mapWriter = createWriteStream(`${task.config.defaultSettings.publicFolder}/resources/${config.dest}/${mapFile}`);
281
- resp.data.pipe(mapWriter);
271
+ await streamResponseToWriter(resp, mapWriter);
282
272
  console.log(`${task.config.defaultSettings.publicFolder}/resources/${config.dest}/${mapFile} created...`);
283
273
  return finished(mapWriter);
284
274
  });
@@ -299,9 +289,6 @@ function getResource(task, fileNames, resourcePath = 'quote/resources') {
299
289
  })
300
290
  .catch((error) => {
301
291
  console.error('Error:', error);
302
- })
303
- .finally(() => {
304
- axiosInstance.interceptors.response.eject(axiosResponseInterceptor);
305
292
  });
306
293
  }
307
294
  })