diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..1d9b783 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22.12.0 diff --git a/astro.config.mjs b/astro.config.mjs index 4b296e8..ab84f40 100755 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -35,6 +35,5 @@ export default defineConfig({ markdown: { remarkPlugins: [remarkToc, [remarkCollapse, { test: "Table of contents" }]], shikiConfig: { theme: "one-dark-pro", wrap: true }, - extendDefaultPlugins: true, }, }); diff --git a/package.json b/package.json index 06c3290..e37d61a 100755 --- a/package.json +++ b/package.json @@ -1,31 +1,33 @@ { "name": "astroplate", - "version": "5.12.1", + "version": "6.0.0", "description": "Astro and Tailwindcss boilerplate", "author": "zeon.studio", "license": "MIT", "packageManager": "yarn@1.22.22", "type": "module", "scripts": { - "dev": "concurrently \"node scripts/themeGenerator.js --watch\" \"yarn generate-json && astro dev\"", - "build": "node scripts/themeGenerator.js && yarn generate-json && astro build", + "dev": "concurrently \"node scripts/themeGenerator.js --watch\" \"node scripts/jsonGenerator.js && astro dev\"", + "build": "node scripts/themeGenerator.js && node scripts/jsonGenerator.js && astro build", "preview": "astro preview", "check": "astro check", "format": "prettier -w ./src", "generate-json": "node scripts/jsonGenerator.js", - "remove-darkmode": "node scripts/removeDarkmode.js && yarn format" + "remove-darkmode": "node scripts/removeDarkmode.js && yarn format", + "deploy:cf-workers": "npm run build && wrangler deploy", + "preview:cf-workers": "npm run build && wrangler dev" }, "dependencies": { - "@astrojs/check": "0.9.6", - "@astrojs/mdx": "4.3.13", - "@astrojs/react": "4.4.2", + "@astrojs/check": "0.9.7-beta.1", + "@astrojs/mdx": "5.0.0-beta.9", + "@astrojs/react": "5.0.0-beta.3", "@astrojs/sitemap": "3.7.0", "@digi4care/astro-google-tagmanager": "^1.6.0", "@justinribeiro/lite-youtube": "^1.9.0", - "astro": "5.17.3", + "astro": "6.0.0-beta.17", "astro-auto-import": "^0.5.1", "astro-font": "^1.1.0", - "astro-swiper": "^2.1.0", + "astro-swiper": "^2.1.1", "date-fns": "^4.1.0", "disqus-react": "^1.1.7", "github-slugger": "^2.0.0", @@ -44,7 +46,7 @@ "@tailwindcss/forms": "^0.5.11", "@tailwindcss/typography": "^0.5.19", "@tailwindcss/vite": "^4.2.1", - "@types/node": "25.3.0", + "@types/node": "25.3.3", "@types/react": "19.2.14", "@types/react-dom": "19.2.3", "concurrently": "^9.2.1", @@ -54,6 +56,7 @@ "prettier-plugin-tailwindcss": "^0.7.2", "tailwind-bootstrap-grid": "^7.0.0", "tailwindcss": "^4.2.1", - "typescript": "^5.9.3" + "typescript": "^5.9.3", + "wrangler": "^4.69.0" } } diff --git a/readme.md b/readme.md index ebdcd27..e88057d 100755 --- a/readme.md +++ b/readme.md @@ -12,8 +12,8 @@
-
-
+
+
@@ -64,13 +64,14 @@
- astro/react
- astro/sitemap
- astro/tailwind
+- Cloudflare Workers (optional deployment)
## 🚀 Getting Started
### 📦 Dependencies
-- astro v5.15+
-- node v20.10+
+- astro v6.0.0-beta+
+- node v22.12.0+ (see `.nvmrc`)
- yarn v1.22+
- tailwind v4+
@@ -92,6 +93,18 @@ yarn run dev
yarn run build
```
+### 👉 Preview on Cloudflare Workers
+
+```bash
+yarn run preview:cf-workers
+```
+
+### 👉 Deploy to Cloudflare Workers
+
+```bash
+yarn run deploy:cf-workers
+```
+
### 👉 Build and Run With Docker
```bash
diff --git a/src/content.config.ts b/src/content.config.ts
index 14e4505..7b351cb 100755
--- a/src/content.config.ts
+++ b/src/content.config.ts
@@ -1,11 +1,13 @@
import { glob } from "astro/loaders";
-import { defineCollection, z } from "astro:content";
+import { defineCollection } from "astro:content";
+import { z } from "astro/zod";
const commonFields = {
title: z.string(),
description: z.string(),
meta_title: z.string().optional(),
- date: z.date().optional(),
+ // z.coerce.date() handles both Date objects and ISO string dates from frontmatter (Zod 4)
+ date: z.coerce.date().optional(),
image: z.string().optional(),
draft: z.boolean(),
};
@@ -17,11 +19,12 @@ const blogCollection = defineCollection({
title: z.string(),
meta_title: z.string().optional(),
description: z.string().optional(),
- date: z.date().optional(),
+ date: z.coerce.date().optional(),
image: z.string().optional(),
author: z.string().default("Admin"),
- categories: z.array(z.string()).default(["others"]),
- tags: z.array(z.string()).default(["others"]),
+ // Use factory functions for mutable array defaults (Zod 4 best practice)
+ categories: z.array(z.string()).default(() => ["others"]),
+ tags: z.array(z.string()).default(() => ["others"]),
draft: z.boolean().optional(),
}),
});