-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathtools.ts
More file actions
34 lines (29 loc) · 948 Bytes
/
tools.ts
File metadata and controls
34 lines (29 loc) · 948 Bytes
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
export const MONOREPO_TOOLS = ['nx', 'turbo', 'yarn', 'pnpm', 'npm'] as const;
export type MonorepoTool = (typeof MONOREPO_TOOLS)[number];
export type MonorepoToolHandler = {
tool: MonorepoTool;
isConfigured: (options: MonorepoHandlerOptions) => Promise<boolean>;
listProjects: (options: MonorepoHandlerOptions) => Promise<ProjectConfig[]>;
createRunManyCommand: (
options: MonorepoHandlerOptions,
projects: MonorepoHandlerProjectsContext,
) => string | Promise<string>;
};
export type MonorepoHandlerOptions = {
task: string;
cwd: string;
parallel: boolean | number;
nxProjectsFilter: string | string[];
};
export type MonorepoHandlerProjectsContext = {
only?: string[];
all: ProjectConfig[];
};
export type ProjectConfig = {
name: string;
bin: string;
directory?: string;
};
export function isMonorepoTool(value: string): value is MonorepoTool {
return MONOREPO_TOOLS.includes(value as MonorepoTool);
}