Skip to content

Commit baa0e09

Browse files
authored
Upgrade to Astro v6 (#234)
1 parent 5ec480c commit baa0e09

8 files changed

Lines changed: 310 additions & 198 deletions

File tree

astro.config.mjs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @ts-check
22

3+
import { rm } from "node:fs/promises";
34
import { fileURLToPath } from "node:url";
45
import mdx from "@astrojs/mdx";
56
import sitemap from "@astrojs/sitemap";
@@ -11,14 +12,29 @@ import { remarkMermaidAscii } from "./src/plugins/remark-mermaid-ascii.ts";
1112
import cloudflare from "@astrojs/cloudflare";
1213
import sentry from "@sentry/astro";
1314

15+
/**
16+
* Vite plugin that removes public/assets from the build output. These files
17+
* are served externally and would otherwise cause miniflare to reject the
18+
* build (e.g. files exceeding Cloudflare's 25 MiB asset size limit).
19+
*/
20+
function excludePublicAssets() {
21+
return {
22+
name: "exclude-public-assets",
23+
enforce: "post",
24+
async closeBundle() {
25+
const assetsDir = fileURLToPath(
26+
new URL("./dist/client/assets", import.meta.url),
27+
);
28+
await rm(assetsDir, { recursive: true, force: true });
29+
},
30+
};
31+
}
32+
1433
// https://astro.build/config
1534
export default defineConfig({
1635
site: "https://just-be.dev",
1736
output: "static",
1837
adapter: cloudflare(),
19-
experimental: {
20-
liveContentCollections: true,
21-
},
2238
integrations: [
2339
sentry({
2440
dsn: process.env.PUBLIC_SENTRY_DSN,
@@ -39,6 +55,7 @@ export default defineConfig({
3955
UnoCSS(),
4056
],
4157
vite: {
58+
plugins: [excludePublicAssets()],
4259
resolve: {
4360
alias: {
4461
"@": fileURLToPath(new URL("./src", import.meta.url)),

bun.lock

Lines changed: 262 additions & 182 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bunfig.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
[install]
22
# Only install package versions published at least 7 days ago
3-
minimumReleaseAge = 604800
3+
minimumReleaseAge = 259200
4+
5+
minimumReleaseAgeExcludes = [
6+
"@types/bun",
7+
"typescript",
8+
"astro",
9+
"@astrojs/cloudflare",
10+
"@astrojs/internal-helpers",
11+
"@astrojs/markdown-remark",
12+
"@astrojs/mdx",
13+
"@astrojs/prism",
14+
"@astrojs/rss",
15+
"@astrojs/sitemap",
16+
"@astrojs/underscore-redirects",
17+
]

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
},
3030
"dependencies": {
3131
"@ascorbic/feed-loader": "^2.0.1",
32-
"@astrojs/cloudflare": "^12.6.12",
33-
"@astrojs/mdx": "^4.3.12",
34-
"@astrojs/rss": "^4.0.14",
35-
"@astrojs/sitemap": "^3.6.0",
32+
"@astrojs/cloudflare": "13.1.1",
33+
"@astrojs/mdx": "5.0.0",
34+
"@astrojs/rss": "4.0.17",
35+
"@astrojs/sitemap": "3.7.1",
3636
"@iconify-json/pixel": "^1.2.1",
3737
"@sentry/astro": "^10.30.0",
3838
"@types/p5": "^1.7.6",
3939
"@webtui/css": "^0.1.5",
40-
"astro": "^5.16.3",
40+
"astro": "6.0.4",
4141
"beautiful-mermaid": "^0.1.3",
4242
"marked": "^17.0.1",
4343
"mdast-util-mdx-jsx": "^3.2.0",

services/wildcard/src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ function addCorsHeaders(response: Response, request: Request): Response {
2121
const originUrl = new URL(origin);
2222
const hostname = originUrl.hostname;
2323

24-
// Allow just-be.dev, *.just-be.dev, and *.just-be.workers.dev (for preview deployments)
24+
// Allow just-be.dev, *.just-be.dev, *.just-be.workers.dev, and localhost (dev)
2525
const isAllowed =
2626
hostname === "just-be.dev" ||
2727
hostname.endsWith(".just-be.dev") ||
28-
hostname.endsWith(".just-be.workers.dev");
28+
hostname.endsWith(".just-be.workers.dev") ||
29+
hostname === "localhost";
2930

3031
if (isAllowed) {
3132
const headers = new Headers(response.headers);
@@ -53,11 +54,12 @@ export default {
5354
const originUrl = new URL(origin);
5455
const hostname = originUrl.hostname;
5556

56-
// Allow just-be.dev, *.just-be.dev, and *.just-be.workers.dev (for preview deployments)
57+
// Allow just-be.dev, *.just-be.dev, *.just-be.workers.dev, and localhost (dev)
5758
const isAllowed =
5859
hostname === "just-be.dev" ||
5960
hostname.endsWith(".just-be.dev") ||
60-
hostname.endsWith(".just-be.workers.dev");
61+
hostname.endsWith(".just-be.workers.dev") ||
62+
hostname === "localhost";
6163

6264
if (isAllowed) {
6365
return new Response(null, {

src/content/schemas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { z } from "astro:content";
1+
import { z } from "astro/zod";
22

33
export const blogSchema = z.object({
44
title: z.string(),

src/live.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineLiveCollection } from "astro:content";
2-
import { z } from "astro:content";
2+
import { z } from "astro/zod";
33
import { githubReadmeLoader } from "./loaders/github-readme";
44

55
const readme = defineLiveCollection({

wrangler.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name = "just-be-dev"
2-
main = "dist/_worker.js/index.js"
32
compatibility_date = "2025-12-15"
43
compatibility_flags = ["nodejs_compat", "global_fetch_strictly_public"]
54

0 commit comments

Comments
 (0)