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 {
|
2026-03-26 08:35:13 +00:00
|
|
|
type: TProjectType = 'git';
|
2018-09-02 14:21:05 +02:00
|
|
|
npm: ProjectinfoNpm;
|
|
|
|
|
git: ProjectinfoGit;
|
2026-03-26 08:35:13 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|