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

Patching mechanism for Theia dependencies #13501

Open
tsmaeder opened this issue Mar 19, 2024 · 1 comment
Open

Patching mechanism for Theia dependencies #13501

tsmaeder opened this issue Mar 19, 2024 · 1 comment

Comments

@tsmaeder
Copy link
Contributor

Feature Description:

Currently, we need to do two simple patches in PhosphorJS in order for "secondary window" support to work. However, various fixes in secondary windows support require more extensive fixes in PhosphorJS.
The mechanism we use up to now for patching Phosphor is based on the string-replace-loader webpack plugin: we search and replace strings when doing the webpack-build of the front end. This has a couple of problems:

  1. It does not work in cases where adopters do not want to use webpack
  2. It does not work if the interface of the library is patched, because webpack is invoked after compilation of Typescript files
  3. It is very hard to manually write and maintain the string replacements, aka it just does not scale.

In https://github.com/eclipse-theia/theia/pull/13493/files, I'm proposing a way to use patch-package to apply patches to Theia dependencies. However, this approach requires adopters to invoke the script theia-patch in directory where their node_modules folder is located. We can't really fully automate this, since npm modules may be linked into the node_modules folder, so we can't really determine the root node_modules folder from a script inside the package contents, using for example a postInstall or precompile' script on the Theia core package. One way to solve this problem would be to write our own script that uses require.resolve()` to find the installation location of the packages we would like to patch and the patch files themselves instead of relying on the file system. However, this would be a non-trivial effort, maybe a couple of days.

@tsmaeder
Copy link
Contributor Author

A good example of what a Theia-based monorepo might look like is https://github.com/eclipse-theia/theia-blueprint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant