Skip to content
Merged

new #14

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,43 @@ EdgeOne 构建阶段会按仓库中的 `.nvmrc` 切换 Node 版本。若控制
2. **自建仓库**:在 EdgeOne 控制台选择与 `.nvmrc` **完全一致**的 Node 版本;仍失败时检查构建日志是否仍在读取旧的 `.nvmrc`(需推送后再构建)。
3. `package.json` 中 `engines.node` 为 `>=20 <25`,在 Node 20 系列内均可构建;关键是 **构建环境实际安装的版本**能解析 `.nvmrc`。

**兼容尝试(按顺序,任选其一即可,不必全做):**

| 尝试 | 做法 |
|------|------|
| A. 对齐补丁号 | 打开 EdgeOne **项目设置 → Node.js 版本**,选择与仓库根目录 **`.nvmrc` 完全一致**的一项(例如均为 `20.18.0`),保存后 **重新部署**。 |
| B. 改自建 fork | 若平台下拉列表**没有**当前 `.nvmrc` 里的补丁号:把 fork 里的 `.nvmrc` 改成平台**已有**的某一档(仍为 Node 20 即可),推送后再构建。 |
| C. 清缓存 / 换分支 | 确认构建日志里 **Switching node** 读到的版本已更新;关闭「使用构建缓存」或触发一次无缓存构建,排除旧 `.nvmrc` 缓存。 |
| D. `engines` 报错时 | 若日志是 **Yarn does not satisfy engine** 而非 **Switching node**:在构建环境设 `YARN_IGNORE_ENGINES=1`(仅当确为 engines 校验问题时使用)。 |
| E. 不要用「只写 major」** | 少数平台不支持 `.nvmrc` 仅写 `20`;若遇解析错误,改为 **`20.18.0`** 这类完整补丁号。 |

说明:Next.js 14 与当前依赖不要求锁在某一补丁版本;**兼容的核心是「平台实际能装上的 Node」与「`.nvmrc` / 控制台选择」一致**。

构建命令与静态导出等与其它平台相同,按需配置环境变量(至少 `NOTION_PAGE_ID`)。

### `yarn install` 报 `ENOSPC: no space left on device`

与 **Node 版本** 无关(日志里已出现 `Now, we're on node version v20.18.0` 即表示切换成功)。错误 **`ENOSPC`** 表示构建机 **磁盘或 `/dev/shm`(内存盘)空间不足**,在安装依赖从 cache 拷贝到 `node_modules` 时写满。

**可尝试:**

1. **向 EdgeOne / 腾讯云工单反馈**:说明构建任务在 `yarn install` 阶段 `ENOSPC`,申请更大构建盘或确认是否为平台侧临时配额。
2. **减少单次写入体积**(若控制台支持自定义安装命令):
- 使用 `yarn install --frozen-lockfile --prefer-offline` 且**开启依赖缓存**(命中缓存时少下载);或
- 在构建前增加 `yarn cache clean`(会多下载,仅当怀疑缓存损坏时尝试,**不一定**缓解 ENOSPC)。
3. **自定义 Yarn 缓存目录**(若平台文档支持挂载更大分区):设置环境变量 **`YARN_CACHE_FOLDER`** 到有足够剩余空间的路径(具体以 EdgeOne 构建环境说明为准)。
4. **换构建方案**:在磁盘更大的 CI(如 GitHub Actions)完成 `yarn build` / `next build`,将产物同步到 EdgeOne(仅静态托管),绕过 Pages 内置构建机容量限制。

**备选:怀疑「构建/文件缓存」把空间占满时**

| 做法 | 适用阶段 | 说明 |
|------|----------|------|
| **关闭 EdgeOne「依赖/构建缓存」再构建** | `yarn install` 前后 | 若平台在恢复缓存后又解压一份 `node_modules`,可能出现「缓存 + 工作区」双份占用 **`/dev/shm`**。在控制台**关闭缓存恢复**后重试(构建会变慢,但有时能腾出空间;视平台实现而定)。 |
| **`YARN_CACHE_FOLDER` 指到大磁盘路径** | `yarn install` | 避免 Yarn 默认缓存与仓库同落在小容量分区;路径以 **EdgeOne 官方文档** 为准。 |
| **构建环境变量 `ENABLE_CACHE=false`** | **`next build` 阶段** | 关闭 Notion 数据**读**盘缓存为主,会**增加 Notion 请求与耗时**;**锁文件/会话目录仍可能写入**。对日志里 **`yarn install` 拷贝 `node_modules` 即失败**的 ENOSPC **通常无效**,因尚未执行到 Next 构建。 |

仓库本身无法通过改 `package.json` 消除平台磁盘上限;根本解决依赖 **构建环境配额** 或 **外置构建**。

## Docker 部署

### Dockerfile
Expand Down
4 changes: 4 additions & 0 deletions conf/themeSwitch.manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export const THEME_SWITCH_MANIFEST = {
claude: {
name: 'Claude',
summary: '类 Claude Docs 的文档与终端氛围。'
},
thoughtlite: {
name: 'ThoughtLite',
summary: '轻阅读向时间线与 Latest 卡片,单列列表与文章卡片排版。'
}
}

Expand Down
1 change: 1 addition & 0 deletions docs/themes/README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This directory centralizes documentation for all themes, including design intent
| Claude | [CLAUDE.en.md](./CLAUDE.en.md) | [CLAUDE.md](./CLAUDE.md) |
| Endspace | [ENDSPACE.en.md](./ENDSPACE.en.md) | [ENDSPACE.md](./ENDSPACE.md) |
| Fuwari | [FUWARI.md](./FUWARI.md) | [FUWARI.md](./FUWARI.md) |
| ThoughtLite (WIP) | [THOUGHTLITE.en.md](./THOUGHTLITE.en.md) | [THOUGHTLITE.md](./THOUGHTLITE.md) · [plan (zh)](./THOUGHTLITE_MIGRATION_PLAN.zh-CN.md) |

## Maintenance Rules

Expand Down
1 change: 1 addition & 0 deletions docs/themes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
| Claude | [CLAUDE.md](./CLAUDE.md) | [CLAUDE.en.md](./CLAUDE.en.md) |
| Endspace | [ENDSPACE.md](./ENDSPACE.md) | [ENDSPACE.en.md](./ENDSPACE.en.md) |
| Fuwari | [FUWARI.md](./FUWARI.md) | [FUWARI.md](./FUWARI.md) |
| ThoughtLite(移植中) | [THOUGHTLITE.md](./THOUGHTLITE.md) | [THOUGHTLITE.en.md](./THOUGHTLITE.en.md) · [迁移计划](./THOUGHTLITE_MIGRATION_PLAN.zh-CN.md) |

## 维护约定

Expand Down
104 changes: 104 additions & 0 deletions docs/themes/THOUGHTLITE.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# ThoughtLite theme (NotionNext)

[中文](./THOUGHTLITE.md) | Task plan (Chinese): [THOUGHTLITE_MIGRATION_PLAN.zh-CN.md](./THOUGHTLITE_MIGRATION_PLAN.zh-CN.md)

This document is for **developers who maintain the ThoughtLite port** in NotionNext: why it exists, upstream provenance, original author repository, compliance notes, and day-to-day maintenance.

---

## 1. Why it was added

- **Community request**: [Issue #3987](https://github.com/notionnext-org/NotionNext/issues/3987) proposed a new theme inspired by the open-source Astro theme **ThoughtLite** (timeline-style home, reading-first layout).
- **Goal**: Provide an optional React skin that **stays compatible with NotionNext data contracts** (`posts`, `post`, `customNav`, comments, plugins, etc.) while **approximating ThoughtLite’s look and information architecture**.

---

## 2. Upstream, author, and repositories

| Item | Link |
|------|------|
| **Upstream theme** | ThoughtLite (Astro) |
| **Author** | [tuyuritio](https://github.com/tuyuritio) |
| **Upstream source** | [tuyuritio/astro-theme-thought-lite](https://github.com/tuyuritio/astro-theme-thought-lite) |
| **Live demo** | [thought-lite.ttio.workers.dev](https://thought-lite.ttio.workers.dev/) |
| **Upstream stack** | Astro, Svelte, Tailwind CSS (see upstream README) |
| **Upstream license** | **GPL-3.0** |

NotionNext is primarily **MIT**. This theme is implemented as a **design-informed React rewrite**, **without copying** upstream `.astro` / `.svelte` source wholesale. If someone later wants to vendor GPL code paths, maintainers must assess **GPL/MIT compatibility** (see [migration plan §0](./THOUGHTLITE_MIGRATION_PLAN.zh-CN.md)).

---

## 3. Mapping in this repo

| Item | Location |
|------|----------|
| **Theme folder** | `themes/thoughtlite/` |
| **Root scope** | `#theme-thoughtlite` |
| **Config keys** | `THOUGHTLITE_*` in `themes/thoughtlite/config.js` via `siteConfig(..., CONFIG)` |
| **Baseline** | Started from `themes/example`, then restyled toward ThoughtLite |
| **Shared features** | `@/components/*` (Notion body, comments, search, etc.) |

---

## 4. Features (maintenance map)

- **Header**: title, horizontal nav (incl. custom menu), search, theme toggle (`Header.js`, `MenuList.js`, `MenuItemDrop.js`).
- **Home**: optional **Latest** card; **timeline** grouped by `publishDay` (`HomeTimeline.js`, `BlogItem` `timeline` variant); respects global `POST_LIST_STYLE` (page vs scroll).
- **Post**: card header, `PostMeta`, `NotionPage`, `ShareBar`, comments (`dynamic` without SSR), sidebar TOC (`LayoutSlug` in `index.js`).
- **Archive / category / tag / search**: `TlPageHero`; archive uses the same rail style; taxonomy uses `tl-chip` (`style.js`).
- **Footer**: copyright, beian, `PoweredBy`, plus **ThoughtLite name + upstream repo and author links** (`Footer.js`).
- **Theme switcher**: `conf/themeSwitch.manifest.js` entry `thoughtlite`; previews under `public/images/themes-preview/thoughtlite.{png,webp}` (replace placeholders before release; optionally run `yarn perf:compress-theme-previews`).

---

## 5. Config keys (`themes/thoughtlite/config.js`)

| Key | Purpose |
|-----|---------|
| `THOUGHTLITE_MENU_*` | Show/hide nav entries (category, tag, archive, search) |
| `THOUGHTLITE_HOME_TIMELINE` | Timeline on bare home routes |
| `THOUGHTLITE_HOME_LATEST_CARD` | Latest summary card on home |
| `THOUGHTLITE_SIDEBAR_ONLY_ON_POST` | Sidebar only on post detail |
| `THOUGHTLITE_POST_LIST_COVER` | Cover thumbnails in list mode |
| `THOUGHTLITE_TITLE_IMAGE` | Hero background image on non-post title bar |
| `THOUGHTLITE_HOME_MINIMAL_HEADER` | Minimal home title area |
| `THOUGHTLITE_ARTICLE_LAYOUT_VERTICAL` | Stack main + sidebar on posts |
| `THOUGHTLITE_ARTICLE_HIDDEN_NOTIFICATION` | Hide announcement on post |

Global **`LAYOUT_SIDEBAR_REVERSE`** still applies at site level.

---

## 6. Enable

```bash
NEXT_PUBLIC_THEME=thoughtlite
```

Use `yarn dev` locally; `?theme=thoughtlite` may work where the app exposes theme switching.

---

## 7. Maintenance checklist

1. Prefer editing **`#theme-thoughtlite`** tokens and classes in `themes/thoughtlite/style.js`.
2. Layout entry points: `themes/thoughtlite/index.js` (`Layout*`); presentational pieces under `themes/thoughtlite/components/`.
3. When **matching upstream visuals**, reference the [public demo](https://thought-lite.ttio.workers.dev/)—avoid pasting **GPL source files**; document any exception in the PR.
4. Timeline relies on **`publishDay` / `publishDate`** from Notion mapping (`lib/db/notion/getPageProperties.js`).
5. Cross-theme conventions: see [FUWARI.md](./FUWARI.md) and [THEME_MIGRATION_GUIDE](../THEME_MIGRATION_GUIDE.md).
6. Refresh theme previews under `public/images/themes-preview/` when the UI changes materially.
7. Smoke test: `yarn lint --dir themes/thoughtlite` and click through main routes with `NEXT_PUBLIC_THEME=thoughtlite`.

---

## 8. Links

- Issue: [notionnext-org/NotionNext#3987](https://github.com/notionnext-org/NotionNext/issues/3987)
- Upstream: [tuyuritio/astro-theme-thought-lite](https://github.com/tuyuritio/astro-theme-thought-lite)
- Demo: [thought-lite.ttio.workers.dev](https://thought-lite.ttio.workers.dev/)

---

## 9. Status

This is an **initial, merge-ready port**: core flows work; **further polish** (tokens, spacing, motion, a11y, plugin edge cases) is expected in follow-up PRs.
107 changes: 107 additions & 0 deletions docs/themes/THOUGHTLITE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# ThoughtLite 主题(NotionNext)

[English](./THOUGHTLITE.en.md) | 任务计划:[THOUGHTLITE_MIGRATION_PLAN.zh-CN.md](./THOUGHTLITE_MIGRATION_PLAN.zh-CN.md)

本文面向**后续维护本主题的开发者**,说明主题加入原因、上游来源、原作者仓库、合规注意与日常维护要点。

---

## 1. 加入背景与原因

- **社区提议**:用户在 [Issue #3987](https://github.com/notionnext-org/NotionNext/issues/3987) 中建议新增主题,参考对象为开源 Astro 主题 **ThoughtLite**,认为其阅读向、时间线式首页与轻量导航适合作为 NotionNext 的可选皮肤之一。
- **产品目标**:在 **不破坏 NotionNext 既有数据契约**(`posts` / `post` / `customNav` / 评论与插件等)的前提下,提供一套**视觉与信息架构上贴近 ThoughtLite** 的 React 主题,便于站点一键切换试用。

---

## 2. 来源、原作者与仓库

| 说明 | 链接 |
|------|------|
| **上游主题名** | ThoughtLite(Astro 生态) |
| **原作者 GitHub** | [tuyuritio](https://github.com/tuyuritio) |
| **上游源码仓库** | [tuyuritio/astro-theme-thought-lite](https://github.com/tuyuritio/astro-theme-thought-lite) |
| **上游在线演示** | [thought-lite.ttio.workers.dev](https://thought-lite.ttio.workers.dev/) |
| **上游技术栈** | Astro、Svelte、Tailwind CSS 等(见上游 README) |
| **上游许可证** | **GPL-3.0** |

NotionNext 本仓库主体为 **MIT**。本主题目录下的实现为 **基于上游「设计参考」在 Next.js + React 中重写**,**不直接复制**上游 `.astro` / `.svelte` 等 GPL 源码文本;若未来有人希望合入上游组件源码,须由维护者单独评估 **GPL 与 MIT 的兼容性**(详见 [迁移计划 §0](./THOUGHTLITE_MIGRATION_PLAN.zh-CN.md))。

---

## 3. 与本仓库的对应关系

| 维度 | 说明 |
|------|------|
| **主题目录** | `themes/thoughtlite/` |
| **根节点** | `#theme-thoughtlite`(样式与全局隔离) |
| **配置前缀** | `THOUGHTLITE_*`,集中在 `themes/thoughtlite/config.js`,通过 `siteConfig('KEY', default, CONFIG)` 读取 |
| **起点** | 初期由 `themes/example` 骨架复制并改名,再逐步替换为 ThoughtLite 取向的 UI |
| **通用逻辑** | 评论、Notion 正文、搜索等复用 `@/components/*`,与其它主题一致 |

---

## 4. 功能概览(维护时对照)

- **顶栏**:站点标题、横向导航(含自定义菜单)、搜索入口、深浅色切换(`components/Header.js`、`MenuList.js`、`MenuItemDrop.js`)。
- **首页**:可选 **Latest** 卡片、按 **`publishDay`** 分组的时间线列表(`HomeTimeline.js`、`BlogItem` 的 `timeline` 变体);支持分页 / 滚动列表两种全局 `POST_LIST_STYLE`。
- **文章页**:卡片式标题区、`PostMeta`、`NotionPage`、`ShareBar`、评论区(`dynamic` 关闭 SSR)、侧栏目录等(`index.js` 中 `LayoutSlug`)。
- **归档 / 分类 / 标签 / 搜索**:统一 `TlPageHero` 页头;归档为时间线侧轨;分类与标签为 `tl-chip`(`style.js`)。
- **页脚**:版权、备案、`PoweredBy`,以及 **ThoughtLite 主题名 + 上游仓库与原作者链接**(`components/Footer.js`)。
- **主题切换**:`conf/themeSwitch.manifest.js` 中 `thoughtlite` 条目;预览图 `public/images/themes-preview/thoughtlite.{png,webp}`(当前可为占位图,发布前建议替换真实截图并执行 `yarn perf:compress-theme-previews`)。

---

## 5. 配置项一览(`themes/thoughtlite/config.js`)

| 键 | 含义 |
|----|------|
| `THOUGHTLITE_MENU_CATEGORY` / `TAG` / `ARCHIVE` / `SEARCH` | 顶栏是否展示对应菜单项 |
| `THOUGHTLITE_HOME_TIMELINE` | 纯首页是否使用按日时间线 |
| `THOUGHTLITE_HOME_LATEST_CARD` | 首页是否展示 Latest 摘要块 |
| `THOUGHTLITE_SIDEBAR_ONLY_ON_POST` | 是否仅在文章详情页显示侧栏 |
| `THOUGHTLITE_POST_LIST_COVER` | 列表是否显示封面(时间线场景建议 `false`) |
| `THOUGHTLITE_TITLE_IMAGE` | 非文章页的 TitleBar 是否使用背景大图 |
| `THOUGHTLITE_HOME_MINIMAL_HEADER` | 首页是否隐藏大块 TitleBar |
| `THOUGHTLITE_ARTICLE_LAYOUT_VERTICAL` | 文章页主区与侧栏是否改为上下堆叠 |
| `THOUGHTLITE_ARTICLE_HIDDEN_NOTIFICATION` | 文章页是否隐藏公告 |

全局项 **`LAYOUT_SIDEBAR_REVERSE`** 仍由站点级配置控制,与本主题 `LayoutBase` 共同作用。

---

## 6. 启用方式

```bash
# .env.local 或部署环境
NEXT_PUBLIC_THEME=thoughtlite
```

本地开发:`yarn dev` 后访问站点;也可用 URL 参数 `?theme=thoughtlite` 在支持主题切换的场景下试用(以实际路由与配置为准)。

---

## 7. 迁移与维护事项(给后续开发者)

1. **改样式优先** `themes/thoughtlite/style.js` 中的 **`#theme-thoughtlite`** 下 CSS 变量与类名,避免污染其它主题。
2. **改布局与路由** 以 `themes/thoughtlite/index.js` 中各 `Layout*` 为入口;列表子组件在 `themes/thoughtlite/components/`。
3. **对齐上游视觉** 时建议只对照 [上游演示站](https://thought-lite.ttio.workers.dev/) 与公开 UI 行为,**避免整文件拷贝**上游 GPL 源码;大段引用需在 PR 中说明合规路径。
4. **数据字段**:时间线依赖 `post.publishDay`、`post.publishDate`(由 Notion 属性映射,见 `lib/db/notion/getPageProperties.js`);勿写死 Notion 内部 ID。
5. **与其它主题对齐行为** 时,可参考 [FUWARI.md](./FUWARI.md) 与 [主题迁移指南(中文)](../THEME_MIGRATION_GUIDE.zh-CN.md) 中的菜单、评论、TOC、插件位等约定。
6. **更新主题切换预览** 时替换 `public/images/themes-preview/thoughtlite.png`,并运行 `yarn perf:compress-theme-previews` 更新 webp(若仓库保留该脚本)。
7. **合并前自检**:`yarn lint --dir themes/thoughtlite`、`NEXT_PUBLIC_THEME=thoughtlite` 下手动点一遍主要路由(首页、文章、归档、分类、标签、搜索、404、加密文)。

更细的分阶段清单见 [THOUGHTLITE_MIGRATION_PLAN.zh-CN.md](./THOUGHTLITE_MIGRATION_PLAN.zh-CN.md)。

---

## 8. 相关链接汇总

- 需求:[notionnext-org/NotionNext#3987](https://github.com/notionnext-org/NotionNext/issues/3987)
- 上游仓库:[tuyuritio/astro-theme-thought-lite](https://github.com/tuyuritio/astro-theme-thought-lite)
- 上游演示:[thought-lite.ttio.workers.dev](https://thought-lite.ttio.workers.dev/)

---

## 9. 当前阶段说明(给审阅者与贡献者)

本主题为 **初步合并可用的实现**:核心列表与文章流已接通,视觉与交互仍会**按迭代优化**(色板、间距、动效、无障碍、与其它插件的边角兼容等)。合并 PR 不代表 Issue 中所有「像素级对齐上游」诉求已全部完成;后续可在同一主题目录内持续提交小 PR 演进。
Loading
Loading