fix: migrate fields within depTypes (#718)

This commit is contained in:
Rhys Arkins 2017-08-22 10:58:53 +02:00 committed by GitHub
parent 52b2de3bdb
commit 9d0cbb2e5d
3 changed files with 8 additions and 9 deletions

View file

@ -54,8 +54,6 @@ function migrateConfig(config, parentConfig) {
migratedConfig.major = migratedConfig.major || {};
migratedConfig.major.automerge = false;
} else if (val === 'minor') {
migratedConfig.patch = migratedConfig.patch || {};
migratedConfig.patch.automerge = true;
migratedConfig.minor = migratedConfig.minor || {};
migratedConfig.minor.automerge = true;
migratedConfig.major = migratedConfig.major || {};
@ -104,7 +102,7 @@ function migrateConfig(config, parentConfig) {
if (isObject(depType)) {
const depTypeName = depType.depType;
if (depTypeName) {
migratedConfig[depTypeName] = { ...depType };
migratedConfig[depTypeName] = migrateConfig(depType).migratedConfig;
delete migratedConfig[depTypeName].depType;
}
}

View file

@ -12,9 +12,6 @@ Object {
"minor": Object {
"automerge": true,
},
"patch": Object {
"automerge": true,
},
},
"enabled": true,
"lockFileConfig": Object {
@ -22,6 +19,12 @@ Object {
},
"onboarding": false,
"optionalDependencies": Object {
"major": Object {
"automerge": false,
},
"minor": Object {
"automerge": true,
},
"respectLatest": false,
},
"packageRules": Array [
@ -96,8 +99,5 @@ Object {
},
},
],
"patch": Object {
"automerge": true,
},
}
`;

View file

@ -41,6 +41,7 @@ describe('config/migration', () => {
{
depType: 'optionalDependencies',
respectLatest: false,
automerge: 'minor',
},
],
};