1.0.4 • Published 4 years ago

daegr v1.0.4

Weekly downloads
3
License
MIT
Repository
-
Last release
4 years ago

DAEGR

Download and extract a GitHub repository.

CLI usage:

Usage
    $ daegr <repo> <path> [options]

Options
    -b, --branch     The branch to be used. (defaults to `master`)
    -v, --version    Displays current version
    -h, --help       Displays this message

Examples
    $ daegr gatsbyjs/gastby my-gatsby
    $ daegr kartiknair/dhow .

JS usage:

DEGR exports a single function which takes an options object as it's only parameter. Here's an example of using it:

const daegr = require('daegr')

;(async () => {
    await daegr({
        username: 'kartiknair',
        repo: 'dhow',
        path: 'examples/blog',
        branch: 'master',
        directory: './dhow-blog',
    })
})()

The JSDOC comment explains the options & their parameters a bit better:

/**
 * Download & extract a github repo
 * @param {Object} options
 * @param {string} options.username - Username of the repositories owner
 * @param {string} options.repo - Name of the repository
 * @param {string} [options.branch=master] - Optional branch to use (defaults to master)
 * @param {string} [options.path] - Optional path to get a nested directory within the repo
 * @param {string} options.directory - Directory where downloaded files should be saved
 */
async function downloadAndExtractGithubRepo({

Credit:

This is basically directly taken from create-next-app's source code. Just needed an easy way to use in multiple projects without copy-pasting.

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago