-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.ts
52 lines (35 loc) · 808 Bytes
/
models.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { ChildProcess } from 'child_process';
import { WriteStream } from 'fs';
const EMPTY_STRING = '';
export interface Project
{
name: string
cwd: string;
command: string;
file?: boolean;
args?: string[];
enabled?: boolean;
delay?: number;
currentProcess?: ChildProcess;
logFile?: string;
logStream?: WriteStream;
}
export interface Play
{
name: string;
projects?: Project[];
}
export interface ProjectHandler
{
name: string;
desc: string;
files: string[];
/**
* Checks whether a found project matches this handler.
*/
extract(path: string, content: string): Array<Project> | Promise<Array<Project>>;
}
export function playToString(play: Play): string {
if (!play) return EMPTY_STRING;
return `${play.name} (${(play.projects || []).length})`;
}