try isogit
This commit is contained in:
		| @@ -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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 dylan
					dylan