From 57182c012bb9de21c71f5103b9394d5646779bef Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sun, 14 Apr 2024 17:35:04 +0200 Subject: [PATCH] update tsconfig --- npmextra.json | 18 ++++++- package.json | 15 +++++- readme.hints.md | 1 + readme.md | 123 +++++++++++++++++++++++++++++++++++++----------- 4 files changed, 126 insertions(+), 31 deletions(-) create mode 100644 readme.hints.md diff --git a/npmextra.json b/npmextra.json index d0f5a28..a15c55c 100644 --- a/npmextra.json +++ b/npmextra.json @@ -8,14 +8,28 @@ "shortDescription": "create and parse feeds", "npmPackagename": "@push.rocks/smartfeed", "license": "MIT", - "projectDomain": "push.rocks" + "projectDomain": "push.rocks", + "description": "A library for creating and parsing various feed formats.", + "keywords": [ + "RSS", + "Atom", + "feeds creation", + "feeds parsing", + "TypeScript", + "content syndication", + "RSS parser", + "feed generator", + "news feed", + "XML feeds", + "JSON feeds" + ] } }, "npmci": { "npmGlobalTools": [], "npmAccessLevel": "public" }, - "tsdocs": { + "tsdoc": { "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n" } } \ No newline at end of file diff --git a/package.json b/package.json index 3d519d0..e632082 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@push.rocks/smartfeed", "version": "1.0.11", "private": false, - "description": "create and parse feeds", + "description": "A library for creating and parsing various feed formats.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "author": "Lossless GmbH", @@ -40,5 +40,18 @@ "cli.js", "npmextra.json", "readme.md" + ], + "keywords": [ + "RSS", + "Atom", + "feeds creation", + "feeds parsing", + "TypeScript", + "content syndication", + "RSS parser", + "feed generator", + "news feed", + "XML feeds", + "JSON feeds" ] } \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/readme.hints.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.md b/readme.md index 5d33066..7c3d6bf 100644 --- a/readme.md +++ b/readme.md @@ -1,39 +1,106 @@ -# @pushrocks/smartfeed +# @push.rocks/smartfeed create and parse feeds -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartfeed) -* [gitlab.com (source)](https://gitlab.com/pushrocks/smartfeed) -* [github.com (source mirror)](https://github.com/pushrocks/smartfeed) -* [docs (typedoc)](https://pushrocks.gitlab.io/smartfeed/) +## Install +To install `@push.rocks/smartfeed`, you need to have Node.js installed on your machine. After setting up Node.js, run the following command in your terminal: -## Status for master - -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartfeed/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartfeed/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartfeed)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartfeed)](https://lossless.cloud) -TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) -node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) -Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) -PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartfeed)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartfeed)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartfeed)](https://lossless.cloud) -Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud) +```bash +npm install @push.rocks/smartfeed --save +``` ## Usage +`@push.rocks/smartfeed` is a powerful library for creating and parsing RSS and Atom feeds with ease. It leverages TypeScript for type safety and improved developer experience. Let's explore how you can utilize this library in your projects. -Use TypeScript for best in class intellisense +### Creating Feeds +You can create feeds by instantiating a `Smartfeed` object and configuring feed options and items. Here’s an example of how to create an RSS feed: -## Contribution +```typescript +import { Smartfeed, IFeedOptions, IFeedItem } from '@push.rocks/smartfeed'; -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +// Create a new Smartfeed instance +const mySmartfeed = new Smartfeed(); -For further information read the linked docs at the top of this readme. +// Define feed options +const feedOptions: IFeedOptions = { + domain: 'example.com', + title: 'Example News', + description: 'Latest news from Example', + category: 'News', + company: 'Example Company', + companyEmail: 'contact@example.com', + companyDomain: 'https://example.com', +}; -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +// Create a new feed with options +const myFeed = mySmartfeed.createFeed(feedOptions); -[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) +// Add items to the feed +const feedItem: IFeedItem = { + title: 'Breaking News: TypeScript Adoption Soars!', + timestamp: Date.now(), // Use current timestamp + url: 'https://example.com/news/typescript-adoption', + authorName: 'Jane Doe', + imageUrl: 'https://example.com/images/typescript-news.jpg', + content: 'In a recent survey, TypeScript has seen a significant increase in adoption among developers...', +}; + +// Add the item to the feed +myFeed.addItem(feedItem); + +// Export the feed as an RSS string +const rssFeedString = myFeed.exportRssFeedString(); +console.log(rssFeedString); +``` +This code snippet creates an RSS feed for a news article. You can customize the `IFeedOptions` and `IFeedItem` objects to match your content. + +### Parsing Feeds +`@push.rocks/smartfeed` also allows parsing of RSS and Atom feeds from a string or URL. Here’s how you can parse a feed: + +```typescript +import { Smartfeed } from '@push.rocks/smartfeed'; + +// Create a new Smartfeed instance +const mySmartfeed = new Smartfeed(); + +// Parsing a feed from a string +const rssString = `your RSS feed string here`; +mySmartfeed.parseFeedFromString(rssString).then(feed => { + console.log(feed); +}); + +// Parsing a feed from a URL +const feedUrl = 'https://example.com/rss'; +mySmartfeed.parseFeedFromUrl(feedUrl).then(feed => { + console.log(feed); +}); +``` + +This example demonstrates how to parse an RSS feed from a given string or URL. The `parseFeedFromString` and `parseFeedFromUrl` methods return a Promise that resolves to the parsed feed object. + +### Comprehensive Feed Management +With `@push.rocks/smartfeed`, you have full control over creating and managing feeds. Beyond basic scenarios shown above, you can create feeds from arrays of articles, customize feed and item properties extensively, and export feeds in different formats (RSS, Atom, JSON). + +For instance, to create a feed from an array of article objects conforming to `@tsclass/tsclass`'s `IArticle` interface, you can use the `createFeedFromArticleArray` method. Additionally, explore different export options available on the `Feed` class to suit your needs, whether it's RSS 2.0, Atom 1.0, or JSON Feed 1.0. + +Remember, `@push.rocks/smartfeed` is designed to streamline feed creation and parsing with a focus on type safety and developer experience. Explore its comprehensive API to leverage the full potential of feed management in your applications. + +For complete usage and all available methods, refer to the TypeScript declarations and source code available in the package. Happy coding! + +## License and Legal Information + +This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. + +**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file. + +### Trademarks + +This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH. + +### Company Information + +Task Venture Capital GmbH +Registered at District court Bremen HRB 35230 HB, Germany + +For any legal inquiries or if you require further information, please contact us via email at hello@task.vc. + +By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.