Skip to content

Commit

Permalink
refactor(platform): add id for each platform (#21405)
Browse files Browse the repository at this point in the history
  • Loading branch information
setchy committed Apr 10, 2023
1 parent 7569ac3 commit 6f6307a
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/modules/platform/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import type { Platform } from './types';
const api = new Map<PlatformId, Platform>();
export default api;

api.set('azure', azure);
api.set('bitbucket', bitbucket);
api.set('bitbucket-server', bitbucketServer);
api.set('codecommit', codecommit);
api.set('gitea', gitea);
api.set('github', github);
api.set('gitlab', gitlab);
api.set(azure.id, azure);
api.set(bitbucket.id, bitbucket);
api.set(bitbucketServer.id, bitbucketServer);
api.set(codecommit.id, codecommit);
api.set(gitea.id, gitea);
api.set(github.id, github);
api.set(gitlab.id, gitlab);
2 changes: 2 additions & 0 deletions lib/modules/platform/azure/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ const defaults: {
hostType: 'azure',
};

export const id = 'azure';

export function initPlatform({
endpoint,
token,
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/platform/bitbucket-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ import * as utils from './utils';
* https://confluence.atlassian.com/support/atlassian-support-end-of-life-policy-201851003.html#AtlassianSupportEndofLifePolicy-BitbucketServer
*/

export const id = 'bitbucket-server';

let config: BbsConfig = {} as any;

const bitbucketServerHttp = new BitbucketServerHttp();
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/platform/bitbucket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ import type {
import * as utils from './utils';
import { mergeBodyTransformer } from './utils';

export const id = 'bitbucket';

const bitbucketHttp = new BitbucketHttp();

const BITBUCKET_PROD_ENDPOINT = 'https://api.bitbucket.org/';
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/platform/codecommit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ interface Config {
prList?: CodeCommitPr[];
}

export const id = 'codecommit';

export const config: Config = {};

export async function initPlatform({
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/platform/gitea/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ interface GiteaRepoConfig {
cloneSubmodules: boolean;
}

export const id = 'gitea';

const DRAFT_PREFIX = 'WIP: ';

const defaults = {
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/platform/github/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ import type {
} from './types';
import { getUserDetails, getUserEmail } from './user';

export const id = 'github';

const githubApi = new githubHttp.GithubHttp();

let config: LocalRepoConfig;
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/platform/gitlab/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ const defaults = {
version: '0.0.0',
};

export const id = 'gitlab';

const DRAFT_PREFIX = 'Draft: ';
const DRAFT_PREFIX_DEPRECATED = 'WIP: ';

Expand Down

0 comments on commit 6f6307a

Please sign in to comment.