|
1 | | -# Astro Starter Kit: Minimal |
| 1 | +# :globe_with_meridians: wwdc-quick-look Web |
2 | 2 |
|
3 | | -```sh |
4 | | -npm create astro@latest -- --template minimal |
| 3 | +Astro 构建的 wwdc-quick-look 静态站点,部署在 Cloudflare Pages。 |
| 4 | + |
| 5 | +## 开发 |
| 6 | + |
| 7 | +```bash |
| 8 | +cd web |
| 9 | +npm install |
| 10 | +npm run dev # localhost:4321 |
| 11 | +npm run build # 输出到 web/dist/ |
| 12 | +npm run preview # 本地预览构建结果 |
5 | 13 | ``` |
6 | 14 |
|
7 | | -> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun! |
| 15 | +## 部署 |
8 | 16 |
|
9 | | -## 🚀 Project Structure |
| 17 | +推送至 `main` 分支且变更涉及 `web/**` 路径时,GitHub Actions 会自动构建并部署到 Cloudflare Pages。 |
10 | 18 |
|
11 | | -Inside of your Astro project, you'll see the following folders and files: |
| 19 | +也可手动触发:在 GitHub 仓库 → Actions → "Deploy Web to Cloudflare Pages" → Run workflow。 |
12 | 20 |
|
13 | | -```text |
14 | | -/ |
15 | | -├── public/ |
16 | | -├── src/ |
17 | | -│ └── pages/ |
18 | | -│ └── index.astro |
19 | | -└── package.json |
20 | | -``` |
| 21 | +### 必需的 Secrets |
21 | 22 |
|
22 | | -Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. |
| 23 | +在仓库 Settings → Secrets and variables → Actions 中配置: |
23 | 24 |
|
24 | | -There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. |
| 25 | +| Secret | 说明 | |
| 26 | +|--------|------| |
| 27 | +| `CLOUDFLARE_API_TOKEN` | Cloudflare API Token(需包含 `Cloudflare Pages:Edit` 权限) | |
| 28 | +| `CLOUDFLARE_ACCOUNT_ID` | Cloudflare Account ID | |
25 | 29 |
|
26 | | -Any static assets, like images, can be placed in the `public/` directory. |
| 30 | +获取方式: |
| 31 | +- **API Token**: Cloudflare Dashboard → My Profile → API Tokens → Create Token → 使用 "Custom token" 模板,权限添加 `Zone:Read` 和 `Cloudflare Pages:Edit` |
| 32 | +- **Account ID**: Cloudflare Dashboard 右侧边栏可见 |
27 | 33 |
|
28 | | -## 🧞 Commands |
| 34 | +### 首次创建 Pages 项目 |
29 | 35 |
|
30 | | -All commands are run from the root of the project, from a terminal: |
| 36 | +若 Cloudflare Pages 上尚未创建 `wwdc-quick-look` 项目,可通过 Wrangler CLI 创建: |
31 | 37 |
|
32 | | -| Command | Action | |
33 | | -| :------------------------ | :----------------------------------------------- | |
34 | | -| `npm install` | Installs dependencies | |
35 | | -| `npm run dev` | Starts local dev server at `localhost:4321` | |
36 | | -| `npm run build` | Build your production site to `./dist/` | |
37 | | -| `npm run preview` | Preview your build locally, before deploying | |
38 | | -| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | |
39 | | -| `npm run astro -- --help` | Get help using the Astro CLI | |
| 38 | +```bash |
| 39 | +npx wrangler pages project create wwdc-quick-look --production-branch=main |
| 40 | +``` |
40 | 41 |
|
41 | | -## 👀 Want to learn more? |
| 42 | +## 项目结构 |
42 | 43 |
|
43 | | -Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat). |
| 44 | +``` |
| 45 | +web/ |
| 46 | +├── public/ # 静态资源(favicon、图片等) |
| 47 | +├── src/ |
| 48 | +│ ├── components/ # Astro 组件 |
| 49 | +│ ├── layouts/ # 页面布局 |
| 50 | +│ ├── pages/ # 路由页面 |
| 51 | +│ ├── content/ # MDX 文章集合 |
| 52 | +│ └── i18n/ # 文案配置 |
| 53 | +├── astro.config.mjs # Astro 配置 |
| 54 | +└── package.json |
| 55 | +``` |
0 commit comments