Skip to content

ProjectLighthouseCAU/luna

Repository files navigation

LUNA (Lighthouse Unified Net Application)

Build

The unified web frontend for Project Lighthouse.

Getting Started

To get started developing, make sure to have Node.js and npm available and install the dependencies by running

npm install

To run the CORS proxy against the staging API, run

npm run cors-proxy:staging

To start the development server, run

npm start

Tip

You can override the several configuration variables by prefixing the command e.g. with

PORT=...                       # The port to run the dev server on
REACT_APP_AUTH_TYPE=...        # The authentication type
REACT_APP_AUTH_SERVER_URL=...  # The authentication server
REACT_APP_MODEL_SERVER_URL=... # The model server (ws:// or wss://)

If you want to persist the configuration, create a .env.local file with your desired configuration. For more details, see this post.

To build the project for deployment, run

npm run build

Important

The environment variables will be baked into the build, so make sure not to include any sensitive data.

Editors

If you use VSCode, you may wish to install the ESLint extension. Additionally, it can be very convenient to automatically format on save. To do so, add

{
  "eslint.format.enable": true,
  "[typescript][typescriptreact][javascript]": {
    "editor.codeActionsOnSave": {
      "source.fixAll.eslint": "explicit"
    },
    "typescript.preferences.importModuleSpecifier": "non-relative"
  }
}

to your user or workspace settings (under .vscode/settings.json).

Debugging

To debug LUNA with VSCode and Firefox, install the Firefox debugger extension and add the following configuration to your .vscode/launch.json:

{
  "type": "firefox",
  "request": "attach",
  "name": "Attach Firefox",
  "webRoot": "${workspaceFolder}/src",
  "url": "http://localhost:4000"
}

Now go to about:config in Firefox and set devtools.debugger.remote-enabled and devtools.chrome.enabled to true.

For a more extensive description of these flags, see the extension's README.

Finally, launch Firefox with the -start-debugger-server argument, make sure that the dev server is running (if not, launch it with npm start) and start the debug session.