Skip to content

Commit

Permalink
base function finish
Browse files Browse the repository at this point in the history
  • Loading branch information
q9090960bnb3 committed Nov 3, 2023
1 parent a74b9d7 commit 6e0a06d
Show file tree
Hide file tree
Showing 21 changed files with 1,643 additions and 37 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ support gitbook 3.2.3, 其他版本自测, 解决 gitbook 太慢的问题
## 开启此项目初衷

gitbook 3.2.3 为历史项目,插件下载需要整体拉取,非常缓慢,也不支持单个拉取,这样`gbook`就应运而生了,
如果不想频繁切换 node 版本,`gbook`也适合你

配置好后将有以下特性:

- 拉取插件特别快
- 不用频繁的切换 node 版本

## 依赖

Expand All @@ -17,6 +21,10 @@ gitbook 3.2.3 为历史项目,插件下载需要整体拉取,非常缓慢,

将 BOOK_NODE_HOME 变量设置为需要的 node 版本路径,加入到系统变量中, 这样`gbook`会使用对应 node 版本执行命令了,不再受全局其他版本 node 影响。

## 主要功能

`gbook install`将是核心功能,你只需关注该命令即可

## 详细说明

参考 https://gofulljs.github.io/gbook/
3 changes: 3 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
- [Introduction](README.md)
- [命令概览](book/index.md)
- [ready 命令](book/ready.md)
- [sync 命令](book/sync.md)
- [sync2 命令](book/sync2.md)
- [install 命令](book/install.md)
2 changes: 1 addition & 1 deletion book/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ GLOBAL OPTIONS:
- `bookVersion`: 默认使用 gitbook 引擎为 3.2.3
- `bookHome`: 默认 gitbook 引擎存放位置
- `nodePath`: `gbook` 使用指定路径的 node 版本,可使用`BOOK_NODE_HOME`配置到环境变量中
- `nodePath`: `gbook` 使用指定路径的 node 版本,建议将`BOOK_NODE_HOME`配置到环境变量中,这样切换 node 版本不将影响到`gbook`
18 changes: 18 additions & 0 deletions book/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# install

```sh
gbook install -h
NAME:
gbook install - install plugin
`install`: install all plugins from gitbook
`install [plugins...]`: install plugin you want, eg: `gbook install code ga`

USAGE:
gbook install [command options] [arguments...]

OPTIONS:
--help, -h show help
```

- `gbook install [plugins...]` 会默认调用 `gbook ready``gbook sync2`命令,确保依赖正常后才会继续安装依赖。
- 使用前请确保设置好 npm 加速源
2 changes: 1 addition & 1 deletion book/sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ OPTIONS:

```

拉取 gitbook 引擎到
拉取 gitbook 引擎,因为包含`node_modules`,可能很慢,建议使用`sync2`
19 changes: 19 additions & 0 deletions book/sync2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# sync

```sh
gbook sync2 -h
NAME:
gbook sync2 - sync2 gitbook, 不包含node_modules, suggest

USAGE:
gbook sync2 [command options] [arguments...]

OPTIONS:
--source value gitbook数据源 (default: "https://github.com/gofulljs/gitbook/archive/refs/tags/3.2.3.tar.gz")
--proxy1 value 自定义加速源(前缀+source), 不传采用以下\n[https://ghps.cc/ https://gh.api.99988866.xyz/ https://github.abskoop.workers.dev/]
--proxy2 value 自定义加速源(替换https://github.com前缀)
--help, -h show help

```

拉取 gitbook 引擎,拉取完成后会自动调用 `npm install` 安装依赖
4 changes: 3 additions & 1 deletion cmds/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/gofulljs/gbook/cmds/cmdutil"
"github.com/gofulljs/gbook/global"
"github.com/gofulljs/gbook/util"
"github.com/urfave/cli/v2"
)

Expand Down Expand Up @@ -40,6 +41,7 @@ var Run = &cli.Command{
}
}

return nil
// 清空lock文件
return util.DeleteFileIfExist("package-lock.json")
},
}
105 changes: 95 additions & 10 deletions docs/book/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>test · GitBook</title>
<title>命令概览 · GitBook</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
Expand Down Expand Up @@ -59,6 +59,8 @@
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">


<link rel="next" href="ready.html" />


<link rel="prev" href="../" />

Expand Down Expand Up @@ -108,7 +110,59 @@
<a href="./">


test
命令概览

</a>



</li>

<li class="chapter " data-level="1.1.2" data-path="ready.html">

<a href="ready.html">


ready 命令

</a>



</li>

<li class="chapter " data-level="1.1.3" data-path="sync.html">

<a href="sync.html">


sync 命令

</a>



</li>

<li class="chapter " data-level="1.1.4" data-path="sync2.html">

<a href="sync2.html">


sync2 命令

</a>



</li>

<li class="chapter " data-level="1.1.5" data-path="install.html">

<a href="install.html">


install 命令

</a>

Expand Down Expand Up @@ -151,7 +205,7 @@
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href=".." >test</a>
<a href=".." >命令概览</a>
</h1>
</div>

Expand All @@ -166,7 +220,38 @@ <h1>

<section class="normal markdown-section">

<p>hello world</p>
<div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#&#x547D;&#x4EE4;&#x6982;&#x89C8;"><b></b>&#x547D;&#x4EE4;&#x6982;&#x89C8;</a></li></ul></div><a href="#&#x547D;&#x4EE4;&#x6982;&#x89C8;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="&#x547D;&#x4EE4;&#x6982;&#x89C8;"><a name="&#x547D;&#x4EE4;&#x6982;&#x89C8;" class="anchor-navigation-ex-anchor" href="#&#x547D;&#x4EE4;&#x6982;&#x89C8;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x547D;&#x4EE4;&#x6982;&#x89C8;</h1>
<pre><code class="lang-sh">$ gbook -h
NAME:
gbook - uniswap tick update, other <span class="hljs-built_in">command</span> will forward gitbook *

USAGE:
gbook [global options] <span class="hljs-built_in">command</span> [<span class="hljs-built_in">command</span> options] [arguments...]

VERSION:
v1.0.0

COMMANDS:
ready check env is ready
sync sync gitbook
sync2 sync2 gitbook, &#x4E0D;&#x5305;&#x542B;node_modules, suggest
install, i install plugin
`install`: install all plugins from gitbook
`install [plugins...]`: install plugin you want, eg: `gbook install code ga`
<span class="hljs-built_in">help</span>, h Shows a list of commands or <span class="hljs-built_in">help</span> <span class="hljs-keyword">for</span> one <span class="hljs-built_in">command</span>

GLOBAL OPTIONS:
--bookVersion value, --bv value (default: <span class="hljs-string">&quot;3.2.3&quot;</span>) [%BOOK_VERSION%]
--bookHome value, --bh value gitbook path, default is <span class="hljs-variable">$HOME</span>/.gitbook/versions/
--nodePath value nodejs home, <span class="hljs-keyword">if</span> not specified, use current node [%BOOK_NODE_HOME%]
--help, -h show <span class="hljs-built_in">help</span>
--version, -v <span class="hljs-built_in">print</span> the version
</code></pre>
<ul>
<li><code>bookVersion</code>: &#x9ED8;&#x8BA4;&#x4F7F;&#x7528; gitbook &#x5F15;&#x64CE;&#x4E3A; 3.2.3</li>
<li><code>bookHome</code>: &#x9ED8;&#x8BA4; gitbook &#x5F15;&#x64CE;&#x5B58;&#x653E;&#x4F4D;&#x7F6E;</li>
<li><code>nodePath</code>: <code>gbook</code> &#x4F7F;&#x7528;&#x6307;&#x5B9A;&#x8DEF;&#x5F84;&#x7684; node &#x7248;&#x672C;&#xFF0C;&#x5EFA;&#x8BAE;&#x5C06;<code>BOOK_NODE_HOME</code>&#x914D;&#x7F6E;&#x5230;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x4E2D;&#xFF0C;&#x8FD9;&#x6837;&#x5207;&#x6362; node &#x7248;&#x672C;&#x4E0D;&#x5C06;&#x5F71;&#x54CD;&#x5230;<code>gbook</code></li>
</ul>


</section>
Expand Down Expand Up @@ -194,19 +279,23 @@ <h1 class="search-results-title">No results matching "<span class='search-query'



<a href="../" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Introduction">
<a href="../" class="navigation navigation-prev " aria-label="Previous page: Introduction">
<i class="fa fa-angle-left"></i>
</a>


<a href="ready.html" class="navigation navigation-next " aria-label="Next page: ready 命令">
<i class="fa fa-angle-right"></i>
</a>



</div>

<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"test","level":"1.1.1","depth":2,"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[{"title":"test","level":"1.1.1","depth":2,"path":"book/index.md","ref":"book/index.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["back-to-top-button","-lunr","-search","search-plus","a-import","code","anchor-navigation-ex","ga","3-ba","github","livereload"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"disqus":{"shortName":"gopher-1"},"github":{"url":"https://github.com/gofulljs"},"livereload":{},"code":{"copyButtons":false},"a-import":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"showLevelIcon":false,"mode":"float","pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"showLevel":false,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right","showGoTop":true,"printLog":false,"multipleH1":false,"multipleH2":false,"associatedWithSummary":true,"multipleH3":false,"float":{"floatIcon":"fa fa-navicon","showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"multipleH4":false},"back-to-top-button":{},"3-ba":{"configuration":"auto","token":"4c1823e87df49c9e304623b546c910fd"},"ga":{"configuration":"auto","token":"G-VMFJ3KGT9"},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"search-plus":{}},"theme":"default","author":"gofulljs","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"book/index.md","mtime":"2023-11-02T09:10:06.912Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2023-11-02T09:10:20.669Z"},"basePath":"..","book":{"language":""}});
gitbook.page.hasChanged({"page":{"title":"命令概览","level":"1.1.1","depth":2,"next":{"title":"ready 命令","level":"1.1.2","depth":2,"path":"book/ready.md","ref":"book/ready.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[{"title":"命令概览","level":"1.1.1","depth":2,"path":"book/index.md","ref":"book/index.md","articles":[]},{"title":"ready 命令","level":"1.1.2","depth":2,"path":"book/ready.md","ref":"book/ready.md","articles":[]},{"title":"sync 命令","level":"1.1.3","depth":2,"path":"book/sync.md","ref":"book/sync.md","articles":[]},{"title":"sync2 命令","level":"1.1.4","depth":2,"path":"book/sync2.md","ref":"book/sync2.md","articles":[]},{"title":"install 命令","level":"1.1.5","depth":2,"path":"book/install.md","ref":"book/install.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["back-to-top-button","-lunr","-search","search-plus","a-import","code","anchor-navigation-ex","ga","3-ba","github"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"disqus":{"shortName":"gopher-1"},"github":{"url":"https://github.com/gofulljs"},"code":{"copyButtons":false},"a-import":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"showLevelIcon":false,"mode":"float","pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"showLevel":false,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right","showGoTop":true,"printLog":false,"multipleH1":false,"multipleH2":false,"associatedWithSummary":true,"multipleH3":false,"float":{"floatIcon":"fa fa-navicon","showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"multipleH4":false},"back-to-top-button":{},"3-ba":{"configuration":"auto","token":"4c1823e87df49c9e304623b546c910fd"},"ga":{"configuration":"auto","token":"G-VMFJ3KGT9"},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"search-plus":{}},"theme":"default","author":"gofulljs","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"book/index.md","mtime":"2023-11-03T09:07:36.028Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2023-11-03T09:14:54.770Z"},"basePath":"..","book":{"language":""}});
});
</script>
</div>
Expand Down Expand Up @@ -244,10 +333,6 @@ <h1 class="search-results-title">No results matching "<span class='search-query'



<script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>



<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>


Expand Down
34 changes: 33 additions & 1 deletion docs/book/index.md
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
hello world
# 命令概览

```sh
$ gbook -h
NAME:
gbook - uniswap tick update, other command will forward gitbook *

USAGE:
gbook [global options] command [command options] [arguments...]

VERSION:
v1.0.0

COMMANDS:
ready check env is ready
sync sync gitbook
sync2 sync2 gitbook, 不包含node_modules, suggest
install, i install plugin
`install`: install all plugins from gitbook
`install [plugins...]`: install plugin you want, eg: `gbook install code ga`
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
--bookVersion value, --bv value (default: "3.2.3") [%BOOK_VERSION%]
--bookHome value, --bh value gitbook path, default is $HOME/.gitbook/versions/
--nodePath value nodejs home, if not specified, use current node [%BOOK_NODE_HOME%]
--help, -h show help
--version, -v print the version
```
- `bookVersion`: 默认使用 gitbook 引擎为 3.2.3
- `bookHome`: 默认 gitbook 引擎存放位置
- `nodePath`: `gbook` 使用指定路径的 node 版本,建议将`BOOK_NODE_HOME`配置到环境变量中,这样切换 node 版本不将影响到`gbook`
Loading

0 comments on commit 6e0a06d

Please sign in to comment.