mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
982cefff2b
* refactor(config): strict null checks * chore: fix test
27 lines
613 B
TypeScript
27 lines
613 B
TypeScript
import { getOptions } from './options';
|
|
import type { AllConfig, RenovateOptions } from './types';
|
|
|
|
const defaultValues = {
|
|
boolean: true,
|
|
array: [],
|
|
string: null,
|
|
object: null,
|
|
integer: null,
|
|
} as const;
|
|
|
|
export function getDefault(option: RenovateOptions): any {
|
|
return option.default === undefined
|
|
? defaultValues[option.type]
|
|
: option.default;
|
|
}
|
|
|
|
export function getConfig(): AllConfig {
|
|
const options = getOptions();
|
|
const config: AllConfig = {};
|
|
options.forEach((option) => {
|
|
if (!option.parent) {
|
|
config[option.name] = getDefault(option);
|
|
}
|
|
});
|
|
return config;
|
|
}
|