cli: Add check:theia-extensions
command
#12596
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What it does
The goal of this PR is to improve the existing
theia check:dependencies
script introduced in this PR. The existing script returns a list of all mismatching version numbers for all dependencies. While introducing two versions of the same dependency can always possibly introduce issues, this will be much more common for Theia extensions, than for other dependencies likeloadash
orrimraf
. Thats why:This allows to check for duplicate versions of theia extensions only.
Added the option
only-theia-extensions
totheia check:dependencies
.Theia extensions are identified via their
theiaExtensions
field in thepackage.json
.The check is running recursively as long as it finds Theia extensions.
The recursion was added to also display cases where more than 2 versions of a dependency might extist.
The advantage of this approach is that a shorter, but more important, list is returned.
Fixes #12572.
Contributed on behalf of STMicroelectronics
How to test
yarn
dev-packages/cli
and runyarn link
yarn link "@theia/cli"
in its rootyarn
to see the output (this will runtheia check:theia-extensions
on postinstall)The provided example has a few issues built-in:
test-extension
requires a@theia/core
version of1.37.2
while the application depends on1.38.0
test-extension
>test-extension-3
>@eclipse-emfcloud/modelserver-theia:0.8.0-theia-cr03
test-extension2
>test-extension-4
>@eclipse-emfcloud/modelserver-theia:0.8.0-theia-cr01
@eclipse-emfcloud/modelserver-theia:0.8.0-theia-cr01
depends on version1.37.2
of@theia/(core|filesystem|process|variable-resolver|workpace)
So the result of
theia check:theia-extensions
should find the following issues:@theia/(filesystem|process|variable-resolver|workpace)
from the application and@eclipse-emfcloud/modelserver-theia
@theia/core
from the application,@eclipse-emfcloud/modelserver-theia
andtest-extension
@eclipse-emfcloud/modelserver-theia
fromtest-extension-3
andtest-extension-4
Note that one of the versions will always be hoisted to the root
node_modules
versionReview checklist
Reminder for reviewers