Theia: termux.com

Created on 17 Feb 2020  路  12Comments  路  Source: eclipse-theia/theia

Since there is no X11 server in termux, theia seems to be a perfect fit to have a "local" full-featured IDE on Android. Actually, Codiad is listed now, which seems not to be activelly developed: https://wiki.termux.com/wiki/Text_Editors

Unfortunately, none of the options in https://github.com/eclipse-theia/theia#getting-started seems to fit this use case. Ideally, one might run a script such as the following:

git clone https://github.com/eclipse-theia/theia
cd theia
yarn theia build
node main.js /home/project --hostname=0.0.0.0

The closest seems to be Develop a Theia application - your own IDE, but I don't want to customize theia.

Which is the suggested approach to try theia locally, provided that all non-JS dependencies are already available (i.e. no docker container is required)?

/cc @xeffyr

question termux

Most helpful comment

@eine

  • check out this repo
  • run yarn to build everything from root
  • cd examples/browser
  • yarn theia build --mode production

After that you can start an example app built in the production mode.

All 12 comments

https://github.com/eclipse-theia/theia#getting-started is for development
https://theia-ide.org/docs/composing_applications is for composing own app, but it is probably out-dated

@akosyakov, precisely this issue is a request for a default package.json (such as the one in https://theia-ide.org/docs/composing_applications) to be added and/or documented somewhere in this repo or in https://github.com/theia-ide/theia-apps. Currently, AFAIK it is not possible to programmatically clone and start theia without using either docker, a hosted web service or Electron.

@eine How usually something is consumed by termux? Is there some special kind of packaging? Sorry i'm not familiar with it. But one could use docker for instance to package Theia for termux and publish somewhere, and the consume from there in termux. I don't think any of active committers will work on it.

@akosyakov, let's forget about termux to make it easier for now.

I'm on a GNU/Linux (sub)system. I have git, nodejs, etc. installed in this environment. Now, I want to try Theia without docker, without a hosted service and without Electron. I want to run yarn serve, open my browser and use Theia from localhost:8080. Is this possible?

According to the docs, it seems that there is no such a "demo" execution use case. Of course, I can create "my own IDE", but I really don't want to customise anything. I just want to try Theia as is, from sources.

Moreover, I'm ok if there is no built-in web server. I.e., I can yarn build and then serve some dist folder with any web server. I assume that this is similar to what is explained in https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md However, I'd like to ensure that the build is for production not for development.

EDIT

Note that neither docker nor electron are valid options because termux runs on Android. At the same time, a hosted service is an not an option because the purpose is to use Theia in environments without network access (e.g., a plane).

@eine

  • check out this repo
  • run yarn to build everything from root
  • cd examples/browser
  • yarn theia build --mode production

After that you can start an example app built in the production mode.

@akosyakov, thanks a lot!

It seems that it is not possible to build Theia in termux. This is because termux's NodeJS version is too new. Package nodejs-lts is available, but yarn crashes with it. Anyway, it should be possible to build the examples/browser app in a different compatible environment, and then distribute the result as a termux package.

I could successfully clone this repo and execute yarn in Windows Subsystem for Linux (WSL). I could also run yarn run start in examples/browser, and yarn theia build --mode production. I found the former to work as expected. However, the latter seems to expect a backend at localhost:3000. Otherwise, it won't load. Actually, if yarn run start is running and the "production entrypoint" (lib/index.html) is opened in a browser, it works because it seems to reuse the development/nodejs backend.

@akosyakov, is it possible to use the result/artifacts of yarn theia build --mode production (e.g. https://github.com/eine/theia/actions/runs/41001471) without a NodeJS/Electron backend?

@eine Electron is not included for browser target if you follow https://theia-ide.org/docs/composing_applications Node.js is mandatory, Theia does not work without the backend.

Then, I will close this issue, as it seems not possible to run Theia until more recent versions of Node.js are supported.

Node.js is mandatory, Theia does not work without the backend.

Is there any previous discussion about implementing the backend in a different language?

Is there any previous discussion about implementing the backend in a different language?

No there is no such plans. We align with Node.js version as a base line. There is no Electon (https://www.electronjs.org/) supporting Node.js 13.

You can investigate though why Theia does not compile with Node.js 13, if there is a patch which allow to build Theia with any version of >= 10 then it can be a solution.

Is there any previous discussion about implementing the backend in a different language?

No there is no such plans. We align with Node.js version as a base line. There is no Electon (electronjs.org) supporting Node.js 13.

Note that I am not requesting it to be implemented, but asking whether it is feasible. It seems that frontend and backend are properly separated in the codebase, but the API between them is not explicitly documented. If this is the case, documenting the API should suffice for contributors to freely implement alternative backends. Precisely, I'm thinking about using golang, which is compiled to a small standalone executable.

I do understand why you align with Node.js and why you make a difference between it and Electron.js. However, from my point of view, both environments are virtually the same, and both are undesirable as backends for my use cases. It is very fortunate that Node.js works on termux. On most embedded devices, it won't work.

You can investigate though why Theia does not compile with Node.js 13, if there is a patch which allow to build Theia with any version of >= 10 then it can be a solution.

On the one hand, Node.js 10 was supported in termux before. I asked whether it'd be possible to install it. Even with Node.js 10, I fear that other issues might arise. For example, all electron-related dependencies need to be removed from package.json. Otherwise yarn or npm install won't be able to succeed. As a matter of fact, I never expected to be able to build the backend on termux, I was always targeting the frontend as I didn't know that the backend was JS/TS only.

On the other hand, rather than trying to learn Theia's codebase to bring it up to date with Node.js, I'd prefer to try implementing an alternative feature-limited but functional backend which is not written in JS/TS. This is because I am not familiar with Node.js at all.

For example, all electron-related dependencies need to be removed from package.json.

fyi: They are not there by default, only if you include @theia/electron.

On the other hand, rather than trying to learn Theia's codebase to bring it up to date with Node.js, I'd prefer to try implementing an alternative feature-limited but functional backend which is not written in JS/TS. This is because I am not familiar with Node.js at all.

As you mentioned it is possible in the theory, APIs are statically defined in typescript, look for *-protocol.ts files, there are also HTTP endpoints though. But it will really hard to maintain, unless you can derive go types from typescript definitions.

Was this page helpful?
0 / 5 - 0 ratings