# icms-site

The documentation use VuePress 1.x.

This documentation is built using VuePress 1 (opens new window), a modern static website generator.

The documentation source of icmsite (opens new window)

Online (opens new window)

# Development

# clone the project
git clone git@github.com:wecms/icmsite.git

# install dependency
npm install

# develop
npm run dev
1
2
3
4
5
6
7
8

open http://localhost:8080/icmsite/

Generator by vuepress (opens new window)

# Publish GitHub Pages

命令行切换到工作根目录(icmsite)下,执行 sh deploy.sh,就会开始构建,然后提交到远程仓库,注意这里提交到了 gh-pages 分支。

原理是执行了./deploy.sh脚本,具体步骤可看./deploy.sh脚本内容。

也可以在 package.json 里加一些脚本:

{
  "scripts": {
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs",
    "deploy-gh": "GH=1 yarn docs:build && bash ./deploy-gh.sh"
  }
}
1
2
3
4
5
6
7

它的作用如下:

GH=1:设置一个环境变量 GH 的值为 1,用于在后续的构建脚本和部署脚本中进行判断。注意在 Windows 系统上设置环境变量set GH=1和Linux上不同。

我的直接这样写:"deploy": "sh ./deploy.sh"

yarn docs:build:运行 yarn 命令的 docs:build 脚本,用于构建 VuePress 网站。

bash scripts/deploy-gh.sh:运行 ./deploy-gh.sh 脚本,用于将构建好的网站部署到 GitHub Pages 上。

一篇带你用 VuePress + Github Pages 搭建博客 - 掘金 (opens new window)

部署 VuePress 到 GitHub Pages (超详细) - 掘金 (opens new window)

搭建一个免费的,无限流量的Blog----github Pages和Jekyll入门 - 阮一峰的网络日志 (opens new window)

配置 GitHub Pages 站点的发布源 - GitHub 文档 (opens new window)

虽然可使用自定义 GitHub Actions 工作流进行发布站点,但是限于GitHub Pages网速,这里建议配合Cloudflare Pages使用,Git提交推送后,Cloudflare Pages自动静态页部署。

See detail 配合cloudflare-pages使用-git提交自动静态页部署

# 查看我的站点

Cloudflare Pages master branch build https://blog.prodev.cn/ (opens new window)

Cloudflare Pages master branch build https://icmsite.pages.dev/ (opens new window)

直接使用Git推送到Github,使用Cloudflare Workers and Pages线上编译打包运算能力。

GitHub Pages gh-pages branch static file https://dev.prodev.cn/ (opens new window)

在本地使用自定义命令 npm run deploy 本地编译打包运算能力。然后再推送到gh-pages分支。

# 使用Docusaurus创建的站点

  1. 部署在Github Pages上的 https://doc-github.prodev.cn/ (opens new window)

直接使用Git推送到Github,使用Github Pages线上编译打包运算能力。

或者在本地使用自定义命令 npm run shell 本地编译打包运算能力。然后再推送到gh-pages分支。

  1. 部署在Cloudflare Workers and Pages上的 https://doc-cloudflare.prodev.cn/ (opens new window)

也是直接使用Git推送到Github,使用Cloudflare Workers and Pages线上编译打包运算能力。

# 使用Docusaurus创建的站点参考

  1. Hello from go-things | go-things (opens new window)
  2. K3s - 轻量级 Kubernetes | K3s (opens new window)
  3. Casbin · An authorization library that supports access control models like ACL, RBAC, ABAC (opens new window)
  4. Casdoor · An Open Source UI-first Identity Access Management (opens new window)
  5. SRS (Simple Realtime Server) | SRS (opens new window)
  6. JuiceFS Document Center (opens new window)
  7. Build smaller, faster, and more secure desktop applications with a web frontend | Tauri Apps (opens new window)
  8. 欢迎使用 ent | ent (opens new window)

# 使用VuePress创建的站点

主页 | Simple Admin (opens new window)

主题介绍 | vuepress-theme-hope (opens new window)

# 参考文献

  1. Installation | Docusaurus (opens new window)

  2. Troubleshooting custom domains and GitHub Pages - GitHub Docs (opens new window)

  3. Branch build controls · Cloudflare Pages docs (opens new window)

其他参考文献

博客迁移记 · 从 Cloudflare Workers 到 Cloudflare Pages | TripleZ's Blog (opens new window)

物联网技术指南 (opens new window)

# 站点更新

  1. Publish GitHub Pages
npm run deploy
1

在本地编译打包,并使用脚本自动推送到GitHub Pages下gh-pages分支。

  1. Publish Cloudflare Pages

直接Git push 推送即可。

直接使用Git推送到Github,使用Cloudflare Workers and Pages线上编译打包运算能力,自动编译并更新到站点。