From eaf10143c20a419eed6d219ffbf59c53d9153f7c Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Thu, 17 May 2018 07:33:59 +0200 Subject: [PATCH] refactor: rename multipleMajorPrs -> separateMultipleMajor --- lib/config/definitions.js | 2 +- lib/config/migration.js | 4 ++++ lib/manager/docker/package.js | 2 +- lib/manager/npm/versions.js | 2 +- test/config/__snapshots__/index.spec.js.snap | 2 +- test/config/__snapshots__/migration.spec.js.snap | 1 + test/config/migration.spec.js | 1 + test/manager/docker/package.spec.js | 2 +- test/manager/npm/versions.spec.js | 2 +- website/docs/configuration-options.md | 8 ++++---- 10 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/config/definitions.js b/lib/config/definitions.js index ba46182ad6..7704aca856 100644 --- a/lib/config/definitions.js +++ b/lib/config/definitions.js @@ -413,7 +413,7 @@ const options = [ type: 'boolean', }, { - name: 'multipleMajorPrs', + name: 'separateMultipleMajor', description: 'If set to true, PRs will be raised separately for each available major upgrade version', stage: 'package', diff --git a/lib/config/migration.js b/lib/config/migration.js index 75955ea27a..ccf7f74af9 100644 --- a/lib/config/migration.js +++ b/lib/config/migration.js @@ -142,6 +142,10 @@ function migrateConfig(config) { migratedConfig.major = migratedConfig.major || {}; migratedConfig.major.automerge = val == true; // eslint-disable-line eqeqeq delete migratedConfig[key]; + } else if (key === 'multipleMajorPrs') { + isMigrated = true; + delete migratedConfig.multipleMajorPrs; + migratedConfig.separateMultipleMajor = val; } else if (key === 'automergePatch') { isMigrated = true; migratedConfig.patch = migratedConfig.patch || {}; diff --git a/lib/manager/docker/package.js b/lib/manager/docker/package.js index 1bd05fd023..94189bcaa4 100644 --- a/lib/manager/docker/package.js +++ b/lib/manager/docker/package.js @@ -102,7 +102,7 @@ async function getPackageUpdates(config) { ) { // If we're not separating releases then we use a common lookup key upgradeKey = 'latest'; - } else if (!config.multipleMajorPrs && type === 'major') { + } else if (!config.separateMultipleMajor && type === 'major') { upgradeKey = 'major'; } else { // Use major version as lookup key diff --git a/lib/manager/npm/versions.js b/lib/manager/npm/versions.js index 7e17b7648c..8258828a12 100644 --- a/lib/manager/npm/versions.js +++ b/lib/manager/npm/versions.js @@ -182,7 +182,7 @@ function determineUpgrades(npmDep, config) { ) { // If we're not separating releases then we use a common lookup key upgradeKey = 'latest'; - } else if (!config.multipleMajorPrs && type === 'major') { + } else if (!config.separateMultipleMajor && type === 'major') { upgradeKey = 'major'; } else if (type === 'patch') { upgradeKey = `{{{newVersionMajor}}}.{{{newVersionMinor}}}`; diff --git a/test/config/__snapshots__/index.spec.js.snap b/test/config/__snapshots__/index.spec.js.snap index b3d948e769..902106cc75 100644 --- a/test/config/__snapshots__/index.spec.js.snap +++ b/test/config/__snapshots__/index.spec.js.snap @@ -141,7 +141,6 @@ Object { }, "minor": Object {}, "mirrorMode": false, - "multipleMajorPrs": false, "node": Object { "group": Object { "commitMessageTopic": "Node.js", @@ -209,6 +208,7 @@ Object { "semanticCommitType": "chore", "semanticCommits": null, "separateMajorReleases": true, + "separateMultipleMajor": false, "separatePatchReleases": true, "statusCheckVerify": false, "supportPolicy": Array [], diff --git a/test/config/__snapshots__/migration.spec.js.snap b/test/config/__snapshots__/migration.spec.js.snap index 6025070470..aa935e0fe1 100644 --- a/test/config/__snapshots__/migration.spec.js.snap +++ b/test/config/__snapshots__/migration.spec.js.snap @@ -117,6 +117,7 @@ Object { "schedule": "on the first day of the month", "semanticCommitScope": "deps", "semanticCommitType": "fix", + "separateMultipleMajor": true, "travis": Object { "enabled": true, }, diff --git a/test/config/migration.spec.js b/test/config/migration.spec.js index 49c483c99f..3b303d0639 100644 --- a/test/config/migration.spec.js +++ b/test/config/migration.spec.js @@ -9,6 +9,7 @@ describe('config/migration', () => { extends: [':js-app', 'config:library'], maintainYarnLock: true, onboarding: 'false', + multipleMajorPrs: true, automerge: 'none', automergeMajor: false, automergeMinor: true, diff --git a/test/manager/docker/package.spec.js b/test/manager/docker/package.spec.js index 27be5fda99..47c8474ac2 100644 --- a/test/manager/docker/package.spec.js +++ b/test/manager/docker/package.spec.js @@ -94,7 +94,7 @@ describe('lib/manager/docker/package', () => { config.major.automerge = false; }); it('returns major and minor upgrades', async () => { - config.multipleMajorPrs = true; + config.separateMultipleMajor = true; dockerApi.getDigest.mockReturnValueOnce(config.currentDigest); dockerApi.getDigest.mockReturnValueOnce('sha256:one'); dockerApi.getDigest.mockReturnValueOnce('sha256:two'); diff --git a/test/manager/npm/versions.spec.js b/test/manager/npm/versions.spec.js index 16948c573d..5f28a7fe08 100644 --- a/test/manager/npm/versions.spec.js +++ b/test/manager/npm/versions.spec.js @@ -353,7 +353,7 @@ describe('manager/npm/versions', () => { }); it('should upgrade to two majors', () => { config.currentVersion = '1.0.0'; - config.multipleMajorPrs = true; + config.separateMultipleMajor = true; const res = versions.determineUpgrades(webpackJson, config); expect(res).toHaveLength(3); }); diff --git a/website/docs/configuration-options.md b/website/docs/configuration-options.md index aa33e40d17..83825233ba 100644 --- a/website/docs/configuration-options.md +++ b/website/docs/configuration-options.md @@ -284,10 +284,6 @@ Set enabled to `true` to enable meteor package updating. Add to this object if you wish to define rules that apply only to minor updates. -## multipleMajorPrs - -Set this to true if you wish to receive one PR for every separate major version upgrade of a dependency. e.g. if you are on webpack@v1 currently then default behaviour is a PR for upgrading to webpack@v3 and not for webpack@v2. If this setting is true then you would get one PR for webpack@v2 and one for webpack@v3. - ## node Using this configuration option allows you to apply common configuration and policies across all Node.js version updates even if managed by different package managers (`npm`, `yarn`, etc.). @@ -607,6 +603,10 @@ Renovate's default behaviour is to create a separate branch/PR if both minor and It is recommended that you leave this setting to true, because of the polite way that Renovate handles this. For example, let's say in the above example that you decided you wouldn't update to Webpack 3 for a long time and don't want to build/test every time a new 3.x version arrives. In that case, simply close the "Update Webpack to version 3.x" PR and it _won't_ be recreated again even if subsequent Webpack 3.x versions are released. You can continue with Webpack 2.x for as long as you want and receive any updates/patches that are made for it. Then eventually when you do want to update to Webpack 3.x you can make that update to `package.json` yourself and commit it to master once it's tested. After that, Renovate will resume providing you updates to 3.x again! i.e. if you close a major upgrade PR then it won't come back again, but once you make the major upgrade yourself then Renovate will resume providing you with minor or patch updates. +## separateMultipleMajor + +Set this to true if you wish to receive one PR for every separate major version upgrade of a dependency. e.g. if you are on webpack@v1 currently then default behaviour is a PR for upgrading to webpack@v3 and not for webpack@v2. If this setting is true then you would get one PR for webpack@v2 and one for webpack@v3. + ## separatePatchReleases By default, Renovate won't distinguish between "patch" (e.g. 1.0.x) and "minor" (e.g. 1.x.0) releases - groups them together. e.g. if you are running version 1.0.0 of a package and both versions 1.0.1 and 1.1.0 are available then Renovate will raise a single PR for version 1.1.0. If you wish to distinguish between patch and minor upgrades, for example if you wish to automerge patch but not minor, then you can set this option to `true`. -- GitLab