-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@galactiks/rss): bootstrap rss package
- Loading branch information
1 parent
43b0ddb
commit a6c53a6
Showing
5 changed files
with
175 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# @galactiks/rss | ||
|
||
This package get articles from [Galactiks](https://www.galactiks.com) content and generate RSS/Atom feeds from this content. | ||
|
||
## Installation | ||
|
||
Install the `@galactiks/rss` package using your preferred package manager: | ||
|
||
```sh | ||
# npm | ||
npm i @galactiks/rss | ||
|
||
# yarn | ||
yarn add @galactiks/rss | ||
|
||
# pnpm | ||
pnpm i @galactiks/rss | ||
``` | ||
|
||
If you run into any issues, [feel free to report them to us on GitHub](https://github.com/thegalactiks/explorer/issues). | ||
|
||
## Getting started | ||
|
||
Coming soon | ||
|
||
## License | ||
|
||
MIT © [Galactiks](https://www.galactiks.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "@galactiks/rss", | ||
"version": "0.2.1", | ||
"description": "Generate RSS and Atom feeds from Galactiks content", | ||
"author": "thegalactiks", | ||
"types": "./dist/index.d.mts", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"bugs": "https://github.com/thegalactiks/explorer/issues", | ||
"homepage": "https://www.galactiks.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/thegalactiks/explorer.git", | ||
"directory": "packages/rss" | ||
}, | ||
"main": "dist/index.mjs", | ||
"scripts": { | ||
"build": "tsc -p ./tsconfig.json", | ||
"build:ci": "tsc -p ./tsconfig.json" | ||
}, | ||
"exports": { | ||
"./package.json": "./package.json", | ||
".": "./dist/index.mjs" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"keywords": [ | ||
"galactiks", | ||
"rss", | ||
"atom", | ||
"feed" | ||
], | ||
"dependencies": { | ||
"@galactiks/config": "workspace:^", | ||
"@galactiks/explorer": "workspace:^", | ||
"feed": "4.2.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { getConfig, getDefaultLanguage } from '@galactiks/config'; | ||
import { getWebPageDocumentsByType } from '@galactiks/explorer'; | ||
import { Feed } from 'feed'; | ||
|
||
const galactiksConfig = getConfig(); | ||
|
||
export async function getRSS() { | ||
const articles = await getWebPageDocumentsByType('Article'); | ||
|
||
const feed = new Feed({ | ||
title: galactiksConfig.webManifest.name, | ||
description: galactiksConfig.webManifest.description, | ||
id: galactiksConfig.name || galactiksConfig.webManifest.name, | ||
link: galactiksConfig.webManifest.start_url, | ||
language: getDefaultLanguage(), | ||
copyright: '', | ||
generator: 'Galactiks', | ||
}); | ||
|
||
articles.forEach((article) => { | ||
feed.addItem({ | ||
title: article.name, | ||
id: article.url, | ||
link: article.url, | ||
date: article.datePublished, | ||
image: article.image?.contentUrl, | ||
description: article.description, | ||
author: article.author && [ | ||
{ | ||
name: article.author.name, | ||
email: article.author.email, | ||
link: article.author.url, | ||
}, | ||
], | ||
}); | ||
}); | ||
|
||
return feed; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"include": ["src"], | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"target": "ES2021", | ||
"module": "ES2022", | ||
"outDir": "./dist" | ||
} | ||
} |
Oops, something went wrong.