smartgit/ts/smartgit.classes.smartgit.ts

36 lines
1002 B
TypeScript
Raw Normal View History

2022-07-31 13:14:18 +00:00
import * as plugins from './smartgit.plugins.js';
import { GitRepo } from './smartgit.classes.gitrepo.js';
export class Smartgit {
public smartenvInstance = new plugins.smartenv.Smartenv();
public envDeps: {
fs: any;
http: any;
} = {
fs: null,
http: null
}
constructor() {};
public async init() {
if (this.smartenvInstance.isNode) {
2022-07-31 13:14:18 +00:00
this.envDeps.fs = await this.smartenvInstance.getSafeNodeModule('fs');
this.envDeps.http = await this.smartenvInstance.getSafeNodeModule('isomorphic-git/http/node/index.js');
}
};
public async createRepoByClone(fromUrlArg: string, toDirArg: string) {
const repo = await GitRepo.fromCloningIntoDir(this, fromUrlArg, toDirArg)
};
public async createRepoByInit(dirArg: string) {
const repo = await GitRepo.fromCreatingRepoInDir(this, dirArg);
return repo;
};
public async createRepoByOpen(dirArg: string) {
const repo = await GitRepo.fromOpeningRepoDir(this, dirArg);
return repo;
}
}