try isogit
This commit is contained in:
		
							
								
								
									
										1904
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1904
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -33,9 +33,10 @@ | |||||||
|     "@sinclair/typebox": "^0.31.5", |     "@sinclair/typebox": "^0.31.5", | ||||||
|     "dotenv": "^16.4.5", |     "dotenv": "^16.4.5", | ||||||
|     "fastify": "^4.22.0", |     "fastify": "^4.22.0", | ||||||
|  |     "isomorphic-git": "^1.25.6", | ||||||
|  |     "react-pico-8": "^4.1.0", | ||||||
|     "react-router-dom": "^6.18.0", |     "react-router-dom": "^6.18.0", | ||||||
|     "uuid": "^9.0.1", |     "uuid": "^9.0.1" | ||||||
|     "react-pico-8": "^4.1.0" |  | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "@databases/pg-migrations": "^5.0.2", |     "@databases/pg-migrations": "^5.0.2", | ||||||
|   | |||||||
| @@ -1,5 +1,8 @@ | |||||||
| import { Type } from "@sinclair/typebox"; | import { Type } from "@sinclair/typebox"; | ||||||
| import { FirRouteInput, FirRouteOptions } from "../util/routewrap.js"; | 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 method = "POST"; | ||||||
| const url = "/api/release"; | const url = "/api/release"; | ||||||
| @@ -10,10 +13,27 @@ const url = "/api/release"; | |||||||
|  |  | ||||||
| const payloadT = Type.Any(); | const payloadT = Type.Any(); | ||||||
|  |  | ||||||
| const handler = ({payload}: FirRouteInput<typeof payloadT>) => { | const handler = async ({payload}: FirRouteInput<typeof payloadT>) => { | ||||||
| 	const {png} = payload; | 	const {manifest, token} = payload; | ||||||
| 	console.log(png); | 	if (!fs.existsSync("./repos")) { | ||||||
| 	// return payload; | 		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 { | export default { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 dylan
					dylan