feat(projectinfo): migrate project info loading to async factories and update build configuration
This commit is contained in:
@@ -7,14 +7,21 @@ export type TProjectType = 'git' | 'npm';
|
||||
* class projectinfo automatically examines a given directory and exposes relevant info about it
|
||||
*/
|
||||
export class ProjectInfo {
|
||||
type: TProjectType;
|
||||
type: TProjectType = 'git';
|
||||
npm: ProjectinfoNpm;
|
||||
git: ProjectinfoGit;
|
||||
/**
|
||||
* constructor of class ProjectInfo
|
||||
*/
|
||||
constructor(cwdArg: string) {
|
||||
this.npm = new ProjectinfoNpm(cwdArg);
|
||||
this.git = new ProjectinfoGit(cwdArg);
|
||||
|
||||
private constructor(npm: ProjectinfoNpm, git: ProjectinfoGit) {
|
||||
this.npm = npm;
|
||||
this.git = git;
|
||||
if (npm.isNpm) {
|
||||
this.type = 'npm';
|
||||
}
|
||||
}
|
||||
|
||||
static async create(cwdArg: string): Promise<ProjectInfo> {
|
||||
const npm = await ProjectinfoNpm.create(cwdArg);
|
||||
const git = new ProjectinfoGit(cwdArg);
|
||||
return new ProjectInfo(npm, git);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user