@trackcity/plugins
Version:
Trackcity Plugin base
66 lines (55 loc) • 1.61 kB
TypeScript
import { WorkspaceManager } from "@trackcity/managers";
import { FlapsLogger } from "flaps-logger";
import { Workspace } from "trackcity";
export abstract class TrackcityPlugin {
private pluginData?: TrackcityData;
private workspace?: Workspace;
private workspaceInit: WorkspaceManager;
/**
* Creates a logger
* The name field is optional
* @param name Optional Field
*/
createLogger(name?: string): FlapsLogger;
/**
* Returns the current workspace
*/
getWorkspace(): Workspace;
/**
* Returns the current plugin data got from npm.trackcity.json
* This would be null or the plugin wont load if that plugin doesn't exist
*/
getPluginData(): TrackcityData;
/**
* Gets the workspace manager
*/
getWorkspaceManager(): WorkspaceManager;
/**
* Called when ran the command
* @param argv process.argv
*/
abstract onStart(argv: string[]): void;
/**
* Called when the plugins all load and initilized
*/
onInit(): void;
/**
* Do not use this or your plugin wont load.
* Only used with trackcity cli to read Trackcity npm.trackcity.json and turning it to a object.
* @param data
*/
init(data: TrackcityData, workspace: Workspace): void
}
export type Github = {
url: string,
}
export type TrackcityData = {
name: string,
version: string,
description?: string,
main: string,
license: string,
author: string,
github?: Github,
isPlugin: boolean,
}