3 Star 15 Fork 3

小李 / gitage

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

gitage

基于 NodeJS 的 git-pages 服务。

依赖:

  • git
  • nodejs>8

目前支持的托管系统:

概述

gitage 运行在 nodejs 上,依赖 git (gitea, gogs, gitlab) 等托管系统的 web 勾子。

gitage 主要为团队/公司等非公开组织提供一个易于部署的 pages 服务。

gitage 提供 markdown 文件渲染,以及 一些类型 文件的预览支持。

用法

首次运行,需要执行命令 npm run download 下载依赖的第三方包。

npm run build
node dist/gitage.js

服务器配置

配置文件名为 config (区分大小写),放置在部署根目录。

config

# 是否启用调试
DEBUG = false
# 启动服务的IP地址
HOST = 0.0.0.0
# 启动服务的端口
PORT = 1997
# 日志路径,可以指定为绝对路径或相对路径
LOG_PATH = logs
# 日志记录的级别
LOG_LEVEL = info
# 仓库部署路径,可以指定为绝对路径或相对路径
PROJECT_ROOT_PATH = projects
# 仓库检出临时目录,留空使用系统临时目录
PROJECT_CHECKOUT_TMP = 

在无此文件时,使用以上默认配置

注意:配置项名称均使用大写

仓库配置

在仓库下添加文件 gitage.config.json,其格式如下(可选):

{
  "type": "markdown",
  "path": "docs",
  "index": "index.html",
  "tag": true,
  "branch": "master",
  "ignore": [
    "file",
    "dir",
    "..."
  ]
}
  • type 标记部署内容的类型,目前仅支持 markdown,表示内容为 markdown,否则直接留空 区分大小写
  • path 部署目录,默认为 docs
  • index 部署目录下的索引页名称,默认为 index.html/index.md 区分大小写
  • tag 是否仅在收到 tag 时部署,默认为 false (计划中)
  • branch 指定部署的分支,默认为 master (配置文件应该存放在主分支上,以避免无法正常读取)

在仓库的 web hook 上添加地址:

POST http://127.0.0.1:1997/hook/

127.0.0.1 是部署的服务器IP 1997 是部署的端口

type-markdown

type=markdown 时,可以在仓库内指定一个目录 (可以是仓库根目录 /),用于发布文档文件。

在此模式下,会扫描整个部署目录,并自动生成文档树。 每个文件都包含其最后更新的用户/日期以及更新消息。

目前支持 .md|.markdown|.txt|.pdf|.docx 类型文件在线查看。

截图

1

2

常见问题

如果遇到错误信息:

status code: 405
content: Invalid request: method GET not allowed, accept POST only

这可能是仓库的勾子地址不正确,一定要加上末尾的 / 符号。

开发计划

next-version

  • 每个仓库的 checkout 日志,单独写到一个文件中(每次一个文件)
  • 插件支持
  • 优化 wet 性能
The MIT License (MIT) Copyright © 2020 hyjiacan. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于 NodeJS 的 git-pages 服务 展开 收起
NodeJS 等 3 种语言
MIT
取消

发行版 (1)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
NodeJS
1
https://gitee.com/hyjiacan/gitage.git
git@gitee.com:hyjiacan/gitage.git
hyjiacan
gitage
gitage
master

搜索帮助