mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-14 08:36:26 +00:00
26 lines
600 B
TypeScript
26 lines
600 B
TypeScript
import { getOptions, RenovateOptions } from './definitions';
|
|
import { RenovateConfig } from './common';
|
|
|
|
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(): RenovateConfig {
|
|
const options = getOptions();
|
|
const config: RenovateConfig = {};
|
|
options.forEach(option => {
|
|
if (!option.parent) {
|
|
config[option.name] = getDefault(option);
|
|
}
|
|
});
|
|
return config;
|
|
}
|