renovate/lib/config/defaults.ts
2021-08-17 07:57:45 +02:00

26 lines
587 B
TypeScript

import { getOptions } from './options';
import type { AllConfig, RenovateOptions } from './types';
const defaultValues = {
boolean: true,
array: [],
string: null,
object: null,
};
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;
}