Skip to content
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:theia-extensions command #12596

Merged

Conversation

sgraband
Copy link
Contributor

@sgraband sgraband commented Jun 7, 2023

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 like loadash or rimraf. Thats why:

This allows to check for duplicate versions of theia extensions only.
Added the option only-theia-extensions to theia check:dependencies.
Theia extensions are identified via their theiaExtensions field in the package.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

  • Check out this PR and build with yarn
  • Go to dev-packages/cli and run yarn link
  • Checkout this example (or create any other example you would like) and run yarn link "@theia/cli" in its root
  • Run yarn to see the output (this will run theia check:theia-extensions on postinstall)

The provided example has a few issues built-in:

  • The test-extension requires a @theia/core version of 1.37.2 while the application depends on 1.38.0
  • To test nested (and 3rd-party) dependencies the following dependencies where added
    • 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 version 1.37.2 of @theia/(core|filesystem|process|variable-resolver|workpace)

So the result of theia check:theia-extensions should find the following issues:

  • Different versions for @theia/(filesystem|process|variable-resolver|workpace) from the application and @eclipse-emfcloud/modelserver-theia
  • Different versions for @theia/core from the application, @eclipse-emfcloud/modelserver-theia and test-extension
  • Different versions for @eclipse-emfcloud/modelserver-theia from test-extension-3 and test-extension-4

Note that one of the versions will always be hoisted to the root node_modules version

Review checklist

Reminder for reviewers

@vince-fugnitto vince-fugnitto added the theia-cli issues related to the theia-cli label Jun 8, 2023
@sgraband
Copy link
Contributor Author

@tsmaeder Would you have time to review this sometime this week or next week? Or should we find someone else to review this?

@tsmaeder
Copy link
Contributor

Sorry, this fell off the wagon. I'll make some time tomorrow. That said, could you resolve the conflicts?

This allows to check for duplicate versions of theia extensions only.
Added the option `only-theia-extensions` to `theia check:dependencies`.
Theia extensions are identified via their `theiaExtensions` field in the `package.json`.
The check is running recursively as long as it finds Theia extensions.
The advantage of this approach is that a shorter, but more important, list is returned.

Contributed on behalf of STMicroelectronics
Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks fine and seems to do what it promises.

@tsmaeder tsmaeder merged commit dab0aad into eclipse-theia:master Jul 14, 2023
@vince-fugnitto vince-fugnitto added this to the 1.40.0 milestone Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theia-cli issues related to the theia-cli
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

cli: add check for detecting multiple versions of the same theia extension
3 participants