Config-help: [Question] How to force renovate to only target a specific package in a monorepo?

Created on 26 Feb 2019  ยท  4Comments  ยท  Source: renovatebot/config-help

Which Renovate are you using? CLI, App, or Pro

App

Which platform are you using? GitHub, GitLab, Bitbucket Azure DevOps

GitHub

Have you checked the logs? Don't forget to include them if relevant

Don't think it's relevant

What is your question?

Hi.
I have a repo that is setup with a typical monorepo project managed with lerna.
The repo structure looks like this:

.
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ packages
    โ”œโ”€โ”€ alfa
    โ”‚ย ย  โ””โ”€โ”€ package.json
    โ”œโ”€โ”€ bravo
    โ”‚ย ย  โ””โ”€โ”€ package.json
    โ”œโ”€โ”€ charlie
    โ”‚ย ย  โ””โ”€โ”€ package.json
    โ””โ”€โ”€ delta
        โ””โ”€โ”€ package.json

How can I make renovate only send PRs to updates in the dependencies of charlie?
(in other words only send diffs on the contents of packages/charlie/package.json?)

The FAQ mentions packageFiles but that parameter is not mentioned in https://renovatebot.com/docs/configuration-options.

Thank you.

Most helpful comment

Try this:

{
    "packageRules": [{
        "packagePatterns": ["*"],
        "enabled": false
    }, {
        "paths": ["packages/charlie/package.json"],
        "enabled": true
    }]
}

All 4 comments

Try this:

{
    "packageRules": [{
        "packagePatterns": ["*"],
        "enabled": false
    }, {
        "paths": ["packages/charlie/package.json"],
        "enabled": true
    }]
}

This works but I have a follow up question please:
how can i amend this to have renovate only suggest minor version updates? (and avoid major version update PRs)

I tried to amend your recommended configuration and added updateTypes: ["minor"]:

{ 
  "packageRules": [
    {
      "packagePatterns": ["*"],
      "enabled": false
    },
    {
      "paths": ["packages/charlie/package.json"],
      "enabled": true,
+      "updateTypes": ["minor"]
    }
  ]
}

To my surprise this caused renovate to ignore all packages in charlie!
I debugged lib/util/package-rules.js and found this happens because in the second pass over the second packageRule, updateTypes.length > 0 and config.updateType == undefined, and so in turn !isMatch == true and therefore negativeMatch == true which causes renovate to ignore the second packageRule.

Try this:

{
    "packageRules": [{
        "packagePatterns": ["*"],
        "enabled": false
    }, {
        "paths": ["packages/charlie/package.json"],
        "enabled": true
    }, {
        "updateTypes": ["major"],
        "enabled": false
    }]
}

tried it. it works ๐Ÿ‘
thank you.

BTW, this also this works

{
  "enabledManagers": [
    "npm"
  ],
+  "major": {
+    "enabled": false
+  },
  "packageRules": [
    {
      "packagePatterns": [
        "*"
      ],
      "enabled": false
    },
    {
      "paths": [
        "packages/yoshi/package.json"
      ],
      "enabled": true
    }
  ]
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

bjeanes picture bjeanes  ยท  9Comments

stefee picture stefee  ยท  4Comments

dmt0 picture dmt0  ยท  10Comments

diagonalfish picture diagonalfish  ยท  3Comments

sjparkinson picture sjparkinson  ยท  5Comments