@tinyfe/clone-git-repo
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

clone-git-repo

download git repo

Usage

import { download, downloadPromisify } from '@tinyfe/clone-git-repo';
// sync download the repo from a git repository
download('Rain120/mini-webpack', './clone/' /* execute absolute path */, {
  clone: true,
});

// async download the repo from a git repository
(
  async () => {
    await downloadPromisify('Rain120/mini-webpack', './clone/' /* execute absolute path */, {
      clone: true,
    }).catch(err => {
      console.log(err);
    });
    console.log('done');
  },
)();

Apis

download(repo: string, dest: string, opts?: OptionTypes, cb?: Fn)

  • repo: string, support GitHub, gitlab, bitbucket Username/repoName, eg: 'Rain120/mini-webpack'

  • dest: string download path, eg: './clone'

  • opts

    • plugins

      type plugins = (...args: any[]) => [Repository, DownloadUrl];
      
      type DownloadUrl = string;
      
      interface Repository {
        type?: string;
        owner?: string;
        name?: string;
        checkout?: string;
      }

      custom set the repo info and

    • clone: boolean

      clone the repo

  • cb callback after download git repository

Package Sidebar

Install

npm i @tinyfe/clone-git-repo

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

32.9 kB

Total Files

35

Last publish

Collaborators

  • rain120