Fix tcs type errors
CI Pipeline / test (20) (pull_request) Successful in 3m13s
CI Pipeline / test (18) (pull_request) Successful in 3m57s
CI Pipeline / e2e (firefox) (pull_request) Successful in 5m6s
CI Pipeline / e2e (webkit) (pull_request) Successful in 5m16s
CI Pipeline / e2e (chromium) (pull_request) Successful in 14m47s
CI Pipeline / performance (pull_request) Successful in 4m32s
CI Pipeline / storybook (pull_request) Successful in 1m35s
CI Pipeline / visual-regression (pull_request) Failing after 9m55s
CI Pipeline / lint (pull_request) Failing after 49s
CI Pipeline / build (pull_request) Successful in 1m48s

This commit is contained in:
adilallo
2025-12-11 09:05:18 -07:00
parent 92a3337aeb
commit c7e3048c09
92 changed files with 53556 additions and 915 deletions
+11 -11
View File
@@ -70,7 +70,7 @@ export function getBlogPostFiles(): string[] {
try {
const files = fs.readdirSync(contentDirectory);
return files.filter(
(file) => file.endsWith(".md") || file.endsWith(".mdx")
(file) => file.endsWith(".md") || file.endsWith(".mdx"),
);
} catch (error) {
console.error("Error reading blog content directory:", error);
@@ -94,7 +94,7 @@ export function parseBlogPost(filePath: string): BlogPost | null {
if (!validationResult.isValid) {
console.error(
`Validation errors for ${filePath}:`,
validationResult.errors
validationResult.errors,
);
return null;
}
@@ -128,7 +128,7 @@ export function getAllBlogPosts(): BlogPost[] {
.sort(
(a, b) =>
new Date(b.frontmatter.date).getTime() -
new Date(a.frontmatter.date).getTime()
new Date(a.frontmatter.date).getTime(),
); // Sort by date descending
return allPosts;
}
@@ -153,11 +153,11 @@ export function getBlogPostBySlug(slug: string): BlogPost | null {
export function getRelatedBlogPosts(
currentPostSlug: string,
relatedSlugs: string[] = [],
limit: number = 3
limit: number = 3,
): BlogPost[] {
const allPosts = getAllBlogPosts();
const filteredPosts = allPosts.filter(
(post) => post.slug !== currentPostSlug
(post) => post.slug !== currentPostSlug,
);
let related: BlogPost[] = [];
@@ -203,7 +203,7 @@ export function getAllTags(): string[] {
export function getBlogPostsByTag(tag: string): BlogPost[] {
const allPosts = getAllBlogPosts();
return allPosts.filter(
(post) => post.frontmatter.tags && post.frontmatter.tags.includes(tag)
(post) => post.frontmatter.tags && post.frontmatter.tags.includes(tag),
);
}
@@ -228,7 +228,7 @@ export function searchBlogPosts(query: string, limit: number = 10): BlogPost[] {
.includes(searchTerm);
const contentMatch = post.content.toLowerCase().includes(searchTerm);
const tagMatch = post.frontmatter.tags?.some((tag) =>
tag.toLowerCase().includes(searchTerm)
tag.toLowerCase().includes(searchTerm),
);
return titleMatch || descriptionMatch || contentMatch || tagMatch;
@@ -245,7 +245,7 @@ export function searchBlogPosts(query: string, limit: number = 10): BlogPost[] {
export function getBlogPostsByAuthor(author: string): BlogPost[] {
const allPosts = getAllBlogPosts();
return allPosts.filter(
(post) => post.frontmatter.author.toLowerCase() === author.toLowerCase()
(post) => post.frontmatter.author.toLowerCase() === author.toLowerCase(),
);
}
@@ -297,11 +297,11 @@ export function getBlogStats(): BlogStats {
1,
(new Date(allPosts[0].frontmatter.date).getTime() -
new Date(
allPosts[allPosts.length - 1].frontmatter.date
allPosts[allPosts.length - 1].frontmatter.date,
).getTime()) /
(1000 * 60 * 60 * 24 * 30)
(1000 * 60 * 60 * 24 * 30),
)) *
10
10,
) / 10
: 0,
};
+10 -11
View File
@@ -180,7 +180,6 @@ function markdownToHtml(markdown: string): string {
if (!markdown) return "";
// Normalize line endings
const GAP_TOKEN = "<GAP/>";
const src = String(markdown).replace(/\r\n?/g, "\n");
// For 3+ consecutive newlines, keep 2 for the paragraph break and
@@ -195,33 +194,33 @@ function markdownToHtml(markdown: string): string {
// Headers with IDs
.replace(
/^###### (.*$)/gim,
(m, t) => `<h6 id="${generateHeadingId(t)}">${t}</h6>`,
(_match, t) => `<h6 id="${generateHeadingId(t)}">${t}</h6>`,
)
.replace(
/^##### (.*$)/gim,
(m, t) => `<h5 id="${generateHeadingId(t)}">${t}</h5>`,
(_match, t) => `<h5 id="${generateHeadingId(t)}">${t}</h5>`,
)
.replace(
/^#### (.*$)/gim,
(m, t) => `<h4 id="${generateHeadingId(t)}">${t}</h4>`,
(_match, t) => `<h4 id="${generateHeadingId(t)}">${t}</h4>`,
)
.replace(
/^### (.*$)/gim,
(m, t) => `<h3 id="${generateHeadingId(t)}">${t}</h3>`,
(_match, t) => `<h3 id="${generateHeadingId(t)}">${t}</h3>`,
)
.replace(
/^## (.*$)/gim,
(m, t) => `<h2 id="${generateHeadingId(t)}">${t}</h2>`,
(_match, t) => `<h2 id="${generateHeadingId(t)}">${t}</h2>`,
)
.replace(
/^# (.*$)/gim,
(m, t) => `<h1 id="${generateHeadingId(t)}">${t}</h1>`,
(_match, t) => `<h1 id="${generateHeadingId(t)}">${t}</h1>`,
)
// Code fences (block) and inline code
.replace(
/```(\w+)?\n([\s\S]*?)\n```/g,
(m, lang = "", code) =>
(_match, lang = "", code) =>
`<pre><code class="language-${lang}">${code}</code></pre>`,
)
.replace(/`([^`]+)`/g, "<code>$1</code>")
@@ -233,12 +232,12 @@ function markdownToHtml(markdown: string): string {
// Links and images
.replace(
/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g,
(m, alt, src, title = "") =>
(_match, alt, src, title = "") =>
`<img alt="${alt}" src="${src}"${title ? ` title="${title}"` : ""}>`,
)
.replace(
/\[([^\]]+)\]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g,
(m, text, href, title = "") =>
(_match, text, href, title = "") =>
`<a href="${href}"${title ? ` title="${title}"` : ""}>${text}</a>`,
)
@@ -292,7 +291,7 @@ function markdownToHtml(markdown: string): string {
// Turn counted GAP tokens into explicit, styleable gap elements
.replace(
/<GAP:(\d+)\/>/g,
(m, n) =>
(_match, n) =>
`<div class="md-gap" style="--gap:${Number(
n,
)}" aria-hidden="true"></div>`,