diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a2406f6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,43 @@ +language: node_js + +node_js: + - "8" + +# 缓存依赖 +cache: + directories: + - $HOME/.npm + +before_install: + - export TZ='Asia/Shanghai' # 更改时区 + +# 依赖安装 +install: + - npm install -g gitbook-cli gitbook-summary + +# 构建脚本 +script: + # 自定义输出目录 gitbook build src dest + - cd ./blog + - gitbook install + - book sm + - cat SUMMARY.md + - gitbook build . ../blog-build + +# 分支白名单 +branches: + only: + - master # 只对 master 分支进行构建 + +# GitHub Pages 部署 +deploy: + provider: pages + skip_cleanup: true + # 在项目仪表盘的 Settings -> Environment Variables 中配置 + github_token: $GITHUB_TOKEN + # 将 build 目录下的内容推送到默认的 gh-pages 分支上,并不会连带 build 目录一起 + local_dir: blog-build + name: $GIT_NAME + email: $GIT_EMAIL + on: + branch: master diff --git a/blog/book.json b/blog/book.json new file mode 100644 index 0000000..3d78bff --- /dev/null +++ b/blog/book.json @@ -0,0 +1,69 @@ +{ + "title": "Learn React Source Code", + "author": "cyan33", + "links": { + "sidebar": { + "Learn React Source Code": "https://github.com/cyan33/learn-react-source-code" + } + }, + "plugins": [ + "-lunr", + "-search", + "search-plus", + "splitter", + "anchors", + "anchor-navigation-ex", + "copy-code-button", + "expandable-chapters", + "theme-darkblue", + "theme-comscore", + "tbfed-pagefooter", + "prism", + "-highlight", + "github-buttons", + "edit-link", + "disqus" + ], + "pluginsConfig": { + "tbfed-pagefooter": { + "modify_label": "最近更新:", + "modify_format": "YYYY-MM-DD HH:mm" + }, + "prism": { + "css": [ + "prismjs/themes/prism-tomorrow.css" + ] + }, + "github-buttons": { + "buttons": [{ + "user": "cyan33", + "repo": "learn-react-source-code", + "type": "star", + "size": "small", + "count": true + }] + }, + "edit-link": { + "base": "https://github.com/cyan33/learn-react-source-code/edit/master/blog", + "label": "Edit This Page" + }, + "sharing": { + "facebook": false, + "twitter": true, + "weibo": true + }, + "disqus": { + "shortName": "gitbook-8" + }, + "anchor-navigation-ex": { + "multipleH1": false + } + }, + "ignores": [ + ".*", + "build", + "_book", + "gitbook", + "node_modules" + ] +}