-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat(src): enable types as peer dependencies to get around bumping wi… #35
feat(src): enable types as peer dependencies to get around bumping wi… #35
Conversation
"@aws-sdk/types": "^3.18.0", | ||
"@aws-sdk/client-dynamodb": "^3.18.0", | ||
"@aws-sdk/client-sns": "^3.18.0", | ||
"@aws-sdk/client-sqs": "^3.18.0", | ||
"@aws-sdk/lib-dynamodb": "^3.18.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the latest versions updated for local tests. We may as well just pull in the latest for tests to run against those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind that the ^
doesn't mean the "latest" will be installed when you run npm / yarn install
. If you install dependencies today and a new version will be released tomorrow, running yarn install
again will not install the fresh versions, since the matching ones are already installed.
This is one of the reasons why I prefer to specify exact dependency versions (in open source only dev dependencies ofc).
But let's keep it that way, I may just change it later.
"@aws-sdk/client-sqs": "3.18.0", | ||
"@aws-sdk/lib-dynamodb": "3.18.0", | ||
"@aws-sdk/types": "3.18.0", | ||
"@aws-sdk/types": "^3.18.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Types is also the latest for just dev work.
@@ -45,12 +45,15 @@ | |||
"sinon": "^11.1.1", | |||
"tslib": "^2.1.0" | |||
}, | |||
"peerDependencies": { | |||
"@aws-sdk/types": "^3.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should allow any aws-sdk/type above 3.0.0 that the customer wants to bring. This is should be resolved at a higher tree node when people npm install
Hey, thank you for the PR! While peer dependency in fact looks like a way to go, I can't make it work locally. Locally, I changed dev dependencies to As a result, I'm getting Client incompatibility error. It only works with Maybe I'm doing something wrong. Can you double-check it on your side? |
@m-radzikowski Are you publishing this to a local npm proxy? and then pulling from there? I use verdaccio. If you use yarn link or something like that it'll peer types badly |
The dev deps shouldn't be exposed at all |
Ok, hoped the yarn to be a little bit smarter. Will try the verdaccio, thanks! Btw, please run |
on it! |
Codecov Report
@@ Coverage Diff @@
## main #35 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 5 5
Lines 77 77
Branches 9 9
=========================================
Hits 77 77 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works well and I learned something new. Thanks!
"@aws-sdk/types": "^3.18.0", | ||
"@aws-sdk/client-dynamodb": "^3.18.0", | ||
"@aws-sdk/client-sns": "^3.18.0", | ||
"@aws-sdk/client-sqs": "^3.18.0", | ||
"@aws-sdk/lib-dynamodb": "^3.18.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind that the ^
doesn't mean the "latest" will be installed when you run npm / yarn install
. If you install dependencies today and a new version will be released tomorrow, running yarn install
again will not install the fresh versions, since the matching ones are already installed.
This is one of the reasons why I prefer to specify exact dependency versions (in open source only dev dependencies ofc).
But let's keep it that way, I may just change it later.
Description
Changes aws-sdk-client-mock to use peer dependencies for AWS clients instead of pinned dependencies so that users can "bring their own" version. This fixes a bunch of type errors where typescript would expect the latest types without actually needing them. There's no reason that aws-sdk-client-mock needs to be updated with each and every single update to the AWS JS SDK v3.
This is the follow up to our action item from last week's meeting with @m-radzikowski
Similar PR for higher level libraries in aws-sdk-v3:
aws/aws-sdk-js-v3#2516
Testing
I've published this to my local verdaccio and tested that I can plug in any 3.x.x version. I'd appreciate another set of eyes here. Hopefully i'm not missing too much :).