renovate/lib/config/common.ts

197 lines
4.3 KiB
TypeScript
Raw Normal View History

import { LogLevel } from 'bunyan';
2020-05-01 16:03:48 +00:00
import { Range } from 'semver';
import { HostRule } from '../types';
2019-08-23 13:46:31 +00:00
export type RenovateConfigStage =
| 'global'
| 'repository'
| 'package'
| 'branch'
| 'pr';
export interface GroupConfig extends Record<string, unknown> {
branchName?: string;
branchTopic?: string;
}
2019-08-23 13:46:31 +00:00
// TODO: Proper typings
export interface RenovateSharedConfig {
automerge?: boolean;
branchPrefix?: string;
branchName?: string;
2020-05-03 08:14:22 +00:00
manager?: string;
commitMessage?: string;
2019-08-23 13:46:31 +00:00
enabled?: boolean;
enabledManagers?: string[];
2020-05-03 08:14:22 +00:00
fileMatch?: string[];
group?: GroupConfig;
groupName?: string;
groupSlug?: string;
2020-05-03 08:14:22 +00:00
includePaths?: string[];
ignoreDeps?: string[];
ignorePaths?: string[];
labels?: string[];
2019-08-23 13:46:31 +00:00
managers?: string | string[];
masterIssueApproval?: boolean;
npmrc?: string;
platform?: string;
postUpgradeTasks?: PostUpgradeTasks;
prBodyColumns?: string[];
prCreation?: 'immediate' | 'not-pending' | 'status-success' | 'approval';
productLinks?: Record<string, string>;
prPriority?: number;
rebaseLabel?: string;
rebaseWhen?: string;
recreateClosed?: boolean;
requiredStatusChecks?: string[];
schedule?: string[];
semanticCommits?: boolean;
semanticCommitScope?: string;
2019-08-23 13:46:31 +00:00
semanticCommitType?: string;
statusCheckVerify?: boolean;
suppressNotifications?: string[];
timezone?: string;
unicodeEmoji?: boolean;
}
export interface GlobalConfig {
prBanner?: string;
prFooter?: string;
}
export interface RenovateAdminConfig {
2020-02-04 05:59:13 +00:00
allowedPostUpgradeCommands?: string[];
autodiscover?: boolean;
autodiscoverFilter?: string;
baseDir?: string;
cacheDir?: string;
configWarningReuseIssue?: boolean;
dryRun?: boolean;
endpoint?: string;
global?: GlobalConfig;
localDir?: string;
logFile?: string;
logFileLevel?: LogLevel;
logLevel?: LogLevel;
logContext?: string;
onboarding?: boolean;
onboardingBranch?: string;
onboardingPrTitle?: string;
onboardingConfig?: RenovateSharedConfig;
platform?: string;
postUpdateOptions?: string[];
privateKey?: string | Buffer;
repositories?: RenovateRepository[];
requireConfig?: boolean;
trustLevel?: 'low' | 'high';
2019-08-23 13:46:31 +00:00
}
2020-02-04 05:59:13 +00:00
export type PostUpgradeTasks = {
commands?: string[];
fileFilters?: string[];
};
2019-08-23 13:46:31 +00:00
type UpdateConfig<
T extends RenovateSharedConfig = RenovateSharedConfig
> = Partial<Record<UpdateType, T>>;
export type RenovateRepository =
| string
| {
repository: string;
};
2020-03-06 08:07:55 +00:00
export interface CustomManager {
fileMatch: string[];
2020-03-06 08:07:55 +00:00
matchStrings: string[];
depNameTemplate?: string;
datasourceTemplate?: string;
lookupNameTemplate?: string;
versioningTemplate?: string;
}
2019-08-23 13:46:31 +00:00
// TODO: Proper typings
export interface RenovateConfig
extends RenovateAdminConfig,
RenovateSharedConfig,
2019-08-23 13:46:31 +00:00
UpdateConfig<PackageRule>,
Record<string, unknown> {
2019-08-23 13:46:31 +00:00
baseBranches?: string[];
baseBranch?: string;
baseBranchSha?: string;
branchList?: string[];
2020-04-29 12:27:33 +00:00
description?: string | string[];
2019-08-23 13:46:31 +00:00
errors?: ValidationMessage[];
extends?: string[];
gitAuthor?: string;
hostRules?: HostRule[];
ignorePresets?: string[];
includeForks?: boolean;
isFork?: boolean;
fileList?: string[];
masterIssue?: boolean;
masterIssueAutoclose?: boolean;
masterIssueChecks?: Record<string, string>;
masterIssueRebaseAllOpen?: boolean;
masterIssueTitle?: string;
packageFile?: string;
2019-08-23 13:46:31 +00:00
packageRules?: PackageRule[];
prConcurrentLimit?: number;
prHourlyLimit?: number;
repoIsOnboarded?: boolean;
updateType?: UpdateType;
2019-08-23 13:46:31 +00:00
warnings?: ValidationMessage[];
vulnerabilityAlerts?: RenovateSharedConfig;
2020-03-06 08:07:55 +00:00
regexManagers?: CustomManager[];
2019-08-23 13:46:31 +00:00
}
export type UpdateType =
| 'major'
| 'minor'
| 'patch'
| 'pin'
| 'digest'
| 'lockFileMaintenance'
| 'lockfileUpdate'
2019-08-23 13:46:31 +00:00
| 'rollback'
| 'bump';
// TODO: Proper typings
export interface PackageRule
extends RenovateSharedConfig,
UpdateConfig,
Record<string, any> {
paths?: string[];
languages?: string[];
baseBranchList?: string[];
datasources?: string[];
depTypeList?: string[];
packageNames?: string[];
packagePatterns?: string[];
excludePackageNames?: string[];
excludePackagePatterns?: string[];
matchCurrentVersion?: string | Range;
sourceUrlPrefixes?: string[];
updateTypes?: UpdateType[];
}
export interface ValidationMessage {
depName: string;
message: string;
}