docs: 更新项目文档与快速开始指南

This commit is contained in:
seahi committed 2026-07-12 13:33:57 +08:00
1 parent 216cd24b44
commit e73af54b2f
1 file changed
+49 -24
+49 -24
View File
@@ -1,42 +1,67 @@
# sv
# BlogFlare
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
BlogFlare 是一个基于 **SvelteKit** 和 **Cloudflare D1** 构建的现代化、轻量级博客系统。它的设计灵感来源于 Typecho 的经典主题 VOID,旨在提供极速的访问体验和极低的托管成本。
## Creating a project
## ✨ 特性
If you're seeing this, you've probably already done this step. Congrats!
- ⚡️ **极速体验**: 采用 SvelteKit 框架,提供极致的页面加载速度和流畅的交互体验。
- ☁️ **边缘计算架构**: 完全依托于 Cloudflare 强大的全球网络。使用 Cloudflare Pages 进行前端托管,D1 数据库进行数据存储,实现真正的零运维与超低成本。
- 📝 **强大的 Markdown 支持**: 内置 Markdown 渲染引擎(结合了 `marked` 和 `highlight.js` 等),并支持代码高亮与 DoIt 风格的提示块(Admonition)。
- 🎨 **优雅的设计**: 界面灵感源自广受好评的 VOID 主题,排版舒适,注重纯粹的阅读体验。
- 🏷️ **完善的内容管理**: 包含文章发布、标签系统及用户认证的基础数据结构支持。
```sh
# create a new project
npx sv create my-app
## 🚀 快速开始
> [!IMPORTANT]
> 本项目强制使用 `pnpm` 作为包管理器,请勿使用 `npm` 或 `yarn`。
### 1. 克隆项目与安装依赖
```bash
git clone git@git.seahi.me:seahi/blogflare.git
cd blogflare
pnpm install
```
To recreate this project with the same configuration:
### 2. 初始化本地数据库
```sh
# recreate this project
npx sv@0.16.2 create --template minimal --types ts --add prettier eslint sveltekit-adapter="adapter:cloudflare+cfTarget:pages" mdsvex --no-install .
本项目在本地开发时依赖 Wrangler 模拟 D1 数据库环境。请运行以下命令初始化数据库表和测试数据:
```bash
pnpm dlx wrangler d1 execute blogflare-db --local --file=./schema.sql
```
## Developing
### 3. 启动本地开发服务器
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
```bash
pnpm run dev
```sh
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
# 或者启动服务器并在浏览器中自动打开
pnpm run dev -- --open
```
## Building
## 📦 构建与部署
To create a production version of your app:
### 构建项目
```sh
npm run build
```bash
pnpm run build
```
You can preview the production build with `npm run preview`.
你可以使用 `pnpm run preview` 来预览生成的生产版本构建。
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
### 部署到 Cloudflare
项目已经配置了 `@sveltejs/adapter-cloudflare`,可以通过连接 GitHub/GitLab 仓库到 Cloudflare Pages 实现自动构建部署,或者使用 Wrangler CLI 进行手动发布:
```bash
pnpm dlx wrangler pages deploy .svelte-kit/cloudflare
```
*(注意:正式部署前请确保在 Cloudflare 仪表盘中创建了对应的 D1 数据库,并绑定到项目中)*
## 🛠️ 核心技术栈
- [SvelteKit](https://kit.svelte.dev/)
- [Cloudflare Pages](https://pages.cloudflare.com/) & [Cloudflare D1](https://developers.cloudflare.com/d1/)
- [Vite](https://vitejs.dev/)
- Markdown 解析: `marked`, `highlight.js`, `dompurify`, `mdsvex`