1.1.6 • Published 3 years ago

@boses/github-clone v1.1.6

Weekly downloads
20
License
MIT
Repository
github
Last release
3 years ago

GitHub-clone

mlt mlt

为了解决国内 GitHub clone 速度慢较慢的工具

注意以下文档书写形式遵循下述规范:

[]代表这个字段必填,<>则为选填,而name?:string,表示这个参数为非必填为string类型。

执行流程

  • 首先将输入的 github.com替换成设置的镜像网站地址,默认为(github.com.cnpmjs.org)
  • 执行 git clone [url] 的操作
  • 拉取镜像完成之后,重写 git 的远程仓库推送地址,将镜像推送地址重置为 github 的镜像地址

CLI 使用方式

安装

yarn global add @boses/github-clone

之后通过g clone <path>形式来使用,更多APIclone的使用方法可以调用g ---help查看。

API

Clone

clone dir <--branch branchName>

  • <path>

    • type:stirng
    • require:true

    拉取 GitHub 仓库 对应的地址,可以拉取以下三种类型地址

    类型说明
    https://github.com/bosens-China/github-clone默认浏览器导航栏的地址
    https://github.com/bosens-China/github-clone.gitGithub 右侧 Code HTTPS 的地址
    git@github.com:bosens-China/breeze-clone.gitGithub 右侧 Code SSH 的地址
  • [dir]

    • type:stirng
    • require:false

    clone 到本地的目录名称

  • --branch [branchName]

    • type:stirng
    • require:false

    指定拉取的分支名称,可以以--branch长形式使用也可以以-b的短形式使用,例如:

    g clone https://github.com/bosens-China/github-clone.git -b dev

set url

  • [url]

    • type:stirng
    • require:true

    用于配置镜像网站

get

返回用户配置的set [url]地址,默认为github.com.cnpmjs.org

Node

安装

yarn add @boses/github-clone
const clone = require('@boses/github-clone');
// 也可以通过es模块引用
// import clone from '@boses/github-clone/gitClone.esm'
clone('https://github.com/SunshowerC/blog');

clone 会以同步的形式运行,记得使用 try 包裹住可能的错误

API

clone: (url: string, options: Partial<Options>) => void

url

  • type:string
  • require: true

拉取的 GitHub 仓库地址

options

名称类型是否必填描述
dirNamestringfalse拉取的目录名称
branchstringfalse拉取的分支名称
mirrorAddressstringfalse镜像网站,如果你需要使用镜像可以填写此网站
silencebooleanfalse是否静默模式执行 clone
cwdstringfalse执行 clone 所执行的目录路径

其他

目前版本更新导致对1.0.9之前的g get不支持,请重新执行g set [url]的操作

如果发现错误或者需要有更好的建议欢迎在 issues 中提出

参考

协议

MIT License

1.1.6

3 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago