Saber2pr's Blog

网站架构和技术栈

这是网站工程依赖的第三方库

  1. dependencies 生产环境依赖
{
  "@saber2pr/md2jsx": "^0.0.7",
  "@saber2pr/memo": "^0.0.2",
  "@saber2pr/rc-audio": "^0.0.9",
  "@saber2pr/rc-gitment": "^0.0.4",
  "@saber2pr/rc-tree": "^0.1.4",
  "@saber2pr/react-router": "^0.0.2",
  "@saber2pr/redux": "^0.1.1",
  "@saber2pr/request": "^0.1.2",
  "@saber2pr/secret": "^0.0.4",
  "@saber2pr/tree-lang": "^0.0.9",
  "@types/react": "^16.8.19",
  "@types/react-dom": "^16.8.4",
  "animate.css": "^3.7.2",
  "normalize.css": "^8.0.1",
  "react": "^16.8.6",
  "react-dom": "^16.8.6"
}
  1. devDependencies 开发环境依赖
{
  "@saber2pr/gen-comp": "^0.0.1",
  "@saber2pr/gen-index": "^0.0.2",
  "@saber2pr/git": "^0.0.2",
  "@saber2pr/node": "^0.3.0",
  "@saber2pr/webpack-configer": "0.0.9",
  "cross-env": "^5.2.0",
  "css-loader": "^2.1.1",
  "extract-text-webpack-plugin": "^4.0.0-beta.0",
  "html-webpack-plugin": "^3.2.0",
  "less": "^3.9.0",
  "less-loader": "^5.0.0",
  "less-plugin-clean-css": "^1.5.1",
  "style-loader": "^0.23.1",
  "ts-loader": "^6.0.2",
  "ts-node": "^8.3.0",
  "typescript": "^3.6.3",
  "url-loader": "^2.0.0",
  "webpack": "^4.33.0",
  "webpack-cli": "^3.3.3",
  "webpack-dev-server": "^3.7.1"
}

基本都是很常见的库和技术栈。UI 库使用 react、redux、react-router。语言使用 typescript、less。构建工具使用 webpack。 网站托管在 github 服务器,由阿里云 DNS 解析从https://saber2pr.top指向https://saber2pr.github.io。

网站博客在 blog 文件夹内编写 markdown 文件。执行构建命令将解析 blog 目录树生成目录数据和修改日志。

博客异步更新,使用 HTTP 请求服务器上的 markdown 文本资源,然后解析、呈现。

评论功能需要使用 github 帐号登录,使用 access_token 进行身份认证(OAuth),在本地缓存 token。


2020/1/27 更新:

把评论功能先去掉了,因为涉及到 access_token 获取的跨域反代问题,目前还是基于 githubpage 的后端环境,所以无法实现。

原方案是利用免费的反代服务 cors-anywhere,但速度太慢所以放弃了。