fix(smartsitemap): Update CI configuration, bump dependencies, and apply small code cleanups

This commit is contained in:
2025-11-19 21:03:37 +00:00
parent 74c73e05f2
commit fe7e95d57f
15 changed files with 9246 additions and 4536 deletions

View File

@@ -1,5 +1,8 @@
import { SitemapNews } from './smartsitemap.classes.sitemapnews.js';
import { type IUrlInfo, SitemapWebsite } from './smartsitemap.classes.sitemapwebsite.js';
import {
type IUrlInfo,
SitemapWebsite,
} from './smartsitemap.classes.sitemapwebsite.js';
import * as plugins from './smartsitemap.plugins.js';
import * as interfaces from './interfaces/index.js';
@@ -9,7 +12,9 @@ export class SmartSitemap {
/**
* creates a sitemap for news from feedurl
*/
public async createSitemapNewsFromFeedUrl(feedUrlArg: string): Promise<string> {
public async createSitemapNewsFromFeedUrl(
feedUrlArg: string,
): Promise<string> {
const sitemapNewsInstance = new SitemapNews({});
await sitemapNewsInstance.readAndAddFromRssFeedUrl(feedUrlArg);
return sitemapNewsInstance.exportSitemapXml();
@@ -18,7 +23,9 @@ export class SmartSitemap {
/**
* creates a sitemap for news from feedxmlstring
*/
public async createSitemapNewsFromAFeedStringArg(feedStringArg: string): Promise<string> {
public async createSitemapNewsFromAFeedStringArg(
feedStringArg: string,
): Promise<string> {
const sitemapNewsInstance = new SitemapNews({});
await sitemapNewsInstance.readAndAddFromRssFeedString(feedStringArg);
return sitemapNewsInstance.exportSitemapXml();
@@ -28,7 +35,7 @@ export class SmartSitemap {
* creates a sitemap for news from an array of articles
*/
public async createSitemapNewsFromArticleArray(
articleArrayArg: plugins.tsclass.content.IArticle[]
articleArrayArg: plugins.tsclass.content.IArticle[],
): Promise<string> {
const sitemapNewsInstance = new SitemapNews({});
await sitemapNewsInstance.readAndParseArticles(articleArrayArg);
@@ -39,9 +46,8 @@ export class SmartSitemap {
* creates a normal sitemap from a list of urls
*/
public async createSitemapFromYmlString(yamlString: string): Promise<string> {
const yamlObject: interfaces.ISitemapYaml = await plugins.smartyaml.yamlStringToObject(
yamlString
);
const yamlObject: interfaces.ISitemapYaml =
await plugins.smartyaml.yamlStringToObject(yamlString);
const sitemapWebsite = new SitemapWebsite();
for (const urlArg of yamlObject.daily) {
sitemapWebsite.addUrl({
@@ -68,11 +74,8 @@ export class SmartSitemap {
* parses a sitemap url
*/
public async parseSitemapUrl(urlArg: string) {
const sitemapXml = await (
await new plugins.webrequest.WebRequest().request(urlArg, {
method: 'GET',
})
).text();
const response = await plugins.webrequest.webrequest(urlArg);
const sitemapXml = await response.text();
const parsedSitemap = await this.parseSitemap(sitemapXml);
return parsedSitemap;
@@ -81,7 +84,9 @@ export class SmartSitemap {
/**
* parses a sitemap
*/
public async parseSitemap(sitemapXmlArg: string): Promise<interfaces.IParsedSiteMap> {
public async parseSitemap(
sitemapXmlArg: string,
): Promise<interfaces.IParsedSiteMap> {
return new plugins.smartxml.SmartXml().parseXmlToObject(sitemapXmlArg);
}
}