You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
527 B
25 lines
527 B
2 years ago
|
const childProcess = require("child_process");
|
||
|
|
||
|
class Git {
|
||
|
|
||
|
static clone(repoURL, cwd, targetDir = ".") {
|
||
|
let result = childProcess.spawnSync("git", [
|
||
|
"clone",
|
||
|
repoURL,
|
||
|
targetDir,
|
||
|
], {
|
||
|
cwd: cwd,
|
||
|
});
|
||
|
|
||
|
if (result.status !== 0) {
|
||
|
throw new Error(result.stderr.toString("utf-8"));
|
||
|
} else {
|
||
|
return result.stdout.toString("utf-8") + result.stderr.toString("utf-8");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
Git,
|
||
|
};
|