Skip to content

Commit

Permalink
finish doc and prepare to release v2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
timzaak committed Jun 7, 2024
1 parent 7e0943d commit 95dc03c
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spa-client"
version = "2.0.0"
version = "2.1.1"
edition = "2021"
authors = ["timzaak"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion docs/develop/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### Version 2.1.1

- [x] fix: cache discard correctly
- [ ] feat: server could start should serve old version
- [x] feat: server could start should serve old version
- [x] improve: .SPA-Multiple file create when upload

### Version 2.1.0
Expand Down
3 changes: 2 additions & 1 deletion docs/develop/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
- bench: add benchmark
- doc: spa-client command help doc
- [x] integration check of files list
- config format change from honcon to yaml (honcon lib is archived)
- **big break change**: config format change from honcon to yaml (honcon lib is archived)
- support Let's Encrypt with [acme-lib](https://crates.io/crates/acme-lib)
31 changes: 26 additions & 5 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Getting Started

This section will help you bring spa-server up, and upload your static web files to it.

## Run spa-server by docker

`uploading file` feature needs spa-server open admin-server. So we should create a config file first.

```bash
Expand All @@ -22,11 +24,15 @@ ghcr.io/fornetcode/spa-server:latest
```

## Run spa-client in npm project

1. Install spa-client npm package.

```shell
npm install spa-client dotenv --save-dev
```

2. add config for spa-client in the `.env` file

```
# all config start with `SPA` for spa-client
SPA_SERVER_ADDRESS=http://127.0.0.1:9000
Expand All @@ -37,20 +43,35 @@ SPA_SERVER_AUTH_TOKEN=token
SPA_UPLOAD_PARALLEL=3
```

3. Add script to package.json (need `dotenv`). `www.example.com` is the domain of your website, and `./build` is directory of static web files.
3. Add script to package.json (need `dotenv`). `www.example.com` is the domain of your website, and `./build` is
directory of static web files.

```json
{
"script":{
"upload": "dotenv .env spa-client upload ./build www.example.com",
"release":"dotenv .env spa-client release www.example.com"
"script": {
"upload": "dotenv .env spa-client upload ./build www.example.com",
"release": "dotenv .env spa-client release www.example.com"
}
}
```

we also support serving multiple SPA in one domain:

```json
{
"script": {
"upload1": "dotenv .env spa-client upload ./build www.example.com/a",
"release1": "dotenv .env spa-client release www.example.com/a",
"upload2": "dotenv .env spa-client upload ./build www.example.com/b",
"release2": "dotenv .env spa-client release www.example.com/b"
}
}
```

## What's More
- a React example for spa-client: [js-app-example](https://github.com/fornetcode/spa-server/blob/master/example/js-app-example/README.md).

- a React example for
spa-client: [js-app-example](https://github.com/fornetcode/spa-server/blob/master/example/js-app-example/README.md).
- spa-server [configuration](./spa-server-configuration.md) and its admin-server [http api](./spa-server-api.md)
- spa-client [npm package](./spa-client-npm-package.md)

Expand Down
20 changes: 15 additions & 5 deletions docs/guide/spa-client-command-line.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
# Command Line
We have provided command line in 1.x versions, but it seems no one need it. So we removed the binary release and docker release.

We have provided command line in 1.x versions, but it seems no one need it. So we removed the binary release and docker
release.

But you can build it from source.

## Source Code

```shell
git clone --recursive https://github.com/fornetcode/spa-server
cargo build --package spa-client --release
# you could get the binary from ./target/release directory
```
You can install it by:

Install it by:

```shell
cd client
cargo install --bin spa-client --path .
```

## Overview

spa-client it a command line tool to help user upload files and release new SPA.

## Usage Example

There are some usage examples of `spa-client`, you also can get help by typing `spa-client -h`.

```shell
# upload static files to admin server, if not set $OPT_VERSION, will try to
spa-client -c $CONFIG_PATH upload $STATIC_FILE_PATH $DOMAIN $OPT_VERSION -p 3
Expand All @@ -37,9 +45,8 @@ spa-client -c $CONFIG_PATH reload
spa-client -c $CONFIG_PATH delete $OPT_DOMAIN $OPT_MAX_RESERVE
```

There also provides http api to interact with admin server,

### Config

the config file format is hocon:

```hocon
Expand All @@ -57,7 +64,10 @@ upload {
parallel: 3
}
```
the config file name would be `client.conf`

the config default file name is `client.conf`.

We also provide http api to interact with admin server, the following command is ok to upload and serve new version.

```shell
# Uploading Files By scp and release
Expand Down
11 changes: 7 additions & 4 deletions docs/guide/spa-client-npm-package.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# NPM Package
## Overview

There has an example project for npm package users:
[js-app-example](https://github.com/fornetcode/spa-server/tree/master/example/js-app-example).
## Overview

## Install in new project

there is more info at [getting started](./getting-started.md#run-spa-client-in-npm-package)

## Source Code
There has an example project for npm package users:
[js-app-example](https://github.com/fornetcode/spa-server/tree/master/example/js-app-example).

## Build Source Code

```shell
git clone --recursive https://github.com/fornetcode/spa-server
cd jsclient && npm install && npm build
Expand Down
2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spa-server"
version = "2.0.0"
version = "2.2.1"
edition = "2021"
authors = ["timzaak"]
license = "MIT"
Expand Down

0 comments on commit 95dc03c

Please sign in to comment.