@git.zone/cli
Version:
A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.
30 lines (25 loc) • 948 B
text/typescript
import * as plugins from './plugins.js';
import * as paths from './paths.js';
import { GitzoneConfig } from './classes.gitzoneconfig.js';
import type { TGitzoneProjectType } from './classes.gitzoneconfig.js';
/**
* the Project class is a tool to work with a gitzone project
*/
export class Project {
public static async fromCwd(options: { requireProjectType?: boolean } = {}) {
const gitzoneConfig = await GitzoneConfig.fromCwd();
const project = new Project(gitzoneConfig);
const requireProjectType = options.requireProjectType ?? true;
if (requireProjectType && !project.gitzoneConfig.data.projectType) {
throw new Error('Please define a project type');
}
return project;
}
public gitzoneConfig: GitzoneConfig;
public get type(): TGitzoneProjectType {
return this.gitzoneConfig.data.projectType;
}
constructor(gitzoneConfigArg: GitzoneConfig) {
this.gitzoneConfig = gitzoneConfigArg;
}
}