Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build & Test & Check Format
name: Run Checks

on:
# Trigger the workflow every time a push is made to 'master'
Expand All @@ -24,5 +24,8 @@ jobs:
- name: Test
run: bun test

- name: Type Check
run: bun check

- name: Format Check
run: bun format:check
201 changes: 185 additions & 16 deletions bun.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"build": "astro build",
"preview": "astro preview",
"astro": "astro",
"check": "astro check",
"format": "prettier --write \"**/*.{astro,ts,tsx,md,mdx,js,cjs,mjs,jsx}\"",
"format:check": "prettier --check \"**/*.{astro,ts,tsx,md,mdx,js,cjs,mjs,jsx}\""
},
"devDependencies": {
"@astrojs/check": "^0.9.4",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/typography": "^0.5.16",
Expand Down
7 changes: 7 additions & 0 deletions src/components/global/head.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
---
import "../../styles/global.css";

type Props = {
title?: string;
description?: string;
author?: string;
image?: string;
};
const { title, description, author, image } = Astro.props;
const defaultTitle = "Ladybird";
const defaultDescription =
Expand Down
13 changes: 12 additions & 1 deletion src/components/landing/sponsors.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
---
const sponsors = [
type Sponsor = {
name: string;
href?: string;
logo?: string;
};

type SponsorTier = {
name: string;
sponsors: Sponsor[];
};

const sponsors: SponsorTier[] = [
{
name: "Platinum",
sponsors: [
Expand Down
34 changes: 25 additions & 9 deletions src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
import { z, defineCollection } from "astro:content";

const posts = defineCollection({
type: "content",
schema: z.object({
export const postSchema = z
.object({
title: z.string().max(50),
description: z.string().max(280),
author: z.string().max(50),
image: z.string().min(12),
type: z.enum(["Thoughts", "Announcement", "Hidden"]),
date: z.date(),
}),
});
})
.strict();
export type Post = z.infer<typeof postSchema>;

const newsletter = defineCollection({
const posts = defineCollection({
type: "content",
schema: z.object({
schema: postSchema,
});

export const newsletterSchema = z
.object({
title: z
.string()
.regex(
/This Month in Ladybird - \w+ \d{4}/,
'Newsletter title must be of shape: "This Month in Ladybird - <month> <year>"'
),
description: z.string().max(280),
date: z.date(),
draft: z.boolean().optional(),
}),
})
.strict();
export type Newsletter = z.infer<typeof newsletterSchema>;

const newsletters = defineCollection({
type: "content",
schema: newsletterSchema,
});

export const collections = {
posts,
newsletter,
newsletters,
};
13 changes: 0 additions & 13 deletions src/content/newsletters/2024-07-09.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions src/content/newsletters/2024-07-20.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion src/content/newsletters/2024-08-31.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - August 2024
description: ?
description: HarfBuzz text shaping and RTL, Skia powering SVG and 2D canvas, sticky positioning, drag and drop, retained display lists for faster scrolling, and console.table().
date: 2024-08-31
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2024-09-30.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - September 2024
description: ?
description: Networking via curl, better audio through FFmpeg, improved emoji support, Skia font decoding, CSS Transitions and Cascade Layers, plus GPU-accelerated masks.
date: 2024-09-30
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2024-10-31.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - October 2024
description: ?
description: Expanding our Board, stronger test infrastructure, WebAudio fixes, CSS filter support, nesting @media on the way, clip-path shapes, and our first pizza ordered with Ladybird.
date: 2024-10-31
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2024-11-30.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - November 2024
description: ?
description: Temporal rewrite, early Swift experiments, vertical text, Web Crypto API progress, CSS nesting and transform updates, color() improvements, and Editing API work.
date: 2024-11-30
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2024-12-31.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - December 2024
description: ?
description: WebGL arrives, home-grown crypto replaced with OpenSSL, WebCrypto API improvements, Canvas2D filters, smarter calc(), Switch input, and CSS font-variant features.
date: 2024-12-31
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2025-01-31.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - January 2025
description: ?
description: Major WPT progress, test262 (JS spec) improvements, early Google BotGuard support, new CSS properties, and better light/dark mode behavior.
date: 2025-01-31
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2025-02-28.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - February 2025
description: ?
description: Block rendering until CSS is ready, OpenSSL and curl adoption continues, Firefox DevTools protocol support lands, and aarch64 Linux joins CI.
date: 2025-02-28
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2025-03-31.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - March 2025
description: ?
description: Video fixes with very basic YouTube support, site isolation (process per origin), Settings UI refresh, background-blend-mode, and faster relayout from intrinsic size caching.
date: 2025-03-31
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2025-04-30.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - April 2025
description: ?
description: Big WPT gains alongside performance work, faster JavaScript function calls, Flexbox layout optimization, script-blocking style sheet handling, mix-blend-mode, and URLPattern.
date: 2025-04-30
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2025-05-31.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - May 2025
description: ?
description: We’re officially tax-exempt, new JavaScript date parser, Clipboard APIs, Transferable Streams, and an in-house BigInt implementation with LibTomMath.
date: 2025-05-31
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2025-06-30.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - June 2025
description: ?
description: Notable WPT progress, CSS logical alias properties, counters on pseudo-elements, tech() in @font-face sources, Local Storage persistence, Geolocation, and progress on Windows support.
date: 2025-06-30
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2025-07-31.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - July 2025
description: ?
description: Google reCAPTCHA now passes, high refresh rate rendering, HTTP/3 support, Trusted Types progress, @property work and UTF-16 correctness fixes.
date: 2025-07-31
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2025-08-31.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - August 2025
description: ?
description: Google Sheets support, Gamepad API, Cookie Store API, CSS Typed OM progress, layout work in grid and inline formatting, and better grapheme cluster handling.
date: 2025-08-31
draft: false
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/newsletters/2025-09-30.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: This Month in Ladybird - September 2025
description: ?
description: HTTP caching enabled by default, better CSS custom property handling, DevTools improvements, CSS Typed OM API advances, view transitions, and Trusted Types.
date: 2025-09-30
draft: false
---
Expand Down
8 changes: 8 additions & 0 deletions src/layouts/base.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
import Head from "@/components/global/head.astro";
import Navigation from "@/components/global/navigation.astro";
import Footer from "@/components/global/footer.astro";

type Props = {
title?: string;
description?: string;
author?: string;
image?: string;
children: any;
};
const { title, description, author, image } = Astro.props;
---

Expand Down
22 changes: 12 additions & 10 deletions src/layouts/newsletter.astro
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
---
import type { Newsletter } from "@/content/config";
import BaseLayout from "@/layouts/base.astro";
const { frontmatter, title, description, author, image } = Astro.props;

type Props = {
frontmatter: Newsletter;
children: any;
};
const { frontmatter } = Astro.props;
const displayDate = frontmatter.title.split(" - ")[1];
---

<BaseLayout
title={title}
description={description}
author={author}
image={image}
>
<BaseLayout title={frontmatter.title} description={frontmatter.description}>
<div class="min-h-screen">
<section class="hero hero_single">
<div class="container custom-row">
<h1 class="mx-auto text-center text-[#fff]">
This Month in <span>Ladybird</span><br />
{frontmatter.date.toLocaleString("default", { month: "long" })}
{frontmatter.date.getFullYear()}
This Month in <span>Ladybird</span>
<br />
{displayDate}
</h1>
</div>
</section>
Expand Down
16 changes: 11 additions & 5 deletions src/layouts/post.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
---
import BaseLayout from "@/layouts/base.astro";
const { frontmatter, title, description, author, image } = Astro.props;
import type { Post } from "@/content/config";

type Props = {
frontmatter: Post;
children: any;
};
const { frontmatter } = Astro.props;
---

<BaseLayout
title={title}
description={description}
author={author}
image={image}
title={frontmatter.title}
description={frontmatter.description}
author={frontmatter.author}
image={frontmatter.image}
>
<div class="min-h-screen">
<section class="hero hero_single">
Expand Down
8 changes: 1 addition & 7 deletions src/pages/newsletter/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ const { newsletter } = Astro.props;
const { Content } = await newsletter.render();
---

<Layout
frontmatter={newsletter.data}
title={newsletter.data.title}
description={newsletter.data.description}
image={newsletter.data.image}
author={newsletter.data.author}
>
<Layout frontmatter={newsletter.data}>
<Content components={markdown} />
</Layout>
8 changes: 1 addition & 7 deletions src/pages/posts/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ const { post } = Astro.props;
const { Content } = await post.render();
---

<Layout
frontmatter={post.data}
title={post.data.title}
description={post.data.description}
image={post.data.image}
author={post.data.author}
>
<Layout frontmatter={post.data}>
<Content components={markdown} />
</Layout>
30 changes: 27 additions & 3 deletions tests/newsletters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,42 @@ describe("Newsletters", () => {
.readdirSync(srcDir)
.filter((file) => file.endsWith(".mdx"));

test("Draft pages should be excluded in build", async () => {
test("Draft pages should be excluded in build", () => {
mdFiles.forEach((file) => {
const filePath = path.join(srcDir, file);
const htmlFile = file.replace(".mdx", "/index.html");
const htmlFilePath = path.join(distDir, htmlFile);

const fileContent = fs.readFileSync(filePath);
if (fileContent.toString().includes("draft: true")) {
const fileContent = fs.readFileSync(filePath, "utf-8");
if (fileContent.includes("draft: true")) {
expect(fs.existsSync(htmlFilePath)).toBe(false);
} else {
expect(fs.existsSync(htmlFilePath)).toBe(true);
}
});
});

test("Newsletters should include title and description metadata", () => {
mdFiles.forEach((file) => {
const filePath = path.join(srcDir, file);
const htmlFile = file.replace(".mdx", "/index.html");
const htmlFilePath = path.join(distDir, htmlFile);

const mdFileContent = fs.readFileSync(filePath, "utf-8");
if (!mdFileContent.includes("draft: true")) {
const htmlFileContent = fs.readFileSync(htmlFilePath, "utf-8");
const expectedTitle =
mdFileContent.match(/^title:\s*(.*)$/m)?.[1] + " - Ladybird";
const expectedDescription = mdFileContent.match(
/^description:\s*(.*)$/m
)?.[1];

const metaTitle = `<meta property="og:title" content="${expectedTitle}">`;
const metaDescription = `<meta property="og:description" content="${expectedDescription}">`;

expect(htmlFileContent).toContain(metaTitle);
expect(htmlFileContent).toContain(metaDescription);
}
});
});
});