msw-storybook-addon
msw-storybook-addon copied to clipboard
Dependencies are out of date with MSW
I have msw 0.38.2 in my project. I tried to update this addon and npm failed with this error:
npm ERR! Found: [email protected]
npm ERR! node_modules/msw
npm ERR! dev msw@"^0.38.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer msw@"^0.35.0 || ^0.36.0" from [email protected]
Hey, @sklawren. Thanks for reporting this.
It looks like the msw
peer dependency version is locked under the 35 - 36 range:
https://github.com/mswjs/msw-storybook-addon/blob/ecd05995bc6b81748300b60acb37651d84d623c3/packages/msw-addon/package.json#L42-L44
We should consider updating it. Not sure if including a permissive range like 0.x
is a good idea given minor releases can have breaking API changes.
Hey, @yannbf. Let me know if you need any help updating the dependencies. There were no user-facing breaking changes since 0.38.0.
Hey, @yannbf. Let me know if you need any help updating the dependencies. There were no user-facing breaking changes since 0.38.0.
Will do it tomorrow!
Hey @kettanaito do you happen to know why there was no release for this change?
https://github.com/mswjs/msw-storybook-addon/runs/5652564872?check_suite_focus=true
This is still a problem with add-on 1.6.1 - it doesn't work with msw 0.39.2
Hey, @yannbf. Strange, the CI states that there we no changes to be released:
[11:17:18 PM] [semantic-release] › ℹ There are no relevant changes, so no new version is released.
I think that's because dep:
prefix does not trigger releases in Semantic Release:
dep: expand msw peer dependency version range (#76)
We should rewrite that commit to be either fix:
(patch) or feat:
(minor). Which one would be the suitable release version bump?
Hey, @yannbf. Strange, the CI states that there we no changes to be released:
[11:17:18 PM] [semantic-release] › ℹ There are no relevant changes, so no new version is released.
I think that's because
dep:
prefix does not trigger releases in Semantic Release:dep: expand msw peer dependency version range (#76)
We should rewrite that commit to be either
fix:
(patch) orfeat:
(minor). Which one would be the suitable release version bump?
Ah good catch! I added a new commit to check if this will be triggered. 🤞
Seems like it all worked well and 1.6.2 got released! Please try it out and let us know if there are any issues with it. Thank you!
I'm using MSW package version ^0.39.2
and same peer dependency warning still occurring after release 1.6.2
.
Apparently the version declared inside of the peer dependency declaration is invalid. Maybe the value must be ^0.35.0
instead of ^0.35
![image](https://user-images.githubusercontent.com/15058771/162230216-01c61661-b7f6-456a-ac3f-c0c64ebbf559.png)
I don't see the peerDependency
on msw
being bumped at all in the latest main:
https://github.com/mswjs/msw-storybook-addon/blob/1cb08724d687648b87d933fb7bc8fb2d91d2cda3/packages/msw-addon/package.json#L42-L44
@drianoaz, what you experience appears to be what is published.
I think we had a mistake in #76:
Set MSW as a peer dependency from 0.35 and higher minor versions.
As MSW is pre-1.0, the ^
rage will not include minor releases, only patch releases.
@yannbf, may I please ask you to bump the peer dependency as
{
"msw": "0.x"
}
I believe this should be a valid syntax but it's worth double-checking.
Hey @kettanaito sorry for the trouble! I just merged a fix with a more explicit version range:
>=0.35.0 <1.0.0
I think it's better than 0.x so that users are using at least a more up to date version. If you think it's better to just be more open than that and go with 0.x, I can do that too!
Not sure if this issue is considered closed, but it looks like msw 0.41.0
introduces some breaking change related to GraphQL queries. Maybe it's better pre-1.0 to lock to tested versions?
Hey, @andyvanee 👋 To my best knowledge, there shouldn't be any breaking changes to how GraphQL operations are intercepted/mocked. Please, if you experience any issues around that, could you submit an issue with a reproduction repository?
Given that a pre-1.0 package can (and will) introduce breaking changes in minor versions, I still think that it's a much safer strategy to lock in the peer dependency to an exact minor version and have it updated manually with each release. The worst that would happen to people running old version is that they won't get new features and bugfixes (custom resolutions is still a thing). The worst that would happen if a breaking change slips through after another npm install
it, well, their stories will break.
@yannbf, sorry for ping/ponging on this for some time but what do you think about this as of now?
Hey, @andyvanee 👋 To my best knowledge, there shouldn't be any breaking changes to how GraphQL operations are intercepted/mocked. Please, if you experience any issues around that, could you submit an issue with a reproduction repository?
Sure @kettanaito, unfortunately the project I'm working on has a rather complex config, so I haven't been able to isolate the issue for a clean repro 😭 . All I know is that dependabot upgraded us to msw 0.41.0
which broke storybook and reverting to 0.39.2
solves the issue. This is the console error:
runtime~main.iframe.bundle.js:31
Uncaught TypeError: Cannot read properties of undefined (reading 'QUERY')
at Module../node_modules/msw/lib/esm/index.js
I will dig in a bit more to see if I can reproduce. Thanks!
@andyvanee i could fix that error with upgrading my graphql client to the newest version "graphql": "^16.5.0"
Hi, whilst debugging issue https://github.com/mswjs/msw/issues/1442 I realized that none of the fixes released for https://github.com/mswjs/msw/issues/929 would be in version >=0.35.0 <1.0.0
. So was wondering if it was possible to use a more a recent version of msw in this addon.
Then I realized that I manually added the latest msw and used that to generate the mockServiceWorker.js
in public
(Vue) and I can and have been using the new methods described here: https://github.com/mswjs/msw/releases/tag/v0.44.0
So I'm quite unsure at this point whether I'm using ^0.30.x
or ^0.40.x
. Would you have any idea as to how to verify?
Is the 'final' version of msw determined by mockServiceWorker.js?
Basically there's either a bug (feature) in this addon by supplying an older version or a bug in msw 0.47
Tried forking and publishing my own msw-storybook-addon but was unsuccessful. Considering the GraphQL issues mentioned above, would it be an idea to release a msw-storybook-addon:1.6.4-beta
(for example) for us to test?
I realized that none of the fixes released for https://github.com/mswjs/msw/issues/929 would be in version >=0.35.0 <1.0.0
That doesn't sound correct. The fix was introduced in 0.x.0
and it does match the semver you've posted. The other issue is that a pre-1.0 release contains breaking changes in minor version bumps, so this addon intentionally locks MSW peer dependency on minor versions (or, at least, it used to).
So I'm quite unsure at this point whether I'm using ^0.30.x or ^0.40.x. Would you have any idea as to how to verify?
npm ls msw
Once again, pull requests are welcome to update msw
.
Also, I now see that the version lock was removed in https://github.com/mswjs/msw-storybook-addon/pull/81 so this issue doesn't stand anymore. Any minor version of MSW will be pulled in, so it's your responsibility to choose which version you want to use.