How to deploy plugins?

Hi there,
I’m currently figuring out what are the best options to build an application with Theia. So we think we want to use plugins as a way to go since they can be loaded on the fly. But if I want to build an application with them, how can I ship them? We found different approaches like creating a “plugins” folder on the root directory (where browser-app and electron-app lies) or a PATH variable. Only the PATH variable works, but if another one wants to use the application he also need to set this path.

In some way this is not convenient to me. Do you have another approach I just missed in my searches?

Thank you in advance!

[original thread by LouBen3010]

hello, AFAIK the current theia example is scanning for plugins folder. So the THEIA_DEFAULT_PLUGINS env variable is set automatically. You also might be interested in https://github.com/theia-ide/theia/pull/4376 where there is a cli option to set the folder for plug-ins
HTH

[LouBen3010]

Hi, thanks for the immediate help! This has been done now:

  1. Created a a new extension with yo

  2. Now I have my folder with the subfolders: hello-world-extension, browser-app and electron-app

  3. Added “@theia/plugin-ext” to package.json

  4. Created in this root folder a new one called called “plugins”

  5. Copied the folder containing the plugin sources and the *.theia file into this folder

As this did not work I also just placed the resulting *.theia file into the plugins folder and I also put this plugin folder into the browser-app folder in case that Theia wants us to develop plugins for the browser and electron app separately.

Am I doing something wrong?

Thanks again!

@louben3010 you can take the examples/browser of theia. It already contains the plugin extensions. You have to use yarn @theia/plugin and copy the .theia file into the root plugins folder of theia and perform yarn run start

[LouBen3010]

Thanks for the reply. We will test this soon :slight_smile:

[Stephen Raghunath]

@florentbenoit I tried this and it didnt work?

[Stephen Raghunath]

let me share some detial

[Stephen Raghunath]

preview@daab87987d18:~$ cat package.json | grep plugin "@theia/plugin": "next", "@theia/plugin-ext": "next", 

preview@daab87987d18:~$ ls -la plugins/ total 56 drwxrwxrwx 1 root root 4096 Apr 2 07:14 . drwxr-xr-x 1 preview preview 4096 Apr 2 07:11 .. -rwxrwxrwx 1 root root 45989 Apr 1 16:31 welcome_plugin.theia 

preview@daab87987d18:~$ npx yarn theia start /home/project --hostname=0.0.0.0

[Stephen Raghunath]

[Stephen Raghunath]

There should be a Show Welcome Screen action

[Stephen Raghunath]

This works when doing a Hosted instance of course

[Stephen Raghunath]

$ /home/preview/node_modules/.bin/theia --version
0.6.0-next.6133f8d6

hello, is it the examples/browser example ?

how do you run theia ?

in examples/browser when we ran it it is running

$ theia start --plugins=local-dir:../../plugins

else you can do
$ export THEIA_DEFAULT_PLUGINS=local-dir://absolute-path-to-plugins-folder
$ launching theia

[Stephen Raghunath]

Let me check

[Stephen Raghunath]

Hmm

[Stephen Raghunath]

Our theia runs from just the package.json in our docker file:

[Stephen Raghunath]

ADD package.json /home/preview/package.json

[Stephen Raghunath]

npx yarn theia build

[Stephen Raghunath]

Let me try with the options you listed above

[Stephen Raghunath]

The option flag worked! Thankyou!