@uxf/scripts 11.62.0 → 11.62.1

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": "@uxf/scripts",
3
- "version": "11.62.0",
3
+ "version": "11.62.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -15,6 +15,10 @@ const { HTTP_USERNAME, HTTP_PASSWORD } = process.env;
15
15
  * @typedef {{url: string, parentUrl: (string | undefined), canonicalUrl: (string | null), isImg: boolean, isWebPage: boolean, ttl: number, status: number, message: (string | undefined), skipped: boolean, indexable: boolean, redirected: boolean}} TestedUrlDto
16
16
  */
17
17
 
18
+ const DUPLICATES_TITLE = "\n\n\nDuplicated pages in sitemap:\n";
19
+ const MISSING_TITLE = "\n\n\nMissing pages in sitemap:\n";
20
+ const ERROR_TITLE = "\n\n\nErrors:\n"
21
+
18
22
  const MAX_TTL = 3;
19
23
  const IMAGES_LABEL = "🏞 Images:";
20
24
  const URLS_LABEL = "🔗 Links:";
@@ -75,7 +79,7 @@ function createErrorList(errors) {
75
79
  }
76
80
 
77
81
  /**
78
- * @param errors {UrlCheckResponse[]}
82
+ * @param errors {TestedUrlDto[]}
79
83
  * @return {string}
80
84
  */
81
85
  function createErrorResult(errors) {
@@ -123,7 +127,7 @@ function createErrorResult(errors) {
123
127
  }
124
128
 
125
129
  /**
126
- * @param skippedUrls {UrlCheckResponse[]}
130
+ * @param skippedUrls {TestedUrlDto[]}
127
131
  * @return {string}
128
132
  */
129
133
  function createSkippedResult(skippedUrls) {
@@ -347,9 +351,6 @@ async function testNestedUrls(html, parentUrl, parentIndex, webUrl) {
347
351
  webUrl,
348
352
  );
349
353
 
350
- // FIXME
351
- urls = urls.filter((url) => url.startsWith(webUrl) || url.startsWith("/"));
352
-
353
354
  await testNested(urls, parentIndex, parentUrl, createTabSpace() + URLS_LABEL, webUrl);
354
355
  } catch (e) {
355
356
  ERRORS.push(`Can't test all nested pages for ${parentUrl} - ${e.message}`);
@@ -531,19 +532,25 @@ module.exports = async function run(sitemapUrl, skip, withNested, withImages, go
531
532
  const missingInSitemap = shouldBeInSitemap.filter((testedUrl) => !sitemapUrls.includes(testedUrl));
532
533
 
533
534
  if (missingInSitemap.length > 0 || duplicates.length > 0 || errors.length > 0 || ERRORS.length > 0) {
535
+ let chatMessage = "";
534
536
  const duplicatesText = duplicates.map((url) => `${createTabSpace()}${url}`).join("\n");
535
537
  const missingText = missingInSitemap.map((url) => `${createTabSpace()}${url}`).join("\n");
536
538
  const errorText = createErrorResult(errors);
539
+
537
540
  if (duplicatesText) {
538
- logErrors(duplicatesText, "\n\n\nDuplicated pages in sitemap:\n");
541
+ logErrors(duplicatesText, DUPLICATES_TITLE);
542
+ chatMessage += DUPLICATES_TITLE + duplicatesText;
539
543
  }
540
544
  if (missingText) {
541
- logErrors(missingText, "\n\n\nMissing pages in sitemap:\n");
545
+ logErrors(missingText, MISSING_TITLE);
546
+ chatMessage += MISSING_TITLE + missingText;
542
547
  }
543
548
  if (errorText) {
544
- logErrors(errorText, "\n\n\nErrors:\n");
549
+ logErrors(errorText, ERROR_TITLE);
550
+ chatMessage += ERROR_TITLE + errorText;
545
551
  }
546
- await sendGoogleChatMessage(duplicatesText + missingText + errorText, googleWebhookUrl);
552
+
553
+ await sendGoogleChatMessage(chatMessage, googleWebhookUrl);
547
554
  }
548
555
 
549
556
  if (skippedUrls.length > 0) {