Refactor Git to accept a nostr object

This commit is contained in:
Alex Gleason committed 2025-09-21 14:31:13 -05:00
1 parent f797ec55c5
commit 69c1000063
16 files changed
+184 -379

No files matched your search

+12 -3
View File
@@ -1,7 +1,14 @@
import git from 'isomorphic-git';
import http from 'isomorphic-git/http/web';
import type { NPool } from '@nostrify/nostrify';
import type { JSRuntimeFS } from './JSRuntime';
export interface GitOptions {
fs: JSRuntimeFS;
nostr: NPool;
corsProxy?: string;
}
/**
* Git class that wraps isomorphic-git and provides a cleaner interface.
* Instantiate with an fs implementation, optional corsProxy string, and optional corsProxyRegex.
@@ -10,11 +17,13 @@ import type { JSRuntimeFS } from './JSRuntime';
*/
export class Git {
private fs: JSRuntimeFS;
private nostr: NPool;
private corsProxy?: string;
constructor(fs: JSRuntimeFS, corsProxy?: string) {
this.fs = fs;
this.corsProxy = corsProxy;
constructor(options: GitOptions) {
this.fs = options.fs;
this.nostr = options.nostr;
this.corsProxy = options.corsProxy;
}
// Repository initialization and configuration