in src/lib/util/utils.ts [414:439]
export function gitClone(url: string, directory: string) {
if (url === null || url === undefined || typeof url.valueOf() !== "string" || !url.trim().length) {
throw new Error("url is a required parameter of type string and it cannot be an empty string.")
}
if (directory === null || directory === undefined || typeof directory.valueOf() !== "string" || !directory.trim().length) {
throw new Error("directory is a required parameter of type string and it cannot be an empty string.")
}
// If the directory exists then we assume that the repo to be cloned is already present.
if (fs.existsSync(directory)) {
if (!fs.lstatSync(directory).isDirectory()) {
throw new Error(`"${directory}" must be a directory.`)
}
return
} else {
fs.mkdirSync(directory)
}
try {
const cmd = `git clone ${url} ${directory}`
execSync(cmd, { encoding: "utf8" })
} catch (err) {
throw new Error(`An error occurred while cloning git repository: ${util.inspect(err, { depth: null })}.`)
}
}