Skip to content
Snippets Groups Projects

Holi Translation

The backend for handling translations.

Getting started

Setup

Install deno in version 1.40.1

as well as Velociraptor.

Code style

Linting:

vr lint

Formatting:

vr fmt

Configuration for typescript, linter or formatter can be added in deno.json.

See the deno manual for more tools.

Dependencies

All dependencies should be added in app/deps.ts (similiar as you would do in a Node.js package.json) for caching and integrity checks. After adding a dependency run:

vr updateDeps

to update the deno.lock file (similiar to Node.js package.lock including hashes).

To just install and cache dependencies locally or force a reload of dependencies, run:

vr install

Compiling (optional)

Deno will compile all TypeScript code to JavaScript and cache the resulting files. This will happen automatically when you run the code, but you can also trigger this manually by running

vr cache

Tasks

We use Velociraptor to execute scripts that are defined beneath velociraptor > scripts in deno.json (similiar to scripts defined in Node.js package.json).

You can run

vr

to get a list of all available tasks.

VS Code extension

There is an official VS Code extension for Deno: vscode-deno.

It should already be enabled for the workspace, for more information check the documentation.

JetBrains also offers a plugin for WebStorm and other JetBrains IDEs.

Local execution

To watch for file changes during development, run

vr dev

To execute the application without watching for file changes run

vr start

or run

vr docker

to execute the application in a local docker container.

Afterwards you can access the graphql playground here:

http://localhost:8089/graphql

Continuous Integration and Deployment

Skipping parts of CI

Sometimes, changes don't need to be verified by the full pipeline, e.g. changes in linting or documentation.

noenv Branches

When you prefix your branch name with noenv/ (e.g. noenv/my-readme-update) the pipeline only lints & builds, but does not publish, deploy or run e2e test. This saves quite some time. Obviously, many things go untested so only use this if "you know what you're doing".

Runtime / Deployment

Configuration

To run it locally, use the same Redis environment variables as those used by your local unified-api or okuna.

Environment Variable Default Value Description
PORT 8089 the port to listen on
CACHE_ENABLED true wether or not to enable caching
CACHE_TTL_MS_LIBRE_TRANSLATE 60 seconds time-to-live in ms for libretranslate caching
REDIS_HOST localhost the hostname of the Redis server
REDIS_PORT 6380 the port number of the Redis server
REDIS_PASSWORD - the password for the Redis server
REDIS_DB - the Redis database number to use