feat(projectinfo): migrate project info loading to async factories and update build configuration

This commit is contained in:
2026-03-26 08:35:13 +00:00
parent 9e79ea4e70
commit 4a20f31b99
15 changed files with 7519 additions and 4135 deletions

View File

@@ -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);
}
}