add clone functionality

This commit is contained in:
2020-12-20 16:03:47 +01:00
parent 62cb680181
commit 77352b3c10
5 changed files with 30 additions and 11 deletions

View File

@@ -1,11 +1,13 @@
class Model {
constructor() {
constructor(http) {
// Initialize isomorphic-git with a file system
window.fs = new LightningFS("fs");
// I prefer using the Promisified version honestly
window.pfs = window.fs.promises;
window.dir = "/test-clone";
window.dir = "/";
window.http = http;
}
async dirList(dir = "/") {
@@ -36,7 +38,6 @@ class Model {
async dirTree(dir = "/") {
var tree = await this.dirList(dir);
//console.log(tree);
return tree;
}
@@ -44,4 +45,14 @@ class Model {
delete window.fs;
window.fs = new LightningFS("fs", { wipe: true });
}
async cloneRep() {
await git.clone({
fs,
http,
dir,
url: "https://git.microlab.space/microlab/website.git",
corsProxy: "https://cors.isomorphic-git.org",
});
}
}