Compare commits
1 Commits
c68d1062ff
...
2d7b8d0d07
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d7b8d0d07 |
90
README.md
90
README.md
@@ -80,96 +80,24 @@ npm run build # 产物输出到 dist/
|
|||||||
npm test # (可选)运行单元测试
|
npm test # (可选)运行单元测试
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. 部署为系统服务(systemd)
|
### 4. 集成到主页
|
||||||
|
|
||||||
创建服务文件 `/etc/systemd/system/timetable-fix.service`:
|
本项目作为 [mainPage](https://git.zikai.wang/zikai/zMainPage) 的一个页签集成展示,采用**构建期组件集成 + git submodule**:
|
||||||
|
|
||||||
```ini
|
|
||||||
[Unit]
|
|
||||||
Description=timeTableFix ICS Calendar Organizer
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
WorkingDirectory=/path/to/timeTableFix
|
|
||||||
ExecStart=/path/to/timeTableFix/node_modules/.bin/vite preview --host 0.0.0.0 --port 8888
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=3
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
StandardOutput=append:/var/log/timetable-preview.log
|
|
||||||
StandardError=append:/var/log/timetable-preview.log
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
```
|
|
||||||
|
|
||||||
> 将上述 `WorkingDirectory` 和 `ExecStart` 中的路径替换为实际的 `timeTableFix` 绝对路径。
|
|
||||||
|
|
||||||
加载并启动:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable --now timetable-fix
|
|
||||||
```
|
|
||||||
|
|
||||||
### 5. 放行防火墙端口
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo ufw allow 8888/tcp
|
|
||||||
```
|
|
||||||
|
|
||||||
浏览器访问 `http://<服务器IP>:8888` 即可。若通过域名访问(如 `f.zikai.wang`),需在 `vite.config.js` 的 `preview.allowedHosts` 中添加该域名。
|
|
||||||
|
|
||||||
### 6. 嵌入主页(可选)
|
|
||||||
|
|
||||||
本项目可作为 [mainPage](https://git.zikai.wang/zikai/zMainPage) 的一个页签集成展示。采用**构建期组件集成 + git submodule**:
|
|
||||||
|
|
||||||
- mainPage 通过 git submodule 把本项目作为子目录(`third_party/timeTableFix`)引入,并直接 `import` 本项目的 `src/App.vue` 作为懒加载路由组件。
|
- mainPage 通过 git submodule 把本项目作为子目录(`third_party/timeTableFix`)引入,并直接 `import` 本项目的 `src/App.vue` 作为懒加载路由组件。
|
||||||
- 集成时共享 mainPage 的构建、依赖(`ical.js`)与 KeepAlive 缓存,不再是 iframe,无运行期割裂。
|
- 集成时共享 mainPage 的构建、依赖(`ical.js`)与 KeepAlive 缓存,不再是 iframe,无运行期割裂。
|
||||||
- 本项目 `App.vue` 已做样式隔离(scoped + `ttf-` 前缀类名),全局重置仅在独立 app(`main.js`)加载,作为组件嵌入时不污染宿主。
|
- 本项目 `App.vue` 已做样式隔离(scoped + `ttf-` 前缀类名),设计令牌与 mainPage 对齐;全局重置仅在独立 app(`main.js`)加载,作为组件嵌入时不污染宿主。
|
||||||
|
|
||||||
**升级流程**(mainPage 侧更新本项目到新版本):
|
本项目无独立线上入口,仅通过主页 `https://zikai.wang/timetable` 访问。升级流程见 mainPage 的 [`docs/submodule-timeTableFix.md`](https://git.zikai.wang/zikai/zMainPage/src/branch/main/docs/submodule-timeTableFix.md)。
|
||||||
|
|
||||||
```bash
|
## 开发
|
||||||
cd mainPage
|
|
||||||
git submodule update --remote third_party/timeTableFix # 拉取最新
|
|
||||||
cd third_party/timeTableFix && git checkout master # 固定到目标分支
|
|
||||||
cd ../..
|
|
||||||
git add third_party/timeTableFix # 更新 gitlink
|
|
||||||
git commit -m "chore: 升级 timeTableFix 子模块"
|
|
||||||
npm run build # 重新构建 mainPage
|
|
||||||
```
|
|
||||||
|
|
||||||
本项目本身完全独立:脱离 mainPage 仍可独立 `npm run build` / `npm test` / systemd 部署。移除 mainPage 中的页签仅需删其 `src/modules/timetable/` 并 `git submodule deinit`,不影响本项目。
|
|
||||||
|
|
||||||
> 旧的 iframe 嵌入方式(Apache `/ttf/` 反代到 8888)仍可保留,用于经 `https://zikai.wang/ttf/` 单独访问独立 app,与组件集成互不冲突。
|
|
||||||
|
|
||||||
## 使用(启动 / 关闭)
|
|
||||||
|
|
||||||
服务由 systemd 管理,开机自启、崩溃自动恢复。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 启动
|
|
||||||
sudo systemctl start timetable-fix
|
|
||||||
|
|
||||||
# 关闭
|
|
||||||
sudo systemctl stop timetable-fix
|
|
||||||
|
|
||||||
# 重启
|
|
||||||
sudo systemctl restart timetable-fix
|
|
||||||
|
|
||||||
# 查看状态
|
|
||||||
sudo systemctl status timetable-fix
|
|
||||||
|
|
||||||
# 查看日志
|
|
||||||
tail -f /var/log/timetable-preview.log
|
|
||||||
```
|
|
||||||
|
|
||||||
开发模式(无需 systemd,前台运行):
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd timeTableFix
|
cd timeTableFix
|
||||||
npm run dev # http://localhost:5173
|
npm install
|
||||||
|
npm run dev # 开发服务器 http://localhost:5173
|
||||||
|
npm test # 单元测试(42 项)
|
||||||
|
npm run build # 构建到 dist/(独立预览用,非线上入口)
|
||||||
```
|
```
|
||||||
|
|
||||||
## 技术栈
|
## 技术栈
|
||||||
|
|||||||
Reference in New Issue
Block a user