Skip to content

Conversation

@undefined-moe
Copy link

otherwise it breaks on yarn2

otherwise it breaks on yarn2
@MarkHerhold
Copy link
Contributor

Hi @undefined-moe, thanks for this! Could you please provide a link to an existing issue related to yarn and peer dependencies? Happy to add this, just need to see that this is the correct approach because the behavior in npm makes peer dependencies unnecessary.

@undefined-moe
Copy link
Author

image

I'm also using yarn workspace, and hydrooj is one of the submodules.

deps of hydrooj:

    "dependencies": {
        "@undefined-moe/detect-browser": "^5.2.0",
        "adm-zip": "^0.5.1",
        "ansi_up": "^4.0.4",
        "cookies": "^0.8.0",
        "fs-extra": "^9.1.0",
        "js-yaml": "^4.0.0",
        "koa": "^2.13.1",
        "koa-body": "^4.2.0",
        "koa-proxies": "^0.11.0",
        "koa-router": "^10.0.0",
        "koa-static-cache": "^5.1.3",
        "lodash": "^4.17.20",
        "lru-cache": "^6.0.0",
        "minio": "7.0.17",
        "moment-timezone": "^0.5.32",
        "mongodb": "^3.6.3",
        "nodemailer": "^6.4.17",
        "p-queue": "^6.6.2",
        "serialize-javascript": "^5.0.1",
        "sockjs": "^0.3.20",
        "superagent": "^6.1.0",
        "systeminformation": "^4.34.9",
        "terminal-kit": "^1.45.8",
        "yargs": "^16.2.0"
    },

and package @undefined-moe/koa-body (which makes koa a peer dep) works well for me.

@undefined-moe
Copy link
Author

any information?

Copy link
Member

@3imed-jaberi 3imed-jaberi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@undefined-moe
Copy link
Author

Any update for this?

@jonathanong
Copy link
Member

we should be using semver. why is this an issue? seems like a yarn problem?

@undefined-moe
Copy link
Author

Yarn introduces strict check in pnp mode (pnpm also have similar logic, unless you use flags like hoist or loose-mode), if you want to access types, you'll have to declare it in dep, devDep, optionalDep, or peerDep.
As koa-body imports koa in code, it's required to declare it as a dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants