-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
cli: add check for detecting multiple versions of the same theia extension #12572
Comments
@gergaudf you can use
|
Thanks @vince-fugnitto , |
@gergaudf I'm not really sure I follow, the CLI should help with discovering and identifying multiple versions of extensions, for both the ones provided by the framework by default and new extensions developed by extension developers given that the extension itself pulls
As mentioned there are already mechanisms to identify when multiple versions are pulled, we just need to use them.
|
Thanks for your answer @vince-fugnitto.
|
@gergaudf no problem, the current CLI tool is mainly a helper for identifying the same I believe it may be more of an issue with your development setup, for example you may want to use a If it's something you want to investigate please don't hesitate in providing a pull-request. In addition, I believe there exists utilities already to discover duplicates, for example |
Hi @vince-fugnitto, I think that this would make a nice addition to the Theia CLI. It's true that it's already possible to find duplicates with existing tools, however in many cases duplicates are not a problem. For example consuming two versions of lodash, while not ideal, does not lead to problems at runtime. Therefore existing tooling can't be used as is but must be further processed. While the example given in the thread focuses on an accidental duplication of own packages, this can also be taken further to 3rd party dependencies unrelated to mono-repo management. For example EMF Cloud offers a number of Theia extensions on which own packages typically require directly but also transitively. It would be nice to have a convenient check for this use case too. I think the Theia CLI or the Theia source gen would be great places for this check. They already handle dependencies so conceptually they "simply" need to be extended. Any occurrence of a Theia extension duplication will most certainly lead to runtime problems which is a Theia specific property. All Theia based apps would profit from such a check and many will implement it redundantly if it's not provided. As we already offer a Theia specific dependency check with |
Yes, that's the idea 👍 |
Couldn't this check be done systematically by the Theia CLI build command instead of check:dependencies? I may misunderstand the rational here, so please correct me if I am wrong: if any theia extension cannot coexist in different versions at runtime, shouldn't we avoid building Theia application in this case? |
I can see arguments for both, a specific check or adding this check to the build. Note that the source of truth for dependencies also differs between frontend and backend. Frontend dependencies are determined at build (i.e. bundle) time while the backend entries are determined during build time but the resolving and execution happens at runtime. Technically packed Electron builds also transform the dependencies and would require another check. As we already have the Theia version check as part of the Theia CLI it would be consistent to also do the duplicate Theia extensions check there. Otherwise the Theia version check could also have been part of the build. So personally I would just add it to the CLI too. However adding it to the Is there a specific preference on your side @vince-fugnitto? |
@sdirix I'd be fine to keep it as a CLI tool to start with, downstream can easily call it during their build process if needed. |
It seems that a Theia extension could not exist in 2 different versions at runtime as one would override the other in the Dependency Injection context, leading to unexpected behavior during runtime (or is it overridden during the Theia CLI build?). In our case, we develop several Theia extensions and we systematically have to check that they are all on a single version from the product's dependency graph. On one hand, we have a tool similar to the dependency check utility which require us to know in advance all Theia extensions in our dependency graph, on the other hand, the Theia CLI filters the dependency graph to get all Theia extensions during the build.
Feature Description:
Would it be possible for the Theia CLI to automatically detect if a Theia extension with 2 different versions is present in the dependency graph during the build? using an option like "-ensure-theia-extensions-version-uniqueness" would fail the build if this is the case.
The text was updated successfully, but these errors were encountered: