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

View file

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

View file

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