Skip to content

Commit 8164b90

Browse files
committed
rewrite doc by VitePress, and release it to GitHub Pages
1 parent 02b78d7 commit 8164b90

31 files changed

+1157
-219
lines changed

.github/workflows/doc-cd.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: spa-client release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
required: true
8+
description: "git tag to release(this input is meaningless)"
9+
jobs:
10+
docker:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
name: Get Code
15+
16+
- name: Install Node
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: "16"
20+
cache: "yarn"
21+
cache-dependency-path: yarn.lock
22+
23+
- name: Build Doc
24+
run: yarn run docs:build
25+
26+
- name: Release Doc
27+
run: |
28+
cd docs/.vitepress/dist
29+
git init
30+
git add -A
31+
git commit -m 'deploy'
32+
git push -f [email protected]:timzaak/spa-server.git master:gh-pages

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/target
22
.idea
33
/tmp
4-
config.conf
4+
config.conf
5+
/node_modules
6+
package-lock.json

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,17 @@ ifeq ($(VERSION), )
4747
$(error VEDRSION is not set)
4848
else
4949
DOCKER_BUILDKIT=1 docker build . -f SPA-Client.Dockerfile -t="timzaak/client:$(VERSION)"
50-
docker push timzaak/spa-client:$(VERSION)
50+
docker push timzaak/spa-client:$(VERSION)
5151
endif
52+
53+
54+
release-doc:
55+
set -e
56+
rm -fr docs/.vitepress/dist/*
57+
yarn run docs:build
58+
cd docs/.vitepress/dist
59+
git init
60+
git add -A
61+
git commit -m 'deploy'
62+
git push -f [email protected]:timzaak/spa-server.git master:gh-pages
63+
cd -

README.md

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,22 @@
11
# SPA-SERVER
2-
It's just for static web deployment with server side cache, client side cache and hot reload.
2+
It is to provide a static web http server with cache and hot reload.
33

44
[中文 README](./README_CN.md)
55

66
## Feature
7-
- Built with Hyper and Warp.
7+
- Built with Hyper and Warp, fast and small!
88
- SSL with Rustls.
9-
- Memory cacheclient cache and compression(gzip).
10-
- SPA version control, you can regress or release new version with one HTTP api command.
9+
- Memory cache, client cache and compression(gzip).
10+
- Static web version control, you can regress or release new version easily.
1111
- Hot reload support(Mac and Linux).
12-
- CORS
13-
- http redirect to https or both serving at the same time.
14-
- Docker support(compressed size: 32M)
15-
- provide cmd/npm package to deply spa with one command.
16-
17-
## Run Server
18-
You can get all config description in file: [`config.release.conf`](./config.release.conf). If you want to change the server config file path,
19-
please set environment variable `SPA_CONFIG=${config_path}`.
20-
### Run By Code
21-
```shell
22-
git clone [email protected]:timzaak/spa-server.git
23-
cd spa-server
24-
git submodule init && git submodule update
25-
cp config.release.conf config.conf # please remember to change `file_dir` in config.conf
26-
cargo run --bin spa-server
27-
```
28-
### Run Docker
29-
```shell
30-
docker run -d -p 80 -p 443 -v $HOST_VOLUME:/data -v $CONFIG:/config.conf timzaak/spa-server:latest
31-
```
32-
33-
## How To Upload SPA Files
34-
If you want to integrate with js project, please ref:[example/js-aapp-example](example/js-app-example/README.md), if you want to use commandline tool, please ref [SPA-Client](doc/SPA-Client.md) doc.
35-
36-
## Roadmap
37-
please ref [Roadmap.md](./doc/Roadmap.md).
38-
39-
If you have any idea, feel free to open issue.
40-
41-
## Why use self maintained warp
42-
[#171 Add reply::file(path) helper](https://github.com/seanmonstar/warp/issues/171)
43-
44-
This project uses lots of private api at warp/src/filters/fs.rs.
12+
- CORS support.
13+
- Http auto redirect to https.
14+
- Docker support(compressed size: 32M).
15+
- Provide command line/npm package to deploy spa.
16+
17+
## Document
18+
There is a nice [document](https://timzaak.github.io/spa-server/) powered by VitePress and GitHub Pages,
19+
you can quickly start spa-server with this [guide](https://timzaak.github.io/spa-server/guide/getting-started.html).
4520

4621
## Project Origin
4722
More details are described at [SPA 发布辅助工具](https://github.com/timzaak/blog/issues/80) in Chinese.

README_CN.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
- http/https 同时服务(http 也可返回 redirect https)。
1313
- 支持 Docker 镜像(压缩后大小:32M)
1414
- 提供 命令行/npm包 客户端,一行命令部署
15+
16+
## 文档
17+
目前将文档托管在 GitHub Pages,地址:https://timzaak.github.io/spa-server,
18+
Gitee 上的托管还在走流程中。
19+
1520
## 服务跑起来
1621

1722
配置文件说明: [`config.release.conf`](./config.release.conf).
@@ -33,7 +38,7 @@ docker run -d -p 80 -p 443 -v $HOST_VOLUME:/data -v $CONFIG:/config.conf timzaak
3338
```
3439

3540
## 如何部署静态文件
36-
如果你想集成到JS项目中,请参阅:[example/js-aapp-example](example/js-app-example/README.md), 如果你只想用命令行, 请参阅:[SPA-Client](doc/SPA-Client.md)
41+
如果你想集成到JS项目中,请参阅:[example/js-aapp-example](example/js-app-example/README.md)
3742

3843
## spa-server 使用场景
3944
### 单独使用
@@ -46,7 +51,7 @@ docker run -d -p 80 -p 443 -v $HOST_VOLUME:/data -v $CONFIG:/config.conf timzaak
4651
2. 所有控制请求,需要对每个实例都发起一遍。
4752

4853
## 项目规划
49-
请参阅 [项目规划](./doc/Roadmap.md).
54+
请参阅 [项目规划](docs/Roadmap.md).
5055

5156
## 为何自行维护 warp 版本
5257
[#171 Add reply::file(path) helper](https://github.com/seanmonstar/warp/issues/171)

client/src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ pub mod commands;
66
mod config;
77
mod upload_files;
88

9-
use anyhow::Context;
109
use crate::api::API;
1110
use crate::commands::{CliCommand, Commands};
1211
use crate::config::Config;
1312
use crate::upload_files::upload_files;
13+
use anyhow::{anyhow, Context};
1414

1515
use clap::Parser;
1616
use console::style;
@@ -41,8 +41,12 @@ fn success(message: &str) {
4141
}
4242

4343
fn run_with_commands(commands: CliCommand) -> anyhow::Result<()> {
44-
let config = Config::load(commands.config_dir)
45-
.with_context(||"Please set config, you can get help at https://github.com/timzaak/spa-server/blob/master/doc/SPA-Client.md#how-to-use-commandline-of-spa-client")?;
44+
let config = Config::load(commands.config_dir).map_err(|e| {
45+
Err(anyhow!(
46+
"Please set config file path or environment variable correctly, {}",
47+
e
48+
));
49+
})?;
4650
println!(
4751
"spa-client connect to admin server({})",
4852
&config.server.address

doc/Admin_Server_API.md

Lines changed: 0 additions & 77 deletions
This file was deleted.

doc/Break_Changes.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

doc/SPA-Client.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.vitepress/dist

0 commit comments

Comments
 (0)