diff --git a/packages/adapters/astro/package.json b/packages/adapters/astro/package.json index b02c3d94..ab0de48b 100644 --- a/packages/adapters/astro/package.json +++ b/packages/adapters/astro/package.json @@ -49,6 +49,7 @@ "peerDependencies": { "@astrojs/partytown": "2.0.4", "@astrojs/react": "3.0.10", + "@astrojs/rss": "4.0.5", "@astrojs/sitemap": "3.0.5", "astro": "4.3.5", "astro-critters": "2.0.11", @@ -57,6 +58,7 @@ "devDependencies": { "@astrojs/partytown": "2.0.4", "@astrojs/react": "3.0.10", + "@astrojs/rss": "4.0.5", "@astrojs/sitemap": "3.0.5", "@types/debug": "4.1.12", "@types/react": "18.2.55", diff --git a/packages/adapters/astro/src/index.mts b/packages/adapters/astro/src/index.mts index 3fb4fb0a..f3a2a86c 100644 --- a/packages/adapters/astro/src/index.mts +++ b/packages/adapters/astro/src/index.mts @@ -13,6 +13,7 @@ import { join } from 'path'; export { getI18nConfig } from './i18n.mjs'; export { getStaticPaths, getIndexPage } from './pages.mjs'; export { integrationsPreset } from './preset.mjs'; +export { getRSS } from './rss.mjs'; type GalactiksOptions = { content?: { diff --git a/packages/adapters/astro/src/rss.mts b/packages/adapters/astro/src/rss.mts new file mode 100644 index 00000000..f11f05e7 --- /dev/null +++ b/packages/adapters/astro/src/rss.mts @@ -0,0 +1,31 @@ + +import rss, { type RSSFeedItem } from '@astrojs/rss'; +import { getConfig } from '@galactiks/config'; +import { getWebPageDocumentsByType } from '@galactiks/explorer'; +import type { APIContext } from 'astro'; +import Debug from 'debug'; + +const debug = Debug('@galactiks/astro-integration:rss'); + +export async function getRSS(context: APIContext) { + const config = getConfig(); + const articles = await getWebPageDocumentsByType('Article'); + + const items: RSSFeedItem[] = articles.map(item => { + debug('generating rss item', item); + + return { + title: item.name, + description: item.description, + link: item.url, + pubDate: item.datePublished, + }; + }); + + return rss({ + title: config.webManifest.name, + description: config.webManifest.description, + site: context.site ? context.site.toString() : '', + items, + }); +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e128f708..74021e9d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,9 +1,5 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: false - excludeLinksFromLockfile: false - overrides: '@opentelemetry/api': 1.4.1 '@opentelemetry/core': 1.13.0 @@ -78,6 +74,9 @@ importers: '@astrojs/react': specifier: 3.0.10 version: 3.0.10(@types/react-dom@18.2.19)(@types/react@18.2.55)(react-dom@18.2.0)(react@18.2.0) + '@astrojs/rss': + specifier: 4.0.5 + version: 4.0.5 '@astrojs/sitemap': specifier: 3.0.5 version: 3.0.5 @@ -183,6 +182,18 @@ importers: specifier: 1.1.2 version: 1.1.2(typescript@5.3.3) + packages/rss: + dependencies: + '@galactiks/config': + specifier: workspace:^ + version: link:../config + '@galactiks/explorer': + specifier: workspace:^ + version: link:../explorer + feed: + specifier: 4.2.2 + version: 4.2.2 + packages: /@aashutoshrathi/word-wrap@1.2.6: @@ -265,6 +276,13 @@ packages: - vite dev: true + /@astrojs/rss@4.0.5: + resolution: {integrity: sha512-IyJVL6z09AQtxbgLaAwebT3T5YKe4oTHDesqydJv1KLHw+zEzzMCFuuNsEyxjiqu7df9+DDCpDXLj/WRiEUXvw==} + dependencies: + fast-xml-parser: 4.3.4 + kleur: 4.1.5 + dev: true + /@astrojs/sitemap@3.0.5: resolution: {integrity: sha512-60eLzNjMza3ABypiQPUC6ElOSZNZeY5CwSwgJ03hfeonl+Db9x12CCzBFdTw7A5Mq+O54xEZVUrR0tB+yWgX8w==} dependencies: @@ -881,10 +899,10 @@ packages: resolution: {integrity: sha512-47gAg0O2pW5Jlo86jfzjdkwL5a7Bzb+Kj5WTmdu4CxYRfWn9ytKjuuYIfsNDW8neuhdKzn+P5wCddgEh0glYyQ==} peerDependencies: '@effect-ts/core': ^0.60.2 - '@opentelemetry/api': 1.4.1 - '@opentelemetry/core': 1.13.0 - '@opentelemetry/exporter-trace-otlp-grpc': 0.39.1 - '@opentelemetry/sdk-trace-base': 1.13.0 + '@opentelemetry/api': ^1.4.0 + '@opentelemetry/core': ^1.13.0 + '@opentelemetry/exporter-trace-otlp-grpc': ^0.39.0 + '@opentelemetry/sdk-trace-base': ^1.13.0 dependencies: '@effect-ts/core': 0.60.5 '@effect-ts/otel': 0.15.1(@effect-ts/core@0.60.5)(@opentelemetry/api@1.4.1)(@opentelemetry/core@1.13.0)(@opentelemetry/sdk-trace-base@1.13.0) @@ -898,10 +916,10 @@ packages: resolution: {integrity: sha512-a2sF0ylmn8xOJs8fNeT/spJ1gUcsksAJCALxo9WOfuTCMtTwMVtVhCKEPEeQoL7wFqU+JgPkVdP91+FJ/Rkeow==} peerDependencies: '@effect-ts/core': ^0.60.2 - '@opentelemetry/api': 1.4.1 - '@opentelemetry/core': 1.13.0 - '@opentelemetry/sdk-trace-base': 1.13.0 - '@opentelemetry/sdk-trace-node': 1.13.0 + '@opentelemetry/api': ^1.4.0 + '@opentelemetry/core': ^1.13.0 + '@opentelemetry/sdk-trace-base': ^1.13.0 + '@opentelemetry/sdk-trace-node': ^1.13.0 dependencies: '@effect-ts/core': 0.60.5 '@effect-ts/otel': 0.15.1(@effect-ts/core@0.60.5)(@opentelemetry/api@1.4.1)(@opentelemetry/core@1.13.0)(@opentelemetry/sdk-trace-base@1.13.0) @@ -915,9 +933,9 @@ packages: resolution: {integrity: sha512-AmZJHl7t0+Peh7Yb2+hqn6r9+rd9/UfeA4AMV9h0YGTdOyouyFfD3wzWlxnAUzAQ4Lrod4kC7Noruret4EpqpA==} peerDependencies: '@effect-ts/core': ^0.60.2 - '@opentelemetry/api': 1.4.1 - '@opentelemetry/core': 1.13.0 - '@opentelemetry/sdk-trace-base': 1.13.0 + '@opentelemetry/api': ^1.4.0 + '@opentelemetry/core': ^1.13.0 + '@opentelemetry/sdk-trace-base': ^1.13.0 dependencies: '@effect-ts/core': 0.60.5 '@opentelemetry/api': 1.4.1 @@ -1829,7 +1847,7 @@ packages: resolution: {integrity: sha512-pS5fU4lrRjOIPZQqA2V1SUM9QUFXbO+8flubAiy6ntLjnAjJJUdRFOUOxK6v86ZHI2p2S8A0vD0BTu95FZYvjA==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': '>=1.0.0 <1.5.0' dependencies: '@opentelemetry/api': 1.4.1 dev: true @@ -1838,7 +1856,7 @@ packages: resolution: {integrity: sha512-2dBX3Sj99H96uwJKvc2w9NOiNgbvAO6mOFJFramNkKfS9O4Um+VWgpnlAazoYjT6kUJ1MP70KQ5ngD4ed+4NUw==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': '>=1.0.0 <1.5.0' dependencies: '@opentelemetry/api': 1.4.1 '@opentelemetry/semantic-conventions': 1.13.0 @@ -1848,7 +1866,7 @@ packages: resolution: {integrity: sha512-l5RhLKx6U+yuLhMrtgavTDthX50E1mZM3/SSySC7OPZiArFHV/b/9x9jxAzrOgIQUDxyj4N0V9aLKSA2t7Qzxg==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': ^1.0.0 dependencies: '@grpc/grpc-js': 1.8.18 '@opentelemetry/api': 1.4.1 @@ -1863,7 +1881,7 @@ packages: resolution: {integrity: sha512-Pv5X8fbi6jD/RJBePyn7MnCSuE6MbPB6dl+7YYBWJ5RcMGYMwvLXjd4h2jWsPV2TSUg38H/RoSP0aXvQ06Y7iw==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': ^1.0.0 dependencies: '@opentelemetry/api': 1.4.1 '@opentelemetry/core': 1.13.0(@opentelemetry/api@1.4.1) @@ -1873,7 +1891,7 @@ packages: resolution: {integrity: sha512-u3ErFRQqQFKjjIMuwLWxz/tLPYInfmiAmSy//fGSCzCh2ZdJgqQjMOAxBgqFtCF2xFL+OmMhyuC2ThMzceGRWA==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': ^1.0.0 dependencies: '@grpc/grpc-js': 1.8.18 '@opentelemetry/api': 1.4.1 @@ -1886,7 +1904,7 @@ packages: resolution: {integrity: sha512-0hgVnXXz5efI382B/24NxD4b6Zxlh7nxCdJkxkdmQMbn0yRiwoq/ZT+QG8eUL6JNzsBAV1WJlF5aJNsL8skHvw==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': '>=1.3.0 <1.5.0' dependencies: '@opentelemetry/api': 1.4.1 '@opentelemetry/api-logs': 0.39.1 @@ -1901,7 +1919,7 @@ packages: resolution: {integrity: sha512-HOo91EI4UbuG8xQVLFziTzrcIn0MJQhy8m9jorh8aonb94jFVFi3CFNIiAnIGOabmnshJLOABxpYXsiPB8Xnzg==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': '>=1.0.0 <1.5.0' dependencies: '@opentelemetry/api': 1.4.1 '@opentelemetry/core': 1.13.0(@opentelemetry/api@1.4.1) @@ -1911,7 +1929,7 @@ packages: resolution: {integrity: sha512-IV9TO+u1Jzm9mUDAD3gyXf89eyvgEJUY1t+GB5QmS4wjVeWrSMUtD0JjH3yG9SNqkrQOqOGJq7YUSSetW+Lf5Q==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': '>=1.0.0 <1.5.0' dependencies: '@opentelemetry/api': 1.4.1 '@opentelemetry/core': 1.13.0(@opentelemetry/api@1.4.1) @@ -1921,7 +1939,7 @@ packages: resolution: {integrity: sha512-euqjOkiN6xhjE//0vQYGvbStxoD/WWQRhDiO0OTLlnLBO9Yw2Gd/VoSx2H+svsebjzYk5OxLuREBmcdw6rbUNg==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': '>=1.0.0 <1.5.0' dependencies: '@opentelemetry/api': 1.4.1 '@opentelemetry/core': 1.13.0(@opentelemetry/api@1.4.1) @@ -1932,7 +1950,7 @@ packages: resolution: {integrity: sha512-/gmgKfZ1ZVFporKuwsewqIyvaUIGpv76JZ7lBpHQQPb37IMpaXO6pdqFI4ebHAWfNIm3akMyhmdtzivcgF3lgw==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': '>=1.4.0 <1.5.0' '@opentelemetry/api-logs': '>=0.38.0' dependencies: '@opentelemetry/api': 1.4.1 @@ -1945,7 +1963,7 @@ packages: resolution: {integrity: sha512-MOjZX6AnSOqLliCcZUrb+DQKjAWXBiGeICGbHAGe5w0BB18PJIeIo995lO5JSaFfHpmUMgJButTPfJJD27W3Vg==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': '>=1.3.0 <1.5.0' dependencies: '@opentelemetry/api': 1.4.1 '@opentelemetry/core': 1.13.0(@opentelemetry/api@1.4.1) @@ -1957,7 +1975,7 @@ packages: resolution: {integrity: sha512-moTiQtc0uPR1hQLt6gLDJH9IIkeBhgRb71OKjNHZPE1VF45fHtD6nBDi5J/DkTHTwYP5X3kBJLa3xN7ub6J4eg==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': '>=1.0.0 <1.5.0' dependencies: '@opentelemetry/api': 1.4.1 '@opentelemetry/core': 1.13.0(@opentelemetry/api@1.4.1) @@ -1969,7 +1987,7 @@ packages: resolution: {integrity: sha512-FXA85lXKTsnbOflA/TBuBf2pmhD3c8uDjNjG0YqK+ap8UayfALmfJhf+aG1yBOUHevCY0JXJ4/xtbXExxpsMog==} engines: {node: '>=14'} peerDependencies: - '@opentelemetry/api': 1.4.1 + '@opentelemetry/api': '>=1.0.0 <1.5.0' dependencies: '@opentelemetry/api': 1.4.1 '@opentelemetry/context-async-hooks': 1.13.0(@opentelemetry/api@1.4.1) @@ -3957,6 +3975,13 @@ packages: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} dev: true + /fast-xml-parser@4.3.4: + resolution: {integrity: sha512-utnwm92SyozgA3hhH2I8qldf2lBqm6qHOICawRNRFu1qMe3+oqr+GcXjGqTmXTMGE5T4eC03kr/rlh5C1IRdZA==} + hasBin: true + dependencies: + strnum: 1.0.5 + dev: true + /fastq@1.15.0: resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} dependencies: @@ -3968,6 +3993,13 @@ packages: dependencies: format: 0.2.2 + /feed@4.2.2: + resolution: {integrity: sha512-u5/sxGfiMfZNtJ3OvQpXcvotFpYkL0n9u9mM2vkui2nGo8b4wvDkJ8gAkYqbA8QpGyFCv3RK0Z+Iv+9veCS9bQ==} + engines: {node: '>=0.4.0'} + dependencies: + xml-js: 1.6.11 + dev: false + /fetch-blob@3.2.0: resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} engines: {node: ^12.20 || >= 14.13} @@ -7238,7 +7270,6 @@ packages: /sax@1.2.4: resolution: {integrity: sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==} - dev: true /scheduler@0.23.0: resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==} @@ -7638,6 +7669,10 @@ packages: engines: {node: '>=8'} dev: true + /strnum@1.0.5: + resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} + dev: true + /style-to-object@0.4.1: resolution: {integrity: sha512-HFpbb5gr2ypci7Qw+IOhnP2zOU7e77b+rzM+wTzXzfi1PrtBCX0E7Pk4wL4iTLnhzZ+JgEGAhX81ebTg/aYjQw==} dependencies: @@ -8391,6 +8426,13 @@ packages: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} dev: true + /xml-js@1.6.11: + resolution: {integrity: sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==} + hasBin: true + dependencies: + sax: 1.2.4 + dev: false + /xtend@4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} @@ -8501,3 +8543,7 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} + +settings: + autoInstallPeers: false + excludeLinksFromLockfile: false