fix: migrate null schedule to [] (#1021)

This commit is contained in:
Rhys Arkins 2017-10-23 09:14:50 +02:00 committed by GitHub
parent aa5a488157
commit 826753e329
4 changed files with 8 additions and 3 deletions

View file

@ -18,7 +18,7 @@ function massageConfig(config) {
const val = config[key]; const val = config[key];
if (allowedStrings.includes(key) && typeof val === 'string') { if (allowedStrings.includes(key) && typeof val === 'string') {
massagedConfig[key] = [val]; massagedConfig[key] = [val];
} else if (key === 'npmToken' && val.length < 30) { } else if (key === 'npmToken' && val && val.length < 30) {
massagedConfig.npmrc = `//registry.npmjs.org/:_authToken=${val}\n`; massagedConfig.npmrc = `//registry.npmjs.org/:_authToken=${val}\n`;
delete massagedConfig.npmToken; delete massagedConfig.npmToken;
} else if (isObject(val)) { } else if (isObject(val)) {

View file

@ -99,6 +99,9 @@ function migrateConfig(config, parentConfig) {
isMigrated = true; isMigrated = true;
migratedConfig.packagePatterns = [val]; migratedConfig.packagePatterns = [val];
delete migratedConfig.packagePattern; delete migratedConfig.packagePattern;
} else if (key === 'schedule' && !val) {
isMigrated = true;
migratedConfig.schedule = [];
} else if (key === 'schedule') { } else if (key === 'schedule') {
// massage to array first // massage to array first
const schedules = typeof val === 'string' ? [val] : val; const schedules = typeof val === 'string' ? [val] : val;

View file

@ -18,12 +18,13 @@ Object {
"minor": Object { "minor": Object {
"automerge": true, "automerge": true,
}, },
"schedule": Array [],
}, },
"enabled": true, "enabled": true,
"ignorePaths": Array [ "ignorePaths": Array [
"node_modules/", "node_modules/",
], ],
"lockFileConfig": Object { "lockFileMaintenance": Object {
"automerge": true, "automerge": true,
"schedule": "before 5am", "schedule": "before 5am",
}, },

View file

@ -36,12 +36,13 @@ describe('config/migration', () => {
enabled: false, enabled: false,
}, },
], ],
lockFileConfig: { lockFileMaintenance: {
automerge: 'any', automerge: 'any',
schedule: 'before 5am every day', schedule: 'before 5am every day',
}, },
devDependencies: { devDependencies: {
automerge: 'minor', automerge: 'minor',
schedule: null,
}, },
depTypes: [ depTypes: [
'dependencies', 'dependencies',