Skip to content
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

fix!: remove libStorage helper to remove incompatibilities #105

Merged
merged 2 commits into from
Jun 26, 2022

Conversation

m-radzikowski
Copy link
Owner

The mockLibStorageUpload was introduced to mock the @aws-sdk/lib-storage Upload method. In fact, it just mocks two underlying Commands from @aws-sdk/client-s3 used by the Upload method.

Since it was mocking @aws-sdk/client-s3 Commands, the library needed a dependency on the @aws-sdk/client-s3 and @aws-sdk/types. For users that did not use the client-s3 or lib-storage at all and did not specify it as a dependency by themselves in package.json, those two packages, specified as peer dependencies, were installed automatically by the NPM v7 and newer.

However, automatically installing the @aws-sdk/types in the latest available version often lead to it being incompatible with the versions of @aws-sdk/client-* packages, resulting in type errors and other other issues.

To fix this, in v1.0.0 the @aws-sdk/types and @aws-sdk/client-s3 were removed from the peer dependencies. The idea was to expose the mockLibStorageUpload from a separate path (aws-sdk-client-mock/libStorage). Not having the mockLibStorageUpload exposed in the main index.ts made the library work just fine without @aws-sdk/types and @aws-sdk/client-s3 installed. Users that wanted to use mockLibStorageUpload had to install those two libraries.

mockLibStorageUpload function was exposed under a aws-sdk-client-mock/libStorage path with the new package.json exports parameter. However, adding this parameter turned out to cause various effects and incompatibilities depending on the user's project configuration.

The mockLibStorageUpload helper was mocking just two client-s3 Commands. This is trivial and short to implement yourself when needed. Since the helper was constantly causing problems since it was added, I decided it will be better to remove it altogether and replace with a short instruction in the README on how to mock the libStorage yourself.

@codecov-commenter
Copy link

codecov-commenter commented Jun 26, 2022

Codecov Report

Merging #105 (41e1bac) into main (7ee8044) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##              main      #105   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         6    -1     
  Lines          165       157    -8     
  Branches        22        21    -1     
=========================================
- Hits           165       157    -8     

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ee8044...41e1bac. Read the comment docs.

@m-radzikowski m-radzikowski merged commit 097d29f into main Jun 26, 2022
@m-radzikowski m-radzikowski deleted the remove-libstorage branch June 26, 2022 15:54
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.

2 participants