forked from netlify/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
72 lines (62 loc) · 2.02 KB
/
types.d.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
import type { NetlifyConfig } from "@netlify/build";
import type { NetlifyTOML } from '@netlify/build-info'
import type { NetlifyAPI } from 'netlify'
import StateConfig from '../utils/state-config.js'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type $TSFixMe = any;
export type NetlifySite = {
root?: string
configPath?: string
siteId?: string
get id(): string | undefined
set id(id: string): void
}
type PatchedConfig = NetlifyTOML & Pick<NetlifyConfig, 'images'> & {
functionsDirectory?: string
build: NetlifyTOML['build'] & {
functionsSource?: string
}
dev: NetlifyTOML['dev'] & {
functions?: string
processing?: DevProcessing
}
}
type DevProcessing = {
html?: HTMLProcessing
}
type HTMLProcessing = {
injections?: HTMLInjection[]
}
type HTMLInjection = {
/**
* The location at which the `html` will be injected.
* Defaults to `before_closing_head_tag` which will inject the HTML before the </head> tag.
*/
location?: 'before_closing_head_tag' | 'before_closing_body_tag',
/**
* The injected HTML code.
*/
html: string
}
type EnvironmentVariableScope = 'builds' | 'functions' | 'runtime' | 'post_processing'
type EnvironmentVariableSource = 'account' | 'addons' | 'configFile' | 'general' | 'internal' | 'ui'
export type EnvironmentVariables = Record<string, { sources: EnvironmentVariableSource[], value: string; scopes?: EnvironmentVariableScope[] }>
/**
* The netlify object inside each command with the state
*/
export type NetlifyOptions = {
// poorly duck type the missing api functions
api: NetlifyAPI & Record<string, (...args: $TSFixMe) => Promise<$TSFixMe>>
apiOpts: $TSFixMe
repositoryRoot: string
/** Absolute path of the netlify configuration file */
configFilePath: string
/** Relative path of the netlify configuration file */
relConfigFilePath: string
site: NetlifySite
siteInfo: $TSFixMe
config: PatchedConfig
cachedConfig: Record<string, $TSFixMe> & { env: EnvironmentVariables }
globalConfig: $TSFixMe
state: StateConfig
}