Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@types grouping with sibling packages #4893

Closed
pvinis opened this issue Nov 27, 2019 · 7 comments
Closed

@types grouping with sibling packages #4893

pvinis opened this issue Nov 27, 2019 · 7 comments
Labels
manager:npm package.json files (npm/yarn/pnpm) priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:requirements Full requirements are not yet known, so implementation should not be started type:feature Feature (new functionality)

Comments

@pvinis
Copy link

pvinis commented Nov 27, 2019

What Renovate type are you using?
Regular one on Github.

Describe the bug

Packages like react and types associated with them like @types/react don't get updated in the same PR.

By default, DefinitelyTyped is keeping the first 2 numbers of the versions in sync, so react@1.2.x will have @types/react@1.2.y.

When renovate tried to upgrade to react@2.0.x, it should also go to @types/react@2.0.y.

Did you see anything helpful in debug logs?

Not really.

To Reproduce

https://github.com/pvinis/bug-renovate-types-sync

Here I have react and @types/react, react-native and @types/react-native. All of them are not in their latest version.

I got the PR for pinning, merged it.

After that I got pvinis/bug-renovate-types-sync#3 and pvinis/bug-renovate-types-sync#4 to upgrade the @types deps, both are not pointing in versions that in theory are incompatible with the package version of react and react-native.

Soon I will get PRs for upgrading react and react-native.

As I see it, there are 2 things here that should go differently.

  • @types/react should be upgraded in the same PR as react. (same for react-native)
  • @types/react should not offer to upgrade to something that's later than the react version we have. (that one is not as important)

Additional context

@pvinis
Copy link
Author

pvinis commented Nov 27, 2019

I just noticed in a private repo that react-redux and @types/react-redux were grouped.
Screenshot 2019-11-27 at 13 09 17

Could it be that react and react-native are somehow not matched correctly?

@rarkins
Copy link
Collaborator

rarkins commented Nov 27, 2019

Synchronising @types versions is actually a duplicate of one of the oldest issues we have opened: #519

It's actually a pretty challenging problem, although maybe one day we'll work out an elegant way to solve it.

The second part is why these types aren't being grouped together with their parent package. In this case, it's because the react packages are being specifically grouped: https://github.com/renovatebot/presets/blob/72658888f765b52b8b314a7894a3655dccd85548/packages/renovate-config-monorepo/package.json#L344-L349

We ideally would have an automated way to group these types but right now it's another hard problem!

@pvinis
Copy link
Author

pvinis commented Nov 27, 2019

Thanks for the info. I am familiar with the renovate-config-monorepo part, but I didn't know this basically "breaks" the normal way.

So there is nothing I/we can do to help for this? Do we just need to wait for the renovate team to work it out?

@rarkins
Copy link
Collaborator

rarkins commented Nov 27, 2019

Locally you could define your own package rule like this:

{
  "packageNames": ["@types/react", "@types/reactive-native"],
  "groupName": "react monorepo"
}

And this could put the types into the same group as the main packages. But it won't do anything about the "sync" problem with versions.

@rarkins rarkins changed the title @types sync @types grouping with sibling packages Dec 11, 2019
@rarkins rarkins added manager:npm package.json files (npm/yarn/pnpm) type:feature Feature (new functionality) needs-requirements priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others labels Dec 11, 2019
@DanielMSchmidt
Copy link

If someone runs into the same problem and want a starting point for a scripted solution: I have this gist for updating the renovate.json with package rules: https://gist.github.com/DanielMSchmidt/a1a5e3f753a52e13f53efeac42579461

@falkenhawk
Copy link

Locally you could define your own package rule like this:

{
  "packageNames": ["@types/react", "@types/reactive-native"],
  "groupName": "react monorepo"
}

And this could put the types into the same group as the main packages. But it won't do anything about the "sync" problem with versions.

@rarkins wouldn't it be just enough for now if renovate treats @types the same way as in #1368 but that it also works for packages listed in the default monorepo package groups? 🤔 It looks like the monorepo grouping takes precedence and disables the standard @types treatment.

@rarkins
Copy link
Collaborator

rarkins commented Nov 26, 2020

No, it wouldn't work.

#1368 makes it so that @types/foo goes into a branch like renovate/foo-1.x instead of renovate/types-foo-1.x. This works if you don't have grouping.

Meanwhile monorepo grouping is based on source URL and @types/ packages come from a different source. And the branch name is like renovate/react-monorepo.

@rarkins rarkins added the status:requirements Full requirements are not yet known, so implementation should not be started label Jan 12, 2021
@rarkins rarkins closed this as completed Aug 8, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
manager:npm package.json files (npm/yarn/pnpm) priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:requirements Full requirements are not yet known, so implementation should not be started type:feature Feature (new functionality)
Projects
None yet
Development

No branches or pull requests

4 participants