-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Categorize type-only and controller-messaged deps correctly #4449
base: main
Are you sure you want to change the base?
Conversation
ca3d2f3
to
0166adf
Compare
There are two special kinds of dependencies that have been frequently miscategorized: - Type-only dependencies: These are dependencies from which no runtime code is used, but only TypeScript types. Since consumers need these types in order to write TypeScript code, these should be listed under `dependencies` (not `devDependencies`). - Controller-messaged dependencies. Say that controller A talks to controller B. Controller B in this case needs to be a dependency of A. Furthermore, a project that wants to use controller A needs to instantiate B before A. Because of the intercommunication between these controllers, in order to prevent runtime errors, the version of controller B that A relies on must match the version of B that the _project_ relies on. To enforce this, B must be listed under A's `peerDependencies`, even if it is also listed under its `dependencies`. This commit corrects dependencies for each package in the monorepo such that they follow the rules above. In rare cases dependencies that were completely used in production code were listed under `devDependencies`. These have been corrected as well.
0166adf
to
b7434cb
Compare
This seems like a misunderstanding. It's not typically the case that consumers would need the same type dependencies to be in the dependency tree in order to use a package's types. This is only the case when another packages types are exported directly. If that happens, that dependency's types will also end up directly referenced in the resulting types. Any project using this package would need to have the package the types come from as well, or it would be an invalid reference. But that's not true when the types aren't exported. If they're just used internally by the package, they don't exist at all for package consumers. This is more commonly the case, and in general I think we should avoid exporting third-party types so that our packages can have fewer dependencies. You can see some examples of what I mean in this diff. If you build all packages and look at
That type comes from However, if you look at the two packages you've moved to |
Additionally, in general we should never have a package listed as both a Every |
Thanks for the feedback! I have to think about this a bit more. Moving to draft in the meantime. |
I've thought about it and your suggestion makes sense. It sounds like I need to adjust the constraints to disallow a package from appearing in both I'll return to this after we've upgraded to Yarn v4 and converted the constraints to JavaScript, because I think it'll be easier to modify the constraints then. |
Explanation
There are two special kinds of dependencies that have been frequently miscategorized:
dependencies
(notdevDependencies
).peerDependencies
, even if it is also listed under itsdependencies
.This commit corrects dependencies for each package in the monorepo such that they follow the rules above. In rare cases dependencies that were completely used in production code were listed under
devDependencies
. These have been corrected as well.References
Fixes #2062, and related (but unfiled) problems.
Changelog
(Updated in PR)
Checklist