mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
chore: rename platform types
This commit is contained in:
parent
bcdd97cb61
commit
b11e5cb761
9 changed files with 42 additions and 42 deletions
|
@ -26,10 +26,10 @@ import {
|
|||
EnsureIssueResult,
|
||||
FindPRConfig,
|
||||
Issue,
|
||||
PlatformConfig,
|
||||
PlatformResult,
|
||||
Pr,
|
||||
RepoConfig,
|
||||
RepoParams,
|
||||
RepoResult,
|
||||
VulnerabilityAlert,
|
||||
} from '../common';
|
||||
import { smartTruncate } from '../utils/pr-body';
|
||||
|
@ -65,7 +65,7 @@ export function initPlatform({
|
|||
token,
|
||||
username,
|
||||
password,
|
||||
}: RenovateConfig): Promise<PlatformConfig> {
|
||||
}: RenovateConfig): Promise<PlatformResult> {
|
||||
if (!endpoint) {
|
||||
throw new Error('Init: You must configure an Azure DevOps endpoint');
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ export function initPlatform({
|
|||
};
|
||||
defaults.endpoint = res.endpoint;
|
||||
azureApi.setEndpoint(res.endpoint);
|
||||
const platformConfig: PlatformConfig = {
|
||||
const platformConfig: PlatformResult = {
|
||||
endpoint: defaults.endpoint,
|
||||
};
|
||||
return Promise.resolve(platformConfig);
|
||||
|
@ -98,7 +98,7 @@ export async function initRepo({
|
|||
localDir,
|
||||
azureWorkItemId,
|
||||
optimizeForDisabled,
|
||||
}: RepoParams): Promise<RepoConfig> {
|
||||
}: RepoParams): Promise<RepoResult> {
|
||||
logger.debug(`initRepo("${repository}")`);
|
||||
config = { repository, azureWorkItemId } as any;
|
||||
const azureApiGit = await azureApi.gitApi();
|
||||
|
@ -157,7 +157,7 @@ export async function initRepo({
|
|||
gitAuthorName: global.gitAuthor?.name,
|
||||
gitAuthorEmail: global.gitAuthor?.email,
|
||||
});
|
||||
const repoConfig: RepoConfig = {
|
||||
const repoConfig: RepoResult = {
|
||||
defaultBranch,
|
||||
isFork: false,
|
||||
};
|
||||
|
|
|
@ -29,10 +29,10 @@ import {
|
|||
EnsureIssueResult,
|
||||
FindPRConfig,
|
||||
Issue,
|
||||
PlatformConfig,
|
||||
PlatformResult,
|
||||
Pr,
|
||||
RepoConfig,
|
||||
RepoParams,
|
||||
RepoResult,
|
||||
VulnerabilityAlert,
|
||||
} from '../common';
|
||||
import { smartTruncate } from '../utils/pr-body';
|
||||
|
@ -68,7 +68,7 @@ export function initPlatform({
|
|||
endpoint,
|
||||
username,
|
||||
password,
|
||||
}: RenovateConfig): Promise<PlatformConfig> {
|
||||
}: RenovateConfig): Promise<PlatformResult> {
|
||||
if (!endpoint) {
|
||||
throw new Error('Init: You must configure a Bitbucket Server endpoint');
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ export function initPlatform({
|
|||
// TODO: Add a connection check that endpoint/username/password combination are valid
|
||||
defaults.endpoint = ensureTrailingSlash(endpoint);
|
||||
setBaseUrl(defaults.endpoint);
|
||||
const platformConfig: PlatformConfig = {
|
||||
const platformConfig: PlatformResult = {
|
||||
endpoint: defaults.endpoint,
|
||||
};
|
||||
return Promise.resolve(platformConfig);
|
||||
|
@ -111,7 +111,7 @@ export async function initRepo({
|
|||
localDir,
|
||||
optimizeForDisabled,
|
||||
bbUseDefaultReviewers,
|
||||
}: RepoParams): Promise<RepoConfig> {
|
||||
}: RepoParams): Promise<RepoResult> {
|
||||
logger.debug(
|
||||
`initRepo("${JSON.stringify({ repository, localDir }, null, 2)}")`
|
||||
);
|
||||
|
@ -202,7 +202,7 @@ export async function initRepo({
|
|||
)
|
||||
).body.displayId;
|
||||
config.mergeMethod = 'merge';
|
||||
const repoConfig: RepoConfig = {
|
||||
const repoConfig: RepoResult = {
|
||||
defaultBranch,
|
||||
isFork: !!info.parent,
|
||||
};
|
||||
|
|
|
@ -23,10 +23,10 @@ import {
|
|||
EnsureIssueResult,
|
||||
FindPRConfig,
|
||||
Issue,
|
||||
PlatformConfig,
|
||||
PlatformResult,
|
||||
Pr,
|
||||
RepoConfig,
|
||||
RepoParams,
|
||||
RepoResult,
|
||||
VulnerabilityAlert,
|
||||
} from '../common';
|
||||
import { smartTruncate } from '../utils/pr-body';
|
||||
|
@ -46,7 +46,7 @@ export function initPlatform({
|
|||
endpoint,
|
||||
username,
|
||||
password,
|
||||
}: RenovateConfig): Promise<PlatformConfig> {
|
||||
}: RenovateConfig): Promise<PlatformResult> {
|
||||
if (!(username && password)) {
|
||||
throw new Error(
|
||||
'Init: You must configure a Bitbucket username and password'
|
||||
|
@ -60,7 +60,7 @@ export function initPlatform({
|
|||
}
|
||||
setBaseUrl(endpoint_);
|
||||
// TODO: Add a connection check that endpoint/username/password combination are valid
|
||||
const platformConfig: PlatformConfig = {
|
||||
const platformConfig: PlatformResult = {
|
||||
endpoint: endpoint || BITBUCKET_PROD_ENDPOINT,
|
||||
};
|
||||
return Promise.resolve(platformConfig);
|
||||
|
@ -86,7 +86,7 @@ export async function initRepo({
|
|||
localDir,
|
||||
optimizeForDisabled,
|
||||
bbUseDefaultReviewers,
|
||||
}: RepoParams): Promise<RepoConfig> {
|
||||
}: RepoParams): Promise<RepoResult> {
|
||||
logger.debug(`initRepo("${repository}")`);
|
||||
const opts = hostRules.find({
|
||||
hostType: PLATFORM_TYPE_BITBUCKET,
|
||||
|
@ -159,7 +159,7 @@ export async function initRepo({
|
|||
gitAuthorName: global.gitAuthor?.name,
|
||||
gitAuthorEmail: global.gitAuthor?.email,
|
||||
});
|
||||
const repoConfig: RepoConfig = {
|
||||
const repoConfig: RepoResult = {
|
||||
defaultBranch: info.mainbranch,
|
||||
isFork: info.isFork,
|
||||
};
|
||||
|
|
|
@ -6,13 +6,13 @@ import {
|
|||
|
||||
export type VulnerabilityAlert = _VulnerabilityAlert;
|
||||
|
||||
export interface PlatformConfig {
|
||||
export interface PlatformResult {
|
||||
endpoint: string;
|
||||
renovateUsername?: any;
|
||||
gitAuthor?: any;
|
||||
}
|
||||
|
||||
export interface RepoConfig {
|
||||
export interface RepoResult {
|
||||
defaultBranch: string;
|
||||
isFork: boolean;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ export interface Platform {
|
|||
findIssue(title: string): Promise<Issue | null>;
|
||||
getIssueList(): Promise<Issue[]>;
|
||||
getVulnerabilityAlerts(): Promise<VulnerabilityAlert[]>;
|
||||
initRepo(config: RepoParams): Promise<RepoConfig>;
|
||||
initRepo(config: RepoParams): Promise<RepoResult>;
|
||||
getPrList(): Promise<Pr[]>;
|
||||
ensureIssueClosing(title: string): Promise<void>;
|
||||
ensureIssue(
|
||||
|
@ -158,5 +158,5 @@ export interface Platform {
|
|||
requiredStatusChecks?: string[] | null
|
||||
): Promise<BranchStatus>;
|
||||
getBranchPr(branchName: string): Promise<Pr | null>;
|
||||
initPlatform(config: RenovateConfig): Promise<PlatformConfig>;
|
||||
initPlatform(config: RenovateConfig): Promise<PlatformResult>;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BranchStatusConfig, Platform, RepoConfig, RepoParams } from '..';
|
||||
import { BranchStatusConfig, Platform, RepoParams, RepoResult } from '..';
|
||||
import { partial } from '../../../test/util';
|
||||
import {
|
||||
REPOSITORY_ACCESS_FORBIDDEN,
|
||||
|
@ -168,7 +168,7 @@ describe('platform/gitea', () => {
|
|||
function initFakeRepo(
|
||||
repo?: Partial<ght.Repo>,
|
||||
config?: Partial<RepoParams>
|
||||
): Promise<RepoConfig> {
|
||||
): Promise<RepoResult> {
|
||||
helper.getRepo.mockResolvedValueOnce({ ...mockRepo, ...repo });
|
||||
|
||||
return gitea.initRepo({
|
||||
|
|
|
@ -29,10 +29,10 @@ import {
|
|||
FindPRConfig,
|
||||
Issue,
|
||||
Platform,
|
||||
PlatformConfig,
|
||||
PlatformResult,
|
||||
Pr,
|
||||
RepoConfig,
|
||||
RepoParams,
|
||||
RepoResult,
|
||||
VulnerabilityAlert,
|
||||
} from '../common';
|
||||
import { smartTruncate } from '../utils/pr-body';
|
||||
|
@ -186,7 +186,7 @@ const platform: Platform = {
|
|||
async initPlatform({
|
||||
endpoint,
|
||||
token,
|
||||
}: GiteaRenovateConfig): Promise<PlatformConfig> {
|
||||
}: GiteaRenovateConfig): Promise<PlatformResult> {
|
||||
if (!token) {
|
||||
throw new Error('Init: You must configure a Gitea personal access token');
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ const platform: Platform = {
|
|||
repository,
|
||||
localDir,
|
||||
optimizeForDisabled,
|
||||
}: RepoParams): Promise<RepoConfig> {
|
||||
}: RepoParams): Promise<RepoResult> {
|
||||
let renovateConfig: RenovateConfig;
|
||||
let repo: helper.Repo;
|
||||
|
||||
|
|
|
@ -38,10 +38,10 @@ import {
|
|||
EnsureIssueResult,
|
||||
FindPRConfig,
|
||||
Issue,
|
||||
PlatformConfig,
|
||||
PlatformResult,
|
||||
Pr,
|
||||
RepoConfig,
|
||||
RepoParams,
|
||||
RepoResult,
|
||||
VulnerabilityAlert,
|
||||
} from '../common';
|
||||
import { smartTruncate } from '../utils/pr-body';
|
||||
|
@ -76,7 +76,7 @@ export async function initPlatform({
|
|||
}: {
|
||||
endpoint: string;
|
||||
token: string;
|
||||
}): Promise<PlatformConfig> {
|
||||
}): Promise<PlatformResult> {
|
||||
if (!token) {
|
||||
throw new Error('Init: You must configure a GitHub personal access token');
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ export async function initPlatform({
|
|||
gitAuthor = undefined;
|
||||
}
|
||||
logger.debug('Authenticated as GitHub user: ' + renovateUsername);
|
||||
const platformConfig: PlatformConfig = {
|
||||
const platformConfig: PlatformResult = {
|
||||
endpoint: defaults.endpoint,
|
||||
gitAuthor,
|
||||
renovateUsername,
|
||||
|
@ -172,7 +172,7 @@ export async function initRepo({
|
|||
includeForks,
|
||||
renovateUsername,
|
||||
optimizeForDisabled,
|
||||
}: RepoParams): Promise<RepoConfig> {
|
||||
}: RepoParams): Promise<RepoResult> {
|
||||
logger.debug(`initRepo("${repository}")`);
|
||||
// config is used by the platform api itself, not necessary for the app layer to know
|
||||
config = { localDir, repository } as any;
|
||||
|
@ -422,7 +422,7 @@ export async function initRepo({
|
|||
gitAuthorName: global.gitAuthor?.name,
|
||||
gitAuthorEmail: global.gitAuthor?.email,
|
||||
});
|
||||
const repoConfig: RepoConfig = {
|
||||
const repoConfig: RepoResult = {
|
||||
defaultBranch: config.defaultBranch,
|
||||
isFork: repo.isFork === true,
|
||||
};
|
||||
|
|
|
@ -32,10 +32,10 @@ import {
|
|||
EnsureIssueConfig,
|
||||
FindPRConfig,
|
||||
Issue,
|
||||
PlatformConfig,
|
||||
PlatformResult,
|
||||
Pr,
|
||||
RepoConfig,
|
||||
RepoParams,
|
||||
RepoResult,
|
||||
VulnerabilityAlert,
|
||||
} from '../common';
|
||||
import { smartTruncate } from '../utils/pr-body';
|
||||
|
@ -79,7 +79,7 @@ export async function initPlatform({
|
|||
}: {
|
||||
token: string;
|
||||
endpoint: string;
|
||||
}): Promise<PlatformConfig> {
|
||||
}): Promise<PlatformResult> {
|
||||
if (!token) {
|
||||
throw new Error('Init: You must configure a GitLab personal access token');
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ export async function initPlatform({
|
|||
);
|
||||
throw new Error('Init: Authentication failure');
|
||||
}
|
||||
const platformConfig: PlatformConfig = {
|
||||
const platformConfig: PlatformResult = {
|
||||
endpoint: defaults.endpoint,
|
||||
gitAuthor,
|
||||
};
|
||||
|
@ -140,7 +140,7 @@ export async function initRepo({
|
|||
repository,
|
||||
localDir,
|
||||
optimizeForDisabled,
|
||||
}: RepoParams): Promise<RepoConfig> {
|
||||
}: RepoParams): Promise<RepoResult> {
|
||||
config = {} as any;
|
||||
config.repository = urlEscape(repository);
|
||||
config.localDir = localDir;
|
||||
|
@ -252,7 +252,7 @@ export async function initRepo({
|
|||
logger.debug({ err }, 'Unknown GitLab initRepo error');
|
||||
throw err;
|
||||
}
|
||||
const repoConfig: RepoConfig = {
|
||||
const repoConfig: RepoResult = {
|
||||
defaultBranch,
|
||||
isFork: !!res.body.forked_from_project,
|
||||
};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { RenovateConfig } from '../../../config';
|
||||
import * as npmApi from '../../../datasource/npm';
|
||||
import { RepoConfig, RepoParams, platform } from '../../../platform';
|
||||
import { RepoParams, RepoResult, platform } from '../../../platform';
|
||||
|
||||
// TODO: fix types
|
||||
export type WorkerPlatformConfig = RepoConfig &
|
||||
export type WorkerPlatformConfig = RepoResult &
|
||||
RenovateConfig &
|
||||
Record<string, any>;
|
||||
|
||||
|
|
Loading…
Reference in a new issue