-
Notifications
You must be signed in to change notification settings - Fork 6
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
Peer dependencies are never direct #2170
Conversation
🦋 Changeset detectedLatest commit: ee87cff The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
72b91ab
to
5752b08
Compare
This package uses If a different version of lib/my-app.test.ts:9:29 - error TS2345: Argument of type 'Stack' is not assignable to parameter of type 'Stack'.
Type 'Stack' is missing the following properties from type 'Stack': _suppressTemplateIndentation, _terminationProtection, toYamlString
9 expect(Template.fromStack(stack).toJSON()).toMatchSnapshot(); Use of If there's a better way describe this in the Footnotes
|
Yes, that’s a correct definition of what peer dependencies are meant to do. However, I’m not sure what specifying a dependency as both peer and direct achieves. It’s not a defined behaviour in the docs. Peer dependencies are automatically installed by NPM since v7, so there’s no need to specify it as a direct one to install it. |
https://github.com/guardian/service-catalogue/pull/680/files for a real-life example (see the added annotations). |
57e1354
to
4080032
Compare
there’s no value in having the same dependency declared as both direct and peer
Co-authored-by: Akash Askoolum <[email protected]>
4080032
to
ee87cff
Compare
Just to note this change follows the advice in https://docs.aws.amazon.com/cdk/v2/guide/manage-dependencies.html:
|
What does this change?
Make the following direct dependencies that are already listed as peers, dev:
aws-cdk-lib
,constructs
. This matches the setup ofaws-cdk
.How to test
Install the package somewhere.
How can we measure success?
Declaring peer dependencies that are also direct ones has no value
Have we considered potential risks?
Consumers should ensure that they have the correct peer dependencies
Checklist
Footnotes
Consider whether this is something that will mean changes to projects that have already been migrated, or to the CDK CLI tool. If changes are required, consider adding a checklist here and/or linking to related PRs. ↩
If you are adding a new construct or pattern, has new documentation been added? If you are amending defaults or changing behaviour, are the existing docs still valid? ↩