refactor: config/definitions -> config/options

This commit is contained in:
Rhys Arkins 2021-08-15 07:25:30 +02:00
Родитель bb37aa82fd
Коммит 750bc1656e
16 изменённых файлов: 30 добавлений и 30 удалений

Просмотреть файл

@ -1,6 +1,6 @@
const fs = require('fs');
const upath = require('upath');
const { getOptions } = require('../lib/config/definitions');
const { getOptions } = require('../lib/config/options');
const schema = {
title: 'JSON schema for Renovate config files (https://renovatebot.com/)',

Просмотреть файл

@ -22,7 +22,7 @@ The above are listed in **_reverse order_** of preference. e.g. CLI values will
### Default Configuration
The default configuration values can be found in [lib/config/definitions.ts](../../lib/config/definitions.ts).
The default configuration values can be found in [lib/config/options/index.ts](../../lib/config/options/index.ts).
Options which have `"admin": true` are reserved only for bot admin configuration and cannot be configured within repository config files.
### Configuration File
@ -75,4 +75,4 @@ If you add configuration options to your `package.json` then these will override
Please see [https://docs.renovatebot.com/configuration-options/](https://docs.renovatebot.com/configuration-options/) for a list of user-facing configuration options.
For further options when running your own instance of Renovate, please see the full config definitions file at `lib/config/definitions.ts`.
For further options when running your own instance of Renovate, please see the full config options file at `lib/config/options/index.ts`.

Просмотреть файл

@ -191,7 +191,7 @@ The example command will delete any existing `debug.log` and then save Renovate'
We want stay backwards-compatible as much as possible, as well as make the code configurable.
So most new functionality should be controllable via configuration options.
Create your new configuration option in the `lib/config/definitions.ts` file.
Create your new configuration option in the `lib/config/options/index.ts` file.
Also create documentation for the option in the `website/docs/configuration-options.md` file.
## Debugging

Просмотреть файл

@ -1,4 +1,4 @@
import { getOptions } from './definitions';
import { getOptions } from './options';
import type { AllConfig, RenovateOptions } from './types';
const defaultValues = {

Просмотреть файл

@ -1,6 +1,6 @@
import { logger } from '../logger';
import { get, getLanguageList, getManagerList } from '../manager';
import * as definitions from './definitions';
import * as options from './options';
import type {
AllConfig,
ManagerConfig,
@ -41,7 +41,7 @@ export function filterConfig(
const outputConfig: RenovateConfig = { ...inputConfig };
const stages = ['global', 'repository', 'package', 'branch', 'pr'];
const targetIndex = stages.indexOf(targetStage);
for (const option of definitions.getOptions()) {
for (const option of options.getOptions()) {
const optionIndex = stages.indexOf(option.stage);
if (optionIndex !== -1 && optionIndex < targetIndex) {
delete outputConfig[option.name];

Просмотреть файл

@ -1,6 +1,6 @@
import is from '@sindresorhus/is';
import { clone } from '../util/clone';
import { getOptions } from './definitions';
import { getOptions } from './options';
import type { PackageRule, RenovateConfig, UpdateType } from './types';
const options = getOptions();

Просмотреть файл

@ -4,7 +4,7 @@ import { dequal } from 'dequal';
import { logger } from '../logger';
import { clone } from '../util/clone';
import { getAdminConfig } from './admin';
import { getOptions } from './definitions';
import { getOptions } from './options';
import { removedPresets } from './presets/common';
import type {
MigratedConfig,

Просмотреть файл

@ -1,7 +1,7 @@
import { getName } from '../../test/util';
import { getOptions } from './definitions';
import { getName } from '../../../test/util';
import { getOptions } from '.';
jest.mock('../manager', () => ({
jest.mock('../../manager', () => ({
getManagers: jest.fn(() => new Map().set('testManager', {})),
}));

Просмотреть файл

@ -1,10 +1,10 @@
import { PLATFORM_TYPE_GITHUB } from '../constants/platforms';
import { getManagers } from '../manager';
import { getPlatformList } from '../platform';
import { getVersioningList } from '../versioning';
import * as dockerVersioning from '../versioning/docker';
import * as pep440Versioning from '../versioning/pep440';
import type { RenovateOptions } from './types';
import { PLATFORM_TYPE_GITHUB } from '../../constants/platforms';
import { getManagers } from '../../manager';
import { getPlatformList } from '../../platform';
import { getVersioningList } from '../../versioning';
import * as dockerVersioning from '../../versioning/docker';
import * as pep440Versioning from '../../versioning/pep440';
import type { RenovateOptions } from '../types';
const options: RenovateOptions[] = [
{

Просмотреть файл

@ -1,6 +1,6 @@
import { logger } from '../logger';
import { clone } from '../util/clone';
import * as definitions from './definitions';
import * as options from './options';
import type { RenovateConfig } from './types';
export function mergeChildConfig<T, TChild>(
@ -14,7 +14,7 @@ export function mergeChildConfig<T, TChild>(
const parentConfig = clone(parent);
const childConfig = clone(child);
const config: Record<string, any> = { ...parentConfig, ...childConfig };
for (const option of definitions.getOptions()) {
for (const option of options.getOptions()) {
if (
option.mergeable &&
childConfig[option.name] &&

Просмотреть файл

@ -3,8 +3,8 @@ import { getLanguageList, getManagerList } from '../manager';
import { configRegexPredicate, isConfigRegex, regEx } from '../util/regex';
import * as template from '../util/template';
import { hasValidSchedule, hasValidTimezone } from '../workers/branch/schedule';
import { getOptions } from './definitions';
import { migrateConfig } from './migration';
import { getOptions } from './options';
import { resolveConfigPresets } from './presets';
import type {
RenovateConfig,

Просмотреть файл

@ -1,5 +1,5 @@
import { getName } from '../../../test/util';
import { getOptions } from '../../config/definitions';
import { getOptions } from '../../config/options';
import * as template from '.';
describe(getName(), () => {

Просмотреть файл

@ -1,4 +1,4 @@
import { getOptions } from '../config/definitions';
import { getOptions } from '../config/options';
import { loadModules } from '../util/modules';
import { isVersioningApiConstructor } from './common';
import { GenericVersion, GenericVersioningApi } from './loose/generic';

Просмотреть файл

@ -1,6 +1,6 @@
import { Command } from 'commander';
import { version } from '../../../../../package.json';
import { getOptions } from '../../../../config/definitions';
import { getOptions } from '../../../../config/options';
import type { AllConfig, RenovateOptions } from '../../../../config/types';
export function getCliName(option: Partial<RenovateOptions>): string {

Просмотреть файл

@ -1,6 +1,6 @@
import is from '@sindresorhus/is';
import { getOptions } from '../../../../config/definitions';
import { getOptions } from '../../../../config/options';
import type { AllConfig, RenovateOptions } from '../../../../config/types';
import { PLATFORM_TYPE_GITHUB } from '../../../../constants/platforms';
import { getDatasourceList } from '../../../../datasource';

Просмотреть файл

@ -1,5 +1,5 @@
import fs from 'fs';
import { getOptions } from '../lib/config/definitions';
import { getOptions } from '../lib/config/options';
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
@ -71,7 +71,7 @@ describe('docs', () => {
expect(headers3).toEqual(expectedOptions3);
});
// Checking relatedOptions field in definitions
// Checking relatedOptions field in options
const relatedOptionsMatrix = options
.filter((option) => option.relatedOptions)
.map((option) => option.relatedOptions)
@ -89,13 +89,13 @@ describe('docs', () => {
if (received.includes(argument)) {
return {
message: (): string =>
`Option "${argument}" should be within definitions`,
`Option "${argument}" should be within options`,
pass: true,
};
}
return {
message: (): string =>
`Option "${argument}" doesn't exist within definitions`,
`Option "${argument}" doesn't exist within options`,
pass: false,
};
},