Skip to content

Commit f95987e

Browse files
authored
chore: update files
1 parent 71b111a commit f95987e

37 files changed

Lines changed: 932 additions & 627 deletions

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,19 @@ http://127.0.0.1:4321/
4343
npm run build
4444
```
4545

46+
运行单元测试:
47+
48+
```bash
49+
npm test
50+
```
51+
4652
构建产物输出到 `dist/`
4753

4854
说明:
4955

5056
- 仓库已忽略 `node_modules/``dist/``.astro/` 等本地输出目录
5157
- 核心数据和页面内容都带构建期校验
58+
- 当前单元测试覆盖内容文件顺序和 GitHub 项目合并顺序这两类关键逻辑
5259
- 站点支持 `light``dark``system` 三种主题模式,浏览器会记住上次选择
5360

5461
## 目录结构
@@ -64,10 +71,13 @@ src/
6471
types/ 共享类型
6572
public/
6673
images/ 静态资源
74+
tests/ Node 内置测试
6775
.github/workflows/
6876
ci.yml GitHub Pages 自动部署
6977
```
7078

79+
实际测试目录为 `tests/`,使用 Node 自带的 `node:test` 运行,不额外引入测试框架。
80+
7181
## 数据分层
7282

7383
### 1. 栏目级配置
@@ -189,6 +199,7 @@ public/
189199

190200
- 博客列表按照内容文件名顺序展示,不再按日期自动重排
191201
- 如果需要调整展示顺序,直接调整文件命名顺序即可
202+
- frontmatter 中 `coverDark` 为可选字段,用于给深色模式提供独立封面图
192203

193204
### 动态
194205

@@ -326,3 +337,14 @@ links:
326337
- 新增重复 UI 时,优先抽组件,不要复制粘贴页面结构
327338
- 核心数据现在带有构建期校验,重复 key、空字段、排序冲突会在 `npm run build` 时直接报错
328339
- 涉及预览分享的页面默认带 SEO / OG 元信息,跳转页可以显式设置 `noindex`
340+
341+
## 发布前检查
342+
343+
建议发布前至少执行:
344+
345+
```bash
346+
npm test
347+
npm run build
348+
```
349+
350+
如果这两步都通过,再手动快速检查一次首页、博客、动态、研究院的移动端布局即可。

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
"dev": "astro dev",
1111
"start": "astro dev",
1212
"build": "astro build",
13-
"preview": "astro preview"
13+
"preview": "astro preview",
14+
"test": "node --test tests/*.test.ts"
1415
},
1516
"dependencies": {
1617
"astro": "^6.1.0"
1718
}
18-
}
19+
}
Lines changed: 17 additions & 0 deletions
Loading

public/images/blog/rapidai-pr.svg

Lines changed: 11 additions & 11 deletions
Loading
Lines changed: 17 additions & 0 deletions
Loading
Lines changed: 11 additions & 11 deletions
Loading

src/components/BlogList.astro

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface PostEntry {
1010
author: string;
1111
tags: string[];
1212
cover: string;
13+
coverDark?: string;
1314
};
1415
}
1516
@@ -23,10 +24,7 @@ const { posts } = Astro.props;
2324
<div class="blog-grid">
2425
{
2526
posts.map((post) => (
26-
<article class="card blog-card">
27-
<a class="blog-cover" href={withBase(`/blog/${post.id}`)}>
28-
<img src={withBase(post.data.cover)} alt={post.data.title} loading="lazy" />
29-
</a>
27+
<article class="card blog-card blog-card-compact">
3028
<div class="blog-card-body">
3129
<div class="blog-meta-row">
3230
<span class="timeline-label">{post.data.date.toISOString().slice(0, 10)}</span>

src/components/Hero.astro

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,24 @@ const { hero } = Astro.props;
2525
<div class="hero-badges">
2626
{hero.badges.map((badge) => <span>{badge}</span>)}
2727
</div>
28+
{
29+
hero.command && (
30+
<a class="hero-command" href={withBase(hero.secondaryAction.href)}>
31+
<span class="hero-command-prefix">{hero.command.label}</span>
32+
<code>{hero.command.value}</code>
33+
</a>
34+
)
35+
}
2836
</div>
29-
<div class="hero-panel">
30-
<div class="panel-grid">
31-
{
32-
hero.panels.map((panel) => (
33-
<div class:list={["mini-card", panel.accent && "mini-card-strong", panel.wide && "mini-card-wide"]}>
34-
<span>{panel.tag}</span>
35-
<strong>{panel.title}</strong>
36-
</div>
37-
))
38-
}
39-
</div>
40-
<div class="hero-panel-foot">
41-
<p>{hero.panelFoot}</p>
37+
<div class="hero-panel hero-panel-home">
38+
<div class="hero-capability-grid">
39+
{hero.panels.map((panel) => (
40+
<div class:list={["hero-capability-item", panel.accent && "hero-capability-item-strong"]}>
41+
<span>{panel.tag}</span>
42+
<strong>{panel.title}</strong>
43+
</div>
44+
))}
4245
</div>
46+
<p class="hero-panel-foot hero-panel-foot-home">{hero.panelFoot}</p>
4347
</div>
4448
</section>

src/components/PageHero.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ interface Props {
1111
description: string;
1212
themeClass?: string;
1313
panel?: HeroPanel;
14+
hideEyebrow?: boolean;
1415
}
1516
16-
const { eyebrow, title, description, themeClass = "", panel } = Astro.props;
17+
const { eyebrow, title, description, themeClass = "", panel, hideEyebrow = false } = Astro.props;
1718
const panelClass = themeClass ? `page-hero-panel-${themeClass.replace("page-hero-", "")}` : "";
1819
---
1920

2021
<section class:list={["page-hero", themeClass, !panel && "page-hero-single"]}>
2122
<div>
22-
<p class="eyebrow">{eyebrow}</p>
23+
{!hideEyebrow && eyebrow && <p class="eyebrow">{eyebrow}</p>}
2324
<h1>{title}</h1>
2425
<p>{description}</p>
2526
</div>

src/components/ProjectsShowcaseSection.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ interface Props {
1111
title: string;
1212
description: string;
1313
actions?: ActionLink[];
14+
hideEyebrow?: boolean;
1415
}
1516
16-
const { projects, limit, eyebrow, title, description, actions = [] } = Astro.props;
17+
const { projects, limit, eyebrow, title, description, actions = [], hideEyebrow = false } = Astro.props;
1718
---
1819

1920
<section class="content-section">
20-
<SectionIntro eyebrow={eyebrow} title={title} description={description} />
21+
<SectionIntro eyebrow={eyebrow} title={title} description={description} hideEyebrow={hideEyebrow} />
2122
{
2223
actions.length > 0 && (
2324
<div class:list={["section-actions", actions.length > 1 && "section-actions-dual"]}>

0 commit comments

Comments
 (0)