T
TanStack3mo ago
blank-aquamarine

unmet peer dep issue w/ tanstack/router-cli

There is a minor issue when installing (at least w/ pnpm)
├─┬ @tanstack/router-cli 1.120.18
│ └─┬ @tanstack/router-generator 1.120.20
│ └── ✕ unmet peer @tanstack/react-router@^1.120.20: found 1.120.18
├─┬ @tanstack/router-cli 1.120.18
│ └─┬ @tanstack/router-generator 1.120.20
│ └── ✕ unmet peer @tanstack/react-router@^1.120.20: found 1.120.18
Most likely, this is usually a benign issue (since most releases of tanstack/* packages are "so that all sub-packages are on the same semver"). And it's also not an issue if you always stick to the latest version. But there might be some edge-cases where this will break something, right? The expected behavior would be for @tanstack/router-cli to require @tanstack/router-generator in the same version as itself. But looking at the distributed package.json for 1.121.27 (current) we see
"@tanstack/router-generator": "^1.121.27"
"@tanstack/router-generator": "^1.121.27"
Which means it accepts higher versions too. But since router-generator then also has react-router in its dependencies, it's likely users will have an "unmet peer" dep issue, since they probably install router-cli and react-router, but not router-generator
7 Replies
robust-apricot
robust-apricot3mo ago
if you can clean up the package dep structure, you are invited to do so 😆
blank-aquamarine
blank-aquamarineOP3mo ago
ah ah is there a script somewhere that "increments the semver" for all packages at once? Actually, I think the fix might be as simple as this
- "@tanstack/router-generator": "workspace:^",
+ "@tanstack/router-generator": "workspace:*",
- "@tanstack/router-generator": "workspace:^",
+ "@tanstack/router-generator": "workspace:*",
according to the pnpm docs on publishing (https://pnpm.io/workspaces#publishing-workspace-packages)
So for example, if we have foo, bar, qar, zoo in the workspace and they all are at version 1.5.0, the following:
{
"dependencies": {
"foo": "workspace:*",
"bar": "workspace:~",
"qar": "workspace:^",
"zoo": "workspace:^1.5.0"
}
}
{
"dependencies": {
"foo": "workspace:*",
"bar": "workspace:~",
"qar": "workspace:^",
"zoo": "workspace:^1.5.0"
}
}
Will be transformed into:
{
"dependencies": {
"foo": "1.5.0",
"bar": "~1.5.0",
"qar": "^1.5.0",
"zoo": "^1.5.0"
}
}
{
"dependencies": {
"foo": "1.5.0",
"bar": "~1.5.0",
"qar": "^1.5.0",
"zoo": "^1.5.0"
}
}
robust-apricot
robust-apricot3mo ago
can you create a PR for this?
robust-apricot
robust-apricot3mo ago
oh I thought this only affects one package
blank-aquamarine
blank-aquamarineOP3mo ago
I think I noticed a couple of them, but likely this is a strategy that should either be adopted for all packages or not at all
robust-apricot
robust-apricot3mo ago
cc @Sean Cassiere

Did you find this page helpful?