fix(presets): migrate renamed monorepos (#11319)

This commit is contained in:
Rhys Arkins 2021-08-18 12:23:41 +02:00 committed by GitHub
parent b21439fb75
commit 70b5396d34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 1 deletions

View file

@ -1,4 +1,4 @@
export const removedPresets = {
export const removedPresets: Record<string, string | null> = {
':automergeBranchMergeCommit': ':automergeBranch',
':automergeBranchPush': ':automergeBranch',
':base': 'config:base',
@ -23,3 +23,39 @@ export const removedPresets = {
'helpers:oddIsUnstable': null,
'helpers:oddIsUnstablePackages': null,
};
const renamedMonorepos: Record<string, string> = {
'arcus event-grid': 'arcus.event-grid',
'arcus security': 'arcus.security',
'arcus messaging': 'arcus.messaging',
'arcus observability': 'arcus.observability',
'arcus webapi': 'arcus.webapi',
'arcus background-jobs': 'arcus.background-jobs',
'aspnet AspNetWebStack': 'aspnet aspnetwebstack',
'aspnet Extensions': 'aspnet extensions',
'System.IO.Abstractions': 'system.io.abstractions',
angular1: 'angularjs',
angularcli: 'angular-cli',
Fontsource: 'fontsource',
hamcrest: 'javahamcrest',
HotChocolate: 'hotchocolate',
infrastructure: 'infrastructure-ui',
lingui: 'linguijs',
MassTransit: 'masstransit',
material: 'material-components-web',
mui: 'material-ui',
openfeign: 'feign',
opentelemetry: 'opentelemetry-js',
OpenTelemetryDotnet: 'opentelemetry-dotnet',
picasso: 'picassojs',
reactrouter: 'react-router',
sentry: 'sentry-javascript',
Steeltoe: 'steeltoe',
stryker: 'stryker-js',
Swashbuckle: 'swashbuckle-aspnetcore',
};
for (const [from, to] of Object.entries(renamedMonorepos)) {
removedPresets[`monorepo:${from}`] = `monorepo:${to}`;
removedPresets[`group:${from}Monorepo`] = `group:${to}Monorepo`;
}

View file

@ -575,6 +575,37 @@ describe('config/presets/index', () => {
const res = await presets.getPreset('helpers:oddIsUnstable', {});
expect(res).toEqual({});
});
it('handles renamed monorepos', async () => {
const res = await presets.getPreset('monorepo:opentelemetry', {});
expect(res).toMatchInlineSnapshot(`
Object {
"description": Array [
"opentelemetry-js monorepo",
],
"matchSourceUrlPrefixes": Array [
"https://github.com/open-telemetry/opentelemetry-js",
],
}
`);
});
it('handles renamed monorepo groups', async () => {
const res = await presets.getPreset('group:opentelemetryMonorepo', {});
expect(res).toMatchInlineSnapshot(`
Object {
"packageRules": Array [
Object {
"description": Array [
"Group packages from opentelemetry-js monorepo together",
],
"extends": Array [
"monorepo:opentelemetry-js",
],
"groupName": "opentelemetry-js monorepo",
},
],
}
`);
});
it('gets linters', async () => {
const res = await presets.getPreset('packages:linters', {});
expect(res).toMatchSnapshot();