-
-
Notifications
You must be signed in to change notification settings - Fork 376
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
The package altair-koa-middleware peer dependency @koa/router needs to be updated:
| "@koa/router": "~11.0.2", |
It currently doesn't support @koa/router v12, here is the error when you attempt to npm install a project with the latest versions of @koa/router and altair-koa-middleware:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [redacted]@undefined
npm ERR! Found: @koa/[email protected]
npm ERR! node_modules/@koa/router
npm ERR! @koa/router@"^12.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @koa/router@"~11.0.2" from [email protected]
npm ERR! node_modules/altair-koa-middleware
npm ERR! altair-koa-middleware@"^5.2.11" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Also, using ~ for the peer dependency is problematic, because it prevents projects from being able to install minor version updates of @koa/router. Please use ^ instead!
The peer dependency koa-send is an implementation detail of this package and should be a dependency, not a peer dependency:
| "koa-send": "^5.0.1" |
Projects should not have to manually install koa-send, as it's not a dependency of their package, but rather a dependency in a dependency. Some versions of some package manages attempt to automatically install peer dependencies in dependencies, so people might not realize this is a problem. But relying on this automatic resolution can cause problems: Try a different package manager; boom. Someone might come along and add koa-send as a dependency to the project because they need to use it directly, and if it's a newer version than altair-koa-middleware peer requirements, boom. If you are relying on user's having automatic installation of peer dependencies, then why not just make it a real dependency and get that behavior properly.
Expected Behavior
- You should be able to install
altair-koa-middlewarewith the current version of@koa/router(currently v12.0.1), without an npm install error. - Projects should be able to install
@koa/routerminor updates without having to wait foraltair-koa-middlewareto update its peer dependency requirement each time. - Projects should not have to manually install
koa-sendas a dependency.
Steps To Reproduce
npm install @koa/router.npm install altair-koa-middleware.
Environment
- OS: N/A
- Browser: N/A
- Platform: N/A
- Version: [email protected]Additional context
Projects that use the npm package manager and need to use the current version of @koa/router with altair-koa-middleware can add this to their package.json file as a temporary workaround hack:
{
"overrides": {
"@koa/router": "$@koa/router"
}
}