-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinterfaces.ts
74 lines (63 loc) · 1.6 KB
/
interfaces.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { Context } from './counsel' // eslint-disable-line no-unused-vars
import { createLogger } from './logger'
import * as fs from 'fs-extra'
import * as path from 'path'
export interface Context {
assumeYes?: boolean
logger: ReturnType<typeof createLogger>
ctxKey: string
/**
* parsed package.json of target project
*/
packageJson: any
/**
* filename of target project's package.json
*/
packageJsonFilename: string
/**
* golden copy of target project package.json
*/
packageJsonPristine: any
/**
* dirname of project to apply counsel too
*/
projectDirname: string
}
export interface ContextWithRule<R extends Rule> {
rule: R
ctx: Context
}
export interface ContextWithRules {
rules: Rule[]
ctx: Context
}
export interface CreateContextOptions {
logLevel?: string
}
export type Dependency = { name: string; range: string }
export type Migration = null | (() => void | Promise<void>)
export type Rule = {
check?: (opts: TaskPayload<any>) => Promise<any> | any
plan?: (opts: TaskPayload<any>) => Promise<Migration> | Migration
name: string
dependencies?: Dependency[]
devDependencies?: Dependency[]
}
export interface DependencyOverrides {
dependencies: Dependency[]
add: Dependency[]
subtract: Dependency[]
}
export interface InstallDependenciesOptions {
ctx: Context
dependencies: Dependency[]
development?: boolean
packageManager?: string
}
export interface TaskPayload<R extends Rule = Rule> extends ContextWithRule<R> {
fs: typeof fs
path: typeof path
}
export interface WithMigrations extends ContextWithRules {
migrations: Migration[]
}