@begit/core
v0.3.3
Published
Fast tool for cloning git repositories, with no reliance on local `git`, or `tar` installs
Readme
Begit Core
Cloning to a directory
import { downloadRepo } from "@begit/core";
await downloadRepo({
repo: {
owner: "Tommypop2",
name: "begit",
branch: undefined,
subdir: undefined,
},
dest: "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
Providing a custom commit hash
import { downloadRepo } from "@begit/core";
const custom_hash = "9e4e51beb1ac76e6c37be1757f14b904617a2f9b";
await downloadRepo({
repo: {
owner: "Tommypop2",
name: "begit",
branch: undefined,
subdir: undefined,
hash: custom_hash,
},
dest: "cool_project",
});Fetching the most recent cached commit
import { downloadRepo } from "@begit/core";
const most_recent_hash = await getMostRecentCachedCommit("Tommypop2", "begit"); // string | undefined
await downloadRepo({
repo: {
owner: "Tommypop2",
name: "begit",
branch: undefined,
subdir: undefined,
hash: most_recent_hash,
},
dest: "cool_project",
});Using a fetcher
import { downloadRepo, matchFetcher } from "@begit/core";
const fetcher = matchFetcher("github");
await downloadRepo({
repo: {
owner: "Tommypop2",
name: "begit",
branch: undefined,
subdir: undefined,
hash: most_recent_hash,
},
dest: "cool_project",
}, fetcher);