Clone git repositories with ease from Javascript
MIT License
A smaller and lighter degit alternative with typescript support.
A small CLI wrapper for @begit/core
Run npm i -g @begit/cli
to install. Invoke with begit
For a comprehensive list of features, use the help command as below:
begit --help
Which will print something like:
begit
ARGUMENTS:
<URL> - The URL to clone
[Destination] - a string [optional]
OPTIONS:
--subdir, -s <str> - a string [optional]
FLAGS:
--help, -h - show help
To clone a repository to the current working directory, simply:
begit Tommypop2/begit
URLs are also accepted:
begit https://github.com/Tommypop2/begit
You can also specify the desired branch via a #
:
begit Tommypop2/begit#main
Use any of the above options in conjunction with the --subdir
flag.
begit Tommypop2/begit --subdir packages
Or, shortened to -s
begit Tommypop2/begit -s packages
import { downloadRepo } from "@begit/core";
await downloadRepo({
repo: {
owner: "Tommypop2",
name: "begit",
branch: undefined,
subdir: undefined,
},
"cool_project",
});
The code above downloads this repository into a folder named cool_project
.
Alternatively, downloadAndExtract
could be used in place of downloadRepo
to opt out of automatically attempting to handle errors