Skip to content

Commit 37e8a52

Browse files
committed
chore: update gitbook build tooling
1 parent adf1ad6 commit 37e8a52

6 files changed

Lines changed: 6969 additions & 6456 deletions

File tree

Makefile

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1+
NPM ?= npm
2+
3+
.DEFAULT_GOAL := help
4+
5+
.PHONY: help install serve build clean
6+
17
help:
2-
@echo "\033[32minit\033[0m"
3-
@echo " 初始化GitBook"
4-
@echo "\033[32mrun\033[0m"
5-
@echo " 运行GitBook服务器"
6-
@echo "\033[32mbuild\033[0m"
7-
@echo " 构建GitBook静态页面"
8+
@printf "\033[32m%-10s\033[0m %s\n" "install" "安装项目依赖"
9+
@printf "\033[32m%-10s\033[0m %s\n" "serve" "运行 GitBook 服务器"
10+
@printf "\033[32m%-10s\033[0m %s\n" "build" "构建 GitBook 静态页面"
11+
@printf "\033[32m%-10s\033[0m %s\n" "clean" "删除构建产物"
812

9-
init:
10-
sudo npm i -g gitbook-cli
11-
gitbook install
13+
install:
14+
$(NPM) install
1215

13-
run:
14-
gitbook serve
16+
serve:
17+
$(NPM) run serve
1518

1619
build:
17-
gitbook build
20+
$(NPM) run build
21+
22+
clean:
23+
rm -rf _book

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,27 @@
1616

1717
### 使用 make 命令的方式构建:
1818

19-
若您可使用 make 命令,简单执行如下命令进行初始化
19+
若您可使用 make 命令,简单执行如下命令安装依赖
2020

2121
```console
22-
make init
22+
make install
2323
```
2424

2525
执行如下命令运行服务端:
2626

2727
```console
28-
make run
28+
make serve
29+
```
30+
31+
执行如下命令构建静态页面:
32+
33+
```console
34+
make build
2935
```
3036

3137
### 使用 npm 命令的方式构建:
3238

33-
若您不能使用 make 命令,或想直接使用 npm 命令,执行如下命令进行初始化
39+
若您不能使用 make 命令,或想直接使用 npm 命令,执行如下命令安装依赖
3440

3541
安装项目依赖:
3642

@@ -44,6 +50,12 @@ npm install
4450
npm run serve
4551
```
4652

53+
执行如下命令构建静态页面:
54+
55+
```console
56+
npm run build
57+
```
58+
4759
## 访问
4860

4961
直接访问 http://localhost:4000 即可查看本书内容。
@@ -78,5 +90,3 @@ npm run serve
7890
- [ ] Python 多线程机制
7991
- [ ] Python 内存管理机制
8092

81-
82-

book.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
},
1717
"plugins": [
1818
"-search",
19-
"search-plus@^0.0.11",
19+
"search-plus@^1.0.4-alpha-3",
2020
"-sharing",
2121
"sharing-plus",
2222
"github@^2.0.0",
23-
"github-buttons@2.1.0",
23+
"github-buttons@^3.0.0",
2424
"edit-link@^2.0.2",
2525
"splitter",
2626
"tbfed-pagefooter",
@@ -51,7 +51,7 @@
5151
"all": ["weibo", "douban", "linkedin", "facebook", "google", "twitter"]
5252
},
5353
"tbfed-pagefooter": {
54-
"copyright": "Copyright © FlagGo 2019",
54+
"copyright": "Copyright © FlagGo 2019-2026",
5555
"modify_label": "该文件修订时间:",
5656
"modify_format": "YYYY-MM-DD HH:mm:ss"
5757
},

0 commit comments

Comments
 (0)