-
Notifications
You must be signed in to change notification settings - Fork 45
feat: validate crawlee versions in Actor.init
#301
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
Conversation
Why do we not just declare crawlee as a peer dependency? Would solve this, no? |
The SDK depends on `@crawlee/core`, but if the user installs an incompatible version of crawlee, they might end up with two installations of the `@crawlee/core` which means multiple static registers like the one for the global configuration, which breaks the integration, since the SDK will only touch the global config it sees, but it's a different one than the explicitly installed package. Closes #237
e3d71d0
to
ecdcdab
Compare
You mean declare it only as a peer instead of a real dependency? In the good old times, that would require the user to install it. Nowadays I believe different package managers do different things, as NPM just decided to install them (which is IMO nonsense in the first place), but yarn wont do that and fail. We don't want people to install both if they don't want to use crawlee. And honestly, I would like to keep this validation even if it would help. It wont do any harm if things are set up correctly or the node modules folder is not even present. But it will catch such issues if its there. |
I'm just worried about relying on fs checks for this... What if
Specifically I'm worried that if our checks don't cover enough we'll need to patch release a few times till we get it right™️ Peer dependencies would solve some of these issues, but because the ecosystem cannot decide what the hell it wants, it's like you said, a mess. npm now automatically installs peer deps (but if you specify a different version that matches the range it won't install twice), yarn does... either nothing or something (looking at you peerDependencyMetadata), who knows about pnpm/bun. There is also Unrelated, but please use path.join for paths, something something windows 😄 |
Flattening works only if the version ranges match, and then there is no problem. I've been using similar checks for quite some time (years), and I got inspired by docusaurus doing the same (or similar) thing too. Yes, we might need to improve the logic over time, but only to make it more strict, not to fix some issues it introduces.
This is not an optional peer, its required, that's why its an actual dependency in the first place. |
Optionals still get installed. They're "optional" in the sense that if it fails to install it won't throw an error and abort the whole install process |
used |
Well, that's the part I was referring to, NPM does that nowadays, I don't think yarn would (at least it wasn't doing that some time ago and failed instead)... edit: uh, I got confused with this again, I keep taking about peers but we are talking optional instead... Again, its not optional dependency at all. |
I think so, yeah! |
2bc86c7 will help with pnpm and yarn pnp |
I will merge this in and release, worst case we can revert, but it looks all good locally and will help at least with the happy path. |
The SDK depends on
@crawlee/core
, but if the user installs an incompatible version of crawlee, they might end up with two installations of the@crawlee/core
which means multiple static registers like the one for the global configuration, which breaks the integration, since the SDK will only touch the global config it sees, but it's a different one than the explicitly installed package.Closes #237