@uxf/scripts 11.63.0 → 11.64.0

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.63.0",
3
+ "version": "11.64.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -301,7 +301,7 @@ async function testUrl(url, webUrl, parentUrl = undefined) {
301
301
  redirected: result.redirected,
302
302
  indexable:
303
303
  result.isWebPage && typeof result.html === "string"
304
- ? cheerio.load(result.html)("meta[name='robots']").attr("content") !== "noindex"
304
+ ? !cheerio.load(result.html)("meta[name='robots']").attr("content")?.includes("noindex")
305
305
  : false,
306
306
  canonicalUrl:
307
307
  result.isWebPage && typeof result.html === "string"
@@ -590,25 +590,34 @@ module.exports = async function run(sitemapUrl, skip, withNested, withImages, ch
590
590
 
591
591
  logInitialInfo(sitemapUrl, webUrl, withNested, withImages, checkMissing, shouldReportMissing);
592
592
 
593
- const startTime = performance.now();
594
- const sitemapUrls = await Sitemap.getSitemap(sitemapUrl);
595
- await testSitemapUrls(sitemapUrls, webUrl, sitemapUrl, skip, withNested, withImages);
596
- const finishTime = performance.now();
593
+ try {
594
+ const startTime = performance.now();
595
+ const sitemapUrls = await Sitemap.getSitemap(sitemapUrl);
596
+ await testSitemapUrls(sitemapUrls, webUrl, sitemapUrl, skip, withNested, withImages);
597
+ const finishTime = performance.now();
597
598
 
598
- const result = getResult(webUrl, sitemapUrls, shouldReportMissing);
599
+ const result = getResult(webUrl, sitemapUrls, shouldReportMissing);
599
600
 
600
- if (result.errorsSum > 0) {
601
- const chatMessage = logResultErrors(webUrl, result);
601
+ if (result.errorsSum > 0) {
602
+ const chatMessage = logResultErrors(webUrl, result);
602
603
 
603
- await sendGoogleChatMessage(chatMessage, googleWebhookUrl);
604
- }
604
+ await sendGoogleChatMessage(chatMessage, googleWebhookUrl);
605
+ }
605
606
 
606
- if (result.skippedUrls.length > 0) {
607
- const skippedUrlsText = createSkippedResult(result.skippedUrls);
608
- logErrors(skippedUrlsText, "\nSkipped origins:\n");
609
- }
607
+ if (result.skippedUrls.length > 0) {
608
+ const skippedUrlsText = createSkippedResult(result.skippedUrls);
609
+ logErrors(skippedUrlsText, "\nSkipped origins:\n");
610
+ }
610
611
 
611
- logStatistics(result.ok, Math.ceil(finishTime - startTime));
612
+ logStatistics(result.ok, Math.ceil(finishTime - startTime));
613
+
614
+ process.exit(result.errorsSum > 0 ? 1 : 0);
615
+ } catch (e) {
616
+ stdout.write("⛔ Error: " + e.message + "\n");
617
+
618
+ await sendGoogleChatMessage(`Sitemap check failed completely:\n\n${e.message}`, googleWebhookUrl);
619
+
620
+ process.exit(1);
621
+ }
612
622
 
613
- process.exit(result.errorsSum > 0 ? 1 : 0);
614
623
  };