Files
projectinfo/ts/projectinfo.classes.projectinfo.ts

28 lines
797 B
TypeScript
Raw Normal View History

2022-04-18 22:16:46 +02:00
import * as plugins from './projectinfo.plugins.js';
import { ProjectinfoNpm } from './projectinfo.classes.npm.js';
import { ProjectinfoGit } from './projectinfo.classes.git.js';
2018-09-02 14:21:05 +02:00
export type TProjectType = 'git' | 'npm';
2016-11-26 14:45:56 +01:00
/**
* class projectinfo automatically examines a given directory and exposes relevant info about it
*/
export class ProjectInfo {
type: TProjectType = 'git';
2018-09-02 14:21:05 +02:00
npm: ProjectinfoNpm;
git: ProjectinfoGit;
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);
2018-09-02 14:21:05 +02:00
}
}