Run lint and prettier
CI Pipeline / test (20) (pull_request) Failing after 8m5s
CI Pipeline / test (18) (pull_request) Failing after 8m36s
CI Pipeline / e2e (chromium) (pull_request) Successful in 2m32s
CI Pipeline / e2e (webkit) (pull_request) Successful in 3m40s
CI Pipeline / e2e (firefox) (pull_request) Successful in 5m43s
CI Pipeline / performance (pull_request) Failing after 3m18s
CI Pipeline / visual-regression (pull_request) Failing after 3m20s
CI Pipeline / lint (pull_request) Successful in 1m7s
CI Pipeline / storybook (pull_request) Successful in 1m32s
CI Pipeline / build (pull_request) Successful in 1m22s

This commit is contained in:
adilallo
2025-09-12 14:33:46 -06:00
parent 8daea70cb8
commit 500d2d0965
22 changed files with 237 additions and 234 deletions
+10 -10
View File
@@ -60,7 +60,7 @@ export function getBlogPostFiles() {
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);
@@ -84,7 +84,7 @@ export function parseBlogPost(filePath) {
if (!validationResult.isValid) {
console.error(
`Validation errors for ${filePath}:`,
validationResult.errors
validationResult.errors,
);
return null;
}
@@ -116,7 +116,7 @@ export function getAllBlogPosts() {
.map((fileName) => parseBlogPost(fileName))
.filter(Boolean) // Filter out nulls (invalid posts)
.sort(
(a, b) => new Date(b.frontmatter.date) - new Date(a.frontmatter.date)
(a, b) => new Date(b.frontmatter.date) - new Date(a.frontmatter.date),
); // Sort by date descending
return allPosts;
}
@@ -141,11 +141,11 @@ export function getBlogPostBySlug(slug) {
export function getRelatedBlogPosts(
currentPostSlug,
relatedSlugs = [],
limit = 3
limit = 3,
) {
const allPosts = getAllBlogPosts();
const filteredPosts = allPosts.filter(
(post) => post.slug !== currentPostSlug
(post) => post.slug !== currentPostSlug,
);
let related = [];
@@ -191,7 +191,7 @@ export function getAllTags() {
export function getBlogPostsByTag(tag) {
const allPosts = getAllBlogPosts();
return allPosts.filter(
(post) => post.frontmatter.tags && post.frontmatter.tags.includes(tag)
(post) => post.frontmatter.tags && post.frontmatter.tags.includes(tag),
);
}
@@ -216,7 +216,7 @@ export function searchBlogPosts(query, limit = 10) {
.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;
@@ -233,7 +233,7 @@ export function searchBlogPosts(query, limit = 10) {
export function getBlogPostsByAuthor(author) {
const allPosts = getAllBlogPosts();
return allPosts.filter(
(post) => post.frontmatter.author.toLowerCase() === author.toLowerCase()
(post) => post.frontmatter.author.toLowerCase() === author.toLowerCase(),
);
}
@@ -274,9 +274,9 @@ export function getBlogStats() {
1,
(new Date(allPosts[0].frontmatter.date) -
new Date(allPosts[allPosts.length - 1].frontmatter.date)) /
(1000 * 60 * 60 * 24 * 30)
(1000 * 60 * 60 * 24 * 30),
)) *
10
10,
) / 10
: 0,
};