(
config: T & Partial<{github: GithubConfig}>,
)
| 185 | |
| 186 | /** Validate th configuration has been met for the ng-dev command. */ |
| 187 | export function assertValidGithubConfig<T extends NgDevConfig>( |
| 188 | config: T & Partial<{github: GithubConfig}>, |
| 189 | ): asserts config is T & {github: GithubConfig} { |
| 190 | const errors: string[] = []; |
| 191 | // Validate the github configuration. |
| 192 | if (config.github === undefined) { |
| 193 | errors.push(`Github repository not configured. Set the "github" option.`); |
| 194 | } else { |
| 195 | if (config.github.name === undefined) { |
| 196 | errors.push(`"github.name" is not defined`); |
| 197 | } |
| 198 | if (config.github.owner === undefined) { |
| 199 | errors.push(`"github.owner" is not defined`); |
| 200 | } |
| 201 | if (config.github.mergeMode === undefined) { |
| 202 | errors.push(`"github.mergeMode" is not defined`); |
| 203 | } |
| 204 | } |
| 205 | if (errors.length) { |
| 206 | throw new ConfigValidationError('Invalid `github` configuration', errors); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | /** Retrieve and validate the config as `CaretakerConfig`. */ |
| 211 | export function assertValidCaretakerConfig<T extends NgDevConfig>( |
no test coverage detected