diff --git a/lib/config/__snapshots__/migration.spec.ts.snap b/lib/config/__snapshots__/migration.spec.ts.snap index 17374dfdeaff23c5136ffa74913e300bda853e24..fe40723c69f282c438e7c5b0a4c12be26b3ff04e 100644 --- a/lib/config/__snapshots__/migration.spec.ts.snap +++ b/lib/config/__snapshots__/migration.spec.ts.snap @@ -88,7 +88,6 @@ Object { "branchName": "{{{branchPrefix}}}{{{additionalBranchPrefix}}}{{{branchTopic}}}{{{packageFileDir}}}", "branchPrefix": "renovate/", "commitMessage": "{{#if semanticCommitType}}{{semanticCommitType}}{{#if semanticCommitScope}}({{semanticCommitScope}}){{/if}}: {{/if}}some commit message", - "commitMessageExtra": "{{currentValue}} something", "constraints": Object { "python": "3.7", }, @@ -323,6 +322,22 @@ Object { } `; +exports[`config/migration migrateConfig(config, parentConfig) migrates packageRules objects 1`] = ` +Object { + "packageRules": Array [ + Object { + "commitMessage": "fix(package): update peerDependency to accept typescript ^{{newValue}} {{newValue}}", + "matchPackageNames": Array [ + "typescript", + ], + "matchUpdateTypes": Array [ + "major", + ], + }, + ], +} +`; + exports[`config/migration migrateConfig(config, parentConfig) migrates packages 1`] = ` Object { "packageRules": Array [ diff --git a/lib/config/migration.spec.ts b/lib/config/migration.spec.ts index 4c717514a1951b8a383c0e2b316c27a43a3af636..9298ffcb8cee1ae5fa23e6ec110a272acb1dbbda 100644 --- a/lib/config/migration.spec.ts +++ b/lib/config/migration.spec.ts @@ -76,7 +76,6 @@ describe('config/migration', () => { commitMessage: '{{semanticPrefix}}some commit message', prTitle: '{{semanticPrefix}}some pr title', semanticPrefix: 'fix(deps): ', - commitMessageExtra: '{{currentVersion}} something', pathRules: [ { paths: ['examples/**'], @@ -314,7 +313,7 @@ describe('config/migration', () => { packageNames: ['typescript'], updateTypes: ['major'], commitMessage: - 'fix(package): update peerDependency to accept typescript ^{{newVersion}}', + 'fix(package): update peerDependency to accept typescript ^{{newVersion}} {{newVersion}}', }, } as any; const { isMigrated, migratedConfig } = configMigration.migrateConfig( @@ -322,6 +321,7 @@ describe('config/migration', () => { defaultConfig ); expect(isMigrated).toBe(true); + expect(migratedConfig).toMatchSnapshot(); expect(migratedConfig.packageRules).toHaveLength(1); }); it('migrates node to travis', () => { diff --git a/lib/config/migration.ts b/lib/config/migration.ts index 208e35972589cd21bea78b9cd1b30e52b78de03c..0f18e7044a0c935297d4b057f413abc56a9f81f5 100644 --- a/lib/config/migration.ts +++ b/lib/config/migration.ts @@ -504,7 +504,7 @@ export function migrateConfig( migratedConfig.binarySource = 'global'; } const migratedTemplates = { - currentVersion: 'currentValue', + currentVersion: 'toVersion', newVersion: 'newValue', newValueMajor: 'newMajor', newValueMinor: 'newMinor', diff --git a/lib/datasource/terraform-module/index.ts b/lib/datasource/terraform-module/index.ts index df7e5c5d3cea09f5ce2ce12c52cc180ab9ef05b0..1e9b69b3dafeb63878902e8313b35727ef93b389 100644 --- a/lib/datasource/terraform-module/index.ts +++ b/lib/datasource/terraform-module/index.ts @@ -137,11 +137,11 @@ export async function getReleases({ dep.homepage = `https://registry.terraform.io/modules/${repository}`; } // set published date for latest release - const currentVersion = dep.releases.find( + const latestVersion = dep.releases.find( (release) => res.version === release.version ); - if (currentVersion) { - currentVersion.releaseTimestamp = res.published_at; + if (latestVersion) { + latestVersion.releaseTimestamp = res.published_at; } logger.trace({ dep }, 'dep'); const cacheMinutes = 30; diff --git a/lib/datasource/terraform-provider/index.ts b/lib/datasource/terraform-provider/index.ts index c41de0dfef43a9386d94ecf202ccdf19060c3a13..6a7274a637f95c78515e0183d62e66aed3812be6 100644 --- a/lib/datasource/terraform-provider/index.ts +++ b/lib/datasource/terraform-provider/index.ts @@ -59,12 +59,12 @@ async function queryRegistry( version, })); // set published date for latest release - const currentVersion = dep.releases.find( + const latestVersion = dep.releases.find( (release) => res.version === release.version ); // istanbul ignore else - if (currentVersion) { - currentVersion.releaseTimestamp = res.published_at; + if (latestVersion) { + latestVersion.releaseTimestamp = res.published_at; } dep.homepage = `${registryURL}/providers/${repository}`; logger.trace({ dep }, 'dep'); diff --git a/lib/manager/bazel/update.ts b/lib/manager/bazel/update.ts index 849689e79406f27b1122972aa445842920afc26b..1d2dbcd5b2c3a771d6e93ba37a18ee40189df643 100644 --- a/lib/manager/bazel/update.ts +++ b/lib/manager/bazel/update.ts @@ -12,12 +12,12 @@ function updateWithNewVersion( currentValue: string, newValue: string ): string { - const currentVersion = currentValue.replace(/^v/, ''); - const newVersion = newValue.replace(/^v/, ''); + const replaceFrom = currentValue.replace(/^v/, ''); + const replaceTo = newValue.replace(/^v/, ''); let newContent = content; do { - newContent = newContent.replace(currentVersion, newVersion); - } while (newContent.includes(currentVersion)); + newContent = newContent.replace(replaceFrom, replaceTo); + } while (newContent.includes(replaceFrom)); return newContent; } diff --git a/lib/manager/common.ts b/lib/manager/common.ts index eee1db6479a4e3e3f08058c42f7285ef1b8eaee2..34d0115ed4c5b64f995599abdc9a75844f51ae80 100644 --- a/lib/manager/common.ts +++ b/lib/manager/common.ts @@ -187,7 +187,6 @@ export interface Upgrade<T = Record<string, any>> NpmLockFiles { isLockfileUpdate?: boolean; currentRawValue?: any; - currentVersion?: string; depGroup?: string; dockerRepository?: string; localDir?: string; diff --git a/lib/manager/gomod/update.spec.ts b/lib/manager/gomod/update.spec.ts index 66e2e0d225e72d745f3bce728b30d1595a50c8fe..5ceea4ad503a2f5a029e67b144a9970727733813 100644 --- a/lib/manager/gomod/update.spec.ts +++ b/lib/manager/gomod/update.spec.ts @@ -153,7 +153,6 @@ describe('manager/gomod/update', () => { const upgrade = { depName: 'github.com/spf13/jwalterweatherman', managerData: { lineNumber: 43, multiLine: true }, - currentVersion: 'v0.0.0', updateType: 'digest' as UpdateType, currentDigest: '14d3d4c51834', newDigest: '123456123456abcdef', @@ -168,7 +167,6 @@ describe('manager/gomod/update', () => { const upgrade = { depName: 'github.com/spf13/jwalterweatherman', managerData: { lineNumber: 43, multiLine: true }, - currentVersion: 'v0.0.0', updateType: 'digest' as UpdateType, currentDigest: 'abcdefabcdef', newDigest: '14d3d4c51834000000', diff --git a/lib/util/template/index.ts b/lib/util/template/index.ts index 7ff0914c5a3a80a1bd63710cf4db5bce801dc137..86ca71253f4f90d69a55b74f77dd96608c9e576f 100644 --- a/lib/util/template/index.ts +++ b/lib/util/template/index.ts @@ -40,7 +40,6 @@ export const allowedFields = { baseBranch: 'The baseBranch for this branch/PR', body: 'The body of the release notes', currentValue: 'The extracted current value of the dependency being updated', - currentVersion: 'The current version that is being updated', datasource: 'The datasource used to look up the upgrade', depName: 'The name of the dependency being updated', depNameLinked: @@ -52,7 +51,7 @@ export const allowedFields = { displayFrom: 'The current value, formatted for display', displayTo: 'The to value, formatted for display', fromVersion: - 'The version that would be currently installed. For example, if currentValue is ^3.0.0 then currentVersion might be 3.1.0.', + 'The version that would be currently installed. For example, if currentValue is ^3.0.0 then fromVersion might be 3.1.0.', hasReleaseNotes: 'true if the upgrade has release notes', isLockfileUpdate: 'true if the branch is a lock file update', isMajor: 'true if the upgrade is major', diff --git a/lib/workers/common.ts b/lib/workers/common.ts index 4c0a31080d74b46e4baa7bce84fa4c859743fd8b..04676279254b8869c2c6e2527423956851eaf320 100644 --- a/lib/workers/common.ts +++ b/lib/workers/common.ts @@ -31,7 +31,6 @@ export interface BranchUpgradeConfig currentDigest?: string; currentDigestShort?: string; currentValue?: string; - currentVersion?: string; endpoint?: string; excludeCommitPaths?: string[]; githubName?: string; diff --git a/lib/workers/repository/updates/flatten.ts b/lib/workers/repository/updates/flatten.ts index e5dd2d39a3946cbe8581c89152127b2a8a5b3eab..d44f7801b3a8e103426db964eabaaeb0745d7ef7 100644 --- a/lib/workers/repository/updates/flatten.ts +++ b/lib/workers/repository/updates/flatten.ts @@ -48,8 +48,6 @@ export async function flattenUpdates( for (const update of dep.updates) { let updateConfig = mergeChildConfig(depConfig, update); delete updateConfig.updates; - // Massage legacy vars just in case - updateConfig.currentVersion = updateConfig.currentValue; updateConfig.newVersion = updateConfig.newVersion || updateConfig.newValue; if (updateConfig.updateType) { diff --git a/lib/workers/repository/updates/generate.ts b/lib/workers/repository/updates/generate.ts index 04ff5ffd94fb669d3044972adaf23ef827991455..5b7da66351ace2bc1c5d1766fca8f6abaf075d28 100644 --- a/lib/workers/repository/updates/generate.ts +++ b/lib/workers/repository/updates/generate.ts @@ -120,8 +120,7 @@ export function generateBranchConfig( } if (!upgrade.displayFrom) { if (upgrade.currentValue === upgrade.newValue) { - upgrade.displayFrom = - upgrade.currentDigestShort || upgrade.currentVersion || ''; + upgrade.displayFrom = upgrade.currentDigestShort || ''; upgrade.displayTo = upgrade.displayTo || upgrade.newDigestShort || @@ -129,10 +128,7 @@ export function generateBranchConfig( ''; } else { upgrade.displayFrom = - upgrade.currentValue || - upgrade.currentVersion || - upgrade.currentDigestShort || - ''; + upgrade.currentValue || upgrade.currentDigestShort || ''; upgrade.displayTo = upgrade.displayTo || upgrade.newValue ||