Skip to content

evolvedbinary/fusion-studio-extension

Repository files navigation

Fusion Studio Theia Extension

CircleCI Cypress Dashboard npm version License

Fusion DB's extension for Theia IDE. If you don't know what Theia is, then you likely want the full Fusion Studio IDE application.

Getting started:

Requirements:

For building

  • Node 12. >= 12.18.3 (it should most likely be installed with nvm)
    • Node 10 may work, and Node 14 should work... however we are focused on Node 12 compatibility.
  • Yarn. > 1.15.x (it can easily be installed globally via npm (Node Package Manager), but you should be aware this has a small security implication. npm is installed when you install Node).
  • Python >= 3.7.7. (if your system does not provide it, consider using pyenv). If you are having trouble building and have multiple versions of Python installed via pyenv or any other mechanism, see the Debugging Python Build Issues section).
  • Windows platforms only:
    • Microsoft Visual Studio 2015 C++. Tested with Community Edition
  • macOS playforms only:
    • XCode Command Line tools. You can check that these are installed and compatible with node-gyp by following these instructions.

Debugging Python Build Issues

If you are experiencing build issues and have multiple versions of Python installed via pyenv or some other such mechanism then the following information may be useful.

  • Due to upstream constraints from theia we can override the inherited dependency on Python 2. For systems that ship with python2 pre-installed, fusion-studio-extension should continue to build normally.
    • Build errors with node-gyp are unfortunately common on systems with multiple python installations. On systems that no longer include python2, or on macOS >10.14 we recommend using python 3.8, and configuring the build environment. The following assumes you used nvm and pyenv to install your desired versions.
    1. Make sure your system and shell use the correct python environment:
      • python --version
        It should indicate Python 3.8.x or better.
      • Set an environment variable to force node-gyp to use this version, e.g. 3.8.3
        echo 'export NODE_GYP_FORCE_PYTHON="~/.pyenv/versions/3.8.3/bin/python3"' >> ~/.zshrc
        For bash users replace .zshrc with bashrc

Example of setting up a Ubuntu 20.04 build environment

The following commands will install the required packages and setup Python 3 via pyenv on Ubuntu 20.04.

sudo curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install nodejs yarnpkg libx11-dev libxkbfile-dev
alias yarn=yarnpkg

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bashrc

sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
pyenv install 3.8.4
pyenv global 3.8.4
exec $SHELL

Example of setting up a CentOS 7 build environment

The following commands will install the required packages on CentOS 7.

sudo yum update
sudo yum install -y libX11-devel libxkbfile-devel
sudo yum install -y gcc-c++ make
sudo curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
sudo yum install -y nodejs
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install -y yarn
sudo yum install -y rpm-build

For Testing

Install and build:

Clone the repo, and build the source:

$ git clone https://github.com/evolvedbinary/fusion-studio-extension.git
$ cd fusion-studio-extension
$ yarn

You may get the error No package 'x11' found on Ubuntu (Minimal installation), you'll need to install these packages:

sudo apt install libx11-dev libxkbfile-dev

Test the extension

Test on the browser

  • run this after install, and run it right after switching from Electron to the browser:
$ yarn run rebuild:browser
  • Start the IDE:
$ cd browser-app
$ yarn start

Test Electron app

  • run this after install, and run it right after switching from the browser to Electron:
$ yarn run rebuild:electron
  • Start the IDE:
$ cd electron-app
$ yarn start

Integration Testing

To run the integrations tests you need a running database with the fusion-studio-api installed. It should be reachable at localhost:8080 and have an empty admin password. You can then run the integration test GUI locally by using:

yarn run cypress open

or in cases where the above fails to load the cypress test runner, use:

npx cypress open

Integration tests are also run on travis. To see a similar command line style output use:

yarn run cypress run

Developing

  • To compile css:
$ yarn run sass:watch

To watch for files changes:

  • To compile the extension
$ cd fusion-studio-extension
$ yarn watch
  • To compile the browser app
$ cd browser-app
$ yarn watch
  • To compile Electron app
$ cd electron-app
$ yarn watch

Extra

  • You can debug both the browser and Electron apps using VS Code launch configurations:
  • "Start Browser Backend"
  • "Start Electron Backend"
  • You can compile css file at anytime by running:
$ yarn run sass