Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] Update package altair-koa-middleware peer dependencies #2338

@jaydenseric

Description

@jaydenseric

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:

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-middleware with the current version of @koa/router (currently v12.0.1), without an npm install error.
  • Projects should be able to install @koa/router minor updates without having to wait for altair-koa-middleware to update its peer dependency requirement each time.
  • Projects should not have to manually install koa-send as a dependency.

Steps To Reproduce

  1. npm install @koa/router.
  2. 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"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions