try isogit

This commit is contained in:
dylan
2024-03-25 21:35:58 -07:00
parent 67e4bb3e6d
commit 2301a5f43c
3 changed files with 1505 additions and 432 deletions

View File

@ -1,5 +1,8 @@
import { Type } from "@sinclair/typebox";
import { FirRouteInput, FirRouteOptions } from "../util/routewrap.js";
import fs from "fs";
import git from "isomorphic-git";
import http from "isomorphic-git/http/node";
const method = "POST";
const url = "/api/release";
@ -10,10 +13,27 @@ const url = "/api/release";
const payloadT = Type.Any();
const handler = ({payload}: FirRouteInput<typeof payloadT>) => {
const {png} = payload;
console.log(png);
// return payload;
const handler = async ({payload}: FirRouteInput<typeof payloadT>) => {
const {manifest, token} = payload;
if (!fs.existsSync("./repos")) {
fs.mkdirSync("./repos", {recursive: true})
}
await git.clone({
fs,
http,
headers: {
"Authentication": `token ${token}`,
},
dir: "./repos",
url: manifest.repo,
});
const localManifest = JSON.parse(await fs.promises.readFile("./repos/picobook.json", "utf8"));
fs.promises.rm("./repos");
console.log({
manifest,
localManifest,
});
return true;
};
export default {