Files
snowflake-notes/README.md
T

37 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 内部学习博客(Astro + TypeScript
基于 Astro 构建的内部学习博客。目标:严格 TypeScript、统一格式化、内容可扩展(不仅 Markdown/MDX),图片优先使用外部 OSS。
## 快速开始
- 要求:Node >= 20,包管理器使用 pnpm
- 安装依赖:`pnpm install`
- 启动开发:`pnpm dev`
常用脚本:
- 构建:`pnpm build` ;预览:`pnpm preview`
- 代码检查:`pnpm lint` ;类型检查:`pnpm typecheck`
- 格式化:`pnpm format`
## 内容与结构
- 文章与集合:`src/content/`(示例:`src/content/posts/hello-world.mdx`
- 页面与布局:`src/pages/``src/layouts/`
- 通用组件:`src/components/`(如 `Img.astro` 支持外部图床)
- 内容扩展抽象:`src/lib/content/`(为未来 Typst 等格式预留)
- 标签规范:根目录 `tags.config.yaml`(建议统一文章标签使用)
## 配置与类型
- `PUBLIC_MEDIA_BASE_URL`:外部图床前缀(避免图片入库)
- `PUBLIC_SITE_URL`:站点地址(可选,用于 canonical 等)
- 修改内容集合(src/content/config.ts)后,需在本机运行 `pnpm astro sync`Node >= 18.20.8,建议 >= 20),以生成 `.astro/types.d.ts`,否则类型可能退化为 any。
## 约定
- 严格 TypeScript:禁止 any,导出函数需显式返回类型
- 统一格式化:Prettier(含 Astro/Markdown/MDX
- 图片默认不入库,建议走外部 OSS
更多细节与约定见 `AGENTS.md`