Skip to content

Commit fe58e33

Browse files
committed
refactor: migrate files to typescript and update config
- rename remark-reading-time from .mjs to .mts - add allowImportingTsExtensions to tsconfig - convert rss.xml.js to rss.xml.ts with type safety improvements
1 parent dfb8a74 commit fe58e33

4 files changed

Lines changed: 4 additions & 2 deletions

File tree

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import spotlightjs from '@spotlightjs/astro';
44
import mdx from '@astrojs/mdx';
55
import tailwind from '@astrojs/tailwind';
66
import sitemap from '@astrojs/sitemap';
7-
import { remarkReadingTime } from './src/utils/remark-reading-time.mjs';
7+
import { remarkReadingTime } from './src/utils/remark-reading-time.mts';
88
import htmlMinifier from './src/integrations/html-minifier.mjs';
99

1010
// https://astro.build/config
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { APIContext } from "astro";
12
import rss from '@astrojs/rss';
23
import { getCollection } from 'astro:content';
34
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
@@ -7,7 +8,7 @@ export async function GET(context: APIContext) {
78
return rss({
89
title: SITE_TITLE,
910
description: SITE_DESCRIPTION,
10-
site: context.site,
11+
site: context.site || 'https://example.com', // Provide a default or handle undefined
1112
items: posts.map((post) => ({
1213
title: post.data.title,
1314
pubDate: post.data.pubDate,

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"forceConsistentCasingInFileNames": true,
88
"strict": true,
99
"skipLibCheck": true,
10+
"allowImportingTsExtensions": true,
1011
"jsx": "react-jsx",
1112
"jsxImportSource": "react",
1213
"allowJs": true,

0 commit comments

Comments
 (0)