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];
if (allowedStrings.includes(key) && typeof val === 'string') {
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`;
delete massagedConfig.npmToken;
} else if (isObject(val)) {

View file

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

View file

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

View file

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