chore: update README for clarity and formatting improvements
fix: update test imports to use new package path refactor: improve feed class structure and formatting refactor: enhance smartfeed class for better readability chore: streamline plugin exports for consistency chore: update TypeScript configuration for improved compatibility ci: add workflows for handling tag and non-tag pushes
This commit is contained in:
@@ -39,11 +39,11 @@ export class Feed {
|
||||
author: {
|
||||
name: this.options.company,
|
||||
email: this.options.companyEmail,
|
||||
link: this.options.companyEmail
|
||||
link: this.options.companyEmail,
|
||||
},
|
||||
description: this.options.description,
|
||||
generator: '@pushrocks/smartfeed',
|
||||
language: "en"
|
||||
language: 'en',
|
||||
});
|
||||
|
||||
feed.addCategory(this.options.category);
|
||||
@@ -54,9 +54,11 @@ export class Feed {
|
||||
link: itemArg.url.replace(/&/gm, '&'),
|
||||
image: itemArg.imageUrl.replace(/&/gm, '&'),
|
||||
content: itemArg.content,
|
||||
author: [{
|
||||
name: itemArg.authorName
|
||||
}]
|
||||
author: [
|
||||
{
|
||||
name: itemArg.authorName,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
return feed;
|
||||
@@ -73,4 +75,4 @@ export class Feed {
|
||||
public exportJsonFeed(): string {
|
||||
return this.getFeedObject().json1();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,10 @@ export class Smartfeed {
|
||||
/**
|
||||
* creates a feed from a standardized article object (@tsclass/tsclass).content.IArticle
|
||||
*/
|
||||
public async createFeedFromArticleArray(optionsArg: IFeedOptions, articleArray: plugins.tsclass.content.IArticle[]): Promise<string> {
|
||||
public async createFeedFromArticleArray(
|
||||
optionsArg: IFeedOptions,
|
||||
articleArray: plugins.tsclass.content.IArticle[],
|
||||
): Promise<string> {
|
||||
const feed = this.createFeed(optionsArg);
|
||||
for (const article of articleArray) {
|
||||
feed.addItem({
|
||||
@@ -19,7 +22,7 @@ export class Smartfeed {
|
||||
imageUrl: article.featuredImageUrl,
|
||||
title: article.title,
|
||||
url: article.url,
|
||||
content: article.content
|
||||
content: article.content,
|
||||
});
|
||||
}
|
||||
const feedXmlString = feed.exportAtomFeed();
|
||||
@@ -45,4 +48,4 @@ export class Smartfeed {
|
||||
const resultingFeed = await parser.parseURL(urlArg);
|
||||
return resultingFeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
// tsclass scope
|
||||
import * as tsclass from '@tsclass/tsclass';
|
||||
|
||||
export {
|
||||
tsclass
|
||||
};
|
||||
export { tsclass };
|
||||
|
||||
// third party scope
|
||||
import rssParser from 'rss-parser';
|
||||
import * as feed from 'feed';
|
||||
|
||||
export {
|
||||
rssParser,
|
||||
feed
|
||||
};
|
||||
export { rssParser, feed };
|
||||
|
||||
Reference in New Issue
Block a user