0.0.1 • Published 2 years ago

load-repo v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

load-repo npm

You need to make sure git is in your path, otherwise you can move on This is a library based on git-clone development

Install

load-repo

npm install load-repo

Api

loadRepo(repo: string): void

loadRepo(repo: string, path?: string): void

loadRepo(repo: string, path?: string, options?: IOptions): void

loadRepo(repo: string, path?: string, callback?: (error?: Error) => void): void

loadRepo(repo: string, path?: string, options?: IOptions, callback?: (error?: Error) => void): void

// rule: origin:owner/name#branch

const repo = 'github:vtrbo/load-repo#main'
// default value process.cwd()

const path = '/'
/**
 * IOptions
 * {
 *   if clone is true, keep .git; otherwise, delete it
 *   clone: boolean
 *
 *   if branch is undefined, Clone the default branch
 *   branch: string
 * }
 */

const options = {
  clone: true,
  branch: 'main'
}
// if error exists, it means that the download failed; otherwise, it succeeded

const callback = (error: Error) => {
  if (error)
    console.log('download fail')
  else
    console.log('download success')
}

开源许可证

MIT License © 2022-PRESENT Victor Bo