将 Next.js 构建切换为 standalone,新增多阶段 Docker 镜像和非 root 运行。 CI 改为启动服务检查页面与静态资源,并移除静态导出校验。 BREAKING CHANGE: 不再生成 out/ 静态产物,部署需运行 Node 服务容器。
This commit is contained in:
@@ -71,6 +71,8 @@ Polaris 不是后台管理系统,也不是信息密集型 Dashboard。
|
||||
| 13 | 后端数据库 | PostgreSQL(后续阶段);表结构不锁死 PG 特有语法(JSON 存通用 TEXT) |
|
||||
| 14 | 搜索行为 | 按模式严格分离:选中哪个引擎就只用哪个引擎搜索(回车直跳);仅 Local 模式显示本地结果下拉 |
|
||||
|
||||
2026-10-12 部署阶段将第 2 项由静态导出调整为 standalone 服务端输出;当前实现见第 5.2 节。初期内容仍在构建时从本地 JSON 生成,在线数据管理需后续接入后端。
|
||||
|
||||
---
|
||||
|
||||
## 5. 技术选型
|
||||
@@ -99,16 +101,16 @@ simple-icons
|
||||
|
||||
### 5.2 渲染策略
|
||||
|
||||
采用静态导出:
|
||||
采用 standalone 输出:
|
||||
|
||||
```ts
|
||||
// next.config.ts
|
||||
const nextConfig = { output: "export" }
|
||||
const nextConfig = { output: "standalone" }
|
||||
```
|
||||
|
||||
- 首页与全部分类页在构建时从本地数据生成(`generateStaticParams`);
|
||||
- 时钟、搜索、侧边栏折叠等交互以 client 组件实现;
|
||||
- 产物为纯静态文件,可部署到任意静态服务器;
|
||||
- 构建产物为 `.next/standalone` 下的最小 Node 服务器(`server.js`),`public` 与 `.next/static` 需按 Next 文档在部署时手动复制;
|
||||
- 后续接 Go 后端时,改造 service 层为 fetch,数据页面改为客户端获取。
|
||||
|
||||
### 5.3 数据访问层
|
||||
@@ -422,7 +424,7 @@ polaris/
|
||||
types/ # navigation.ts / settings.ts / search.ts
|
||||
lib/ # cn.ts / greeting.ts / local-search.ts / search-providers.ts / icon.ts(纯函数)
|
||||
|
||||
next.config.ts # output: 'export'
|
||||
next.config.ts # output: 'standalone'
|
||||
vitest.config.ts
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user