renovate

How to ignore some dependencies if current version match a pattern with Renovate?


I am using the Mend-hosted GitHub Renovate App and I push these two files to the remote repository on GitHub for renovate to parse through the package.json. I want Renovate to ignore all chalk versions, that end with "java", and not create a PR.

There is an exact example of it in the docs here, that is apparently supposed to work, but it isn't for me and I am getting a PR with the name "Update dependency chalk to v5" and change 2.5.0-java -> 5.3.0.

What is the reason?

package.json:

{
  "devDependencies": {
    "chalk": "2.5.0-java"
  }
}

renovate.json:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [
    "config:recommended"
  ],
  "packageRules": [
    {
      "matchPackageNames": ["chalk"],
      "allowedVersions": "!/java$/"
    }
  ]
}

Solution

  • As @Gaël J suggested, the more appropriate option is to use matchCurrentVersion.

    renovate.json:

    {
      "$schema": "https://docs.renovatebot.com/renovate-schema.json",
      "extends": [
        "config:recommended"
      ],
      "packageRules": [
        {
          "matchPackageNames": ["chalk"],
          "matchCurrentVersion": "/java$/"
          "enabled": false
        }
      ]
    }
    

    This now disables the check and subsequently disables the generation of the PR. Logs:

    "deps": [
      {
        "depType": "devDependencies",
        "depName": "chalk",
        "currentValue": "2.5.2-java",
        "datasource": "npm",
        "prettyDepType": "devDependency",
        "updates": [],
        "packageName": "chalk",
        "skipReason": "disabled"
      }
    ],