browsertrix/frontend
raffaele messuti 70767f0ac2
small fixes on docker swarm deployment (#265)
* fix COPY with multiple files

* Update Deployment.md
2022-06-16 19:56:40 -07:00
..
assets Add License, Logo and README updates for release (#157) 2022-02-23 12:10:46 -08:00
src Re-run crawl from crawls list view (#264) 2022-06-15 18:54:57 -07:00
xliff
.dockerignore Optimizing Frontend Dockerfile (#60) 2021-12-05 18:39:45 -08:00
.gitignore Optimizing Frontend Dockerfile (#60) 2021-12-05 18:39:45 -08:00
00-default-override-resolver-config.sh Local swarm + podman support (#261) 2022-06-14 00:13:49 -07:00
Dockerfile small fixes on docker swarm deployment (#265) 2022-06-16 19:56:40 -07:00
frontend.conf.template nginx simplify: (#259) 2022-06-13 11:53:15 -07:00
lit-localize.json
minio.conf nginx simplify: (#259) 2022-06-13 11:53:15 -07:00
nginx.conf frontend: add nginx.conf to limit worker processes (#226) 2022-05-10 15:11:35 -04:00
package.json Edit crawl config as YAML (#207) 2022-04-06 17:40:25 -07:00
postcss.config.js
README.md Frontend build fixes (#191) 2022-03-10 23:26:21 -08:00
sample.env.local Frontend build fixes (#191) 2022-03-10 23:26:21 -08:00
tailwind.config.js Watch crawl from crawl detail page (#156) 2022-03-02 18:08:08 -08:00
tsconfig.json
web-test-runner.config.mjs
webpack.config.js Define websocket host in common webpack config (#195) 2022-03-15 18:34:49 -07:00
webpack.dev.js Define websocket host in common webpack config (#195) 2022-03-15 18:34:49 -07:00
webpack.prod.js
yarn.lock Edit crawl config as YAML (#207) 2022-04-06 17:40:25 -07:00

Browsertrix Cloud frontend

Quickstart

Install dependencies:

yarn

Copy environment variables from the sample file:

cp sample.env.local .env.local

Update API_BASE_URL in .env.local to point to your dev backend API. For example:

API_BASE_URL=http://dev.example.com/api

Start the dev server:

yarn start

This will open localhost:9870 in a new tab in your default browser.

To develop against a local instance of the backend API, follow instructions for deploying to a local Docker instance. Update API_BASE_URL and then restart the dev server.

Scripts

yarn <name>
start runs app in development server, reloading on file changes
test runs tests in chromium with playwright
build-dev bundles app and outputs it in dist directory
build bundles app, optimized for production, and outputs it to dist
lint find and fix auto-fixable javascript errors
format formats js, html and css files
localize:extract generate XLIFF file to be translated
localize:build output a localized version of strings/templates

Testing

Tests assertions are written in Chai.

To watch for file changes while running tests:

yarn test --watch

To run tests in multiple browsers:

yarn test --browsers chromium firefox webkit

Localization

Wrap text or templates in the msg helper to make them localizable:

// import from @lit/localize:
import { msg } from "@lit/localize";

// later, in the render function:
render() {
  return html`
    <button>
      ${msg("Click me")}
    </button>
  `
}

Entire templates can be wrapped as well:

render() {
  return msg(html`
    <p>Click the button</p>
    <button>Click me</button>
  `)
}

See: https://lit.dev/docs/localization/overview/#message-types

To add new languages:

  1. Add BCP 47 language tag to targetLocales in lit-localize.json
  2. Run yarn localize:extract to generate new .xlf file in /xliff
  3. Provide .xlf file to translation team
  4. Replace .xlf file once translated
  5. Run yarn localize:build bring translation into src

See: https://lit.dev/docs/localization/overview/#extracting-messages