sourcegraph/client/web
Felix Kling 74b921b335
Fix type imports (#61189)
I ran eslint-nibble on the `client/web/`, `client/branded/`,
`client/shared/` and `client/wildcard/` folders to fix the
`@typescript-eslint/consistent-type-imports` and `@typescript-eslint/no-import-type-side-effects`
warnings.

This makes running `svelte-check` in `clint/web-sveltekit/` more useful
because it doesn't report these as error anymore (it still reports other
issues that need to be dealt with separately).
2024-03-15 13:18:32 +01:00
..
__mocks__ reapply "switch from jest to vitest for faster, simpler tests (#57886)" (#58145) 2023-11-07 12:00:18 +02:00
bookmarklet
dev web: Fix settings editor completion/validation (#60808) 2024-03-11 13:48:31 +01:00
dist svelte: Update messaging and icon for switching to/from the prototype (#60049) 2024-02-02 15:07:40 +01:00
src Fix type imports (#61189) 2024-03-15 13:18:32 +01:00
.bazelignore bazel: ignore files generated into src (#45922) 2022-12-21 20:43:29 -08:00
.eslintignore
.stylelintrc.json
BUILD.bazel web: Remove extensions controller remnants from client/web (#61138) 2024-03-15 10:12:08 +01:00
bundlesize.config.js Revert "use vite for web builds (#58228)" (#59132) 2023-12-20 16:23:45 -03:00
package.json Clean dist directory on build (#60629) 2024-02-20 10:26:52 -08:00
README.md Docs: update links to point to new site (#60381) 2024-02-13 00:23:47 +00:00
statoscope
tsconfig.json Revert "use vite for web builds (#58228)" (#59132) 2023-12-20 16:23:45 -03:00
vitest.config.ts bazel: fix vitest_test in Bazel in sandbox mode (#58274) 2023-11-15 10:14:41 +01:00

Web Application

Local development

Use sg CLI tool to configure and start local development server. For more information check out the sg documentation.

Our local development server runs by starting both a Caddy HTTPS server and a Node HTTP server. We then can reverse proxy requests to the Node server to serve client assets under HTTPS.

Configuration

Environment variables important for the web server:

  1. WEB_BUILDER_SERVE_INDEX should be set to true to enable serving of an index page.
  2. SOURCEGRAPH_API_URL is used as a proxied API url. By default it points to the https://k8s.sgdev.org.

It's possible to overwrite these variables by creating sg.config.overwrite.yaml in the root folder and adjusting the env section of the relevant command.

Development server

sg start web-standalone

Public API

To use a public API that doesn't require authentication for most of the functionality:

SOURCEGRAPH_API_URL=https://sourcegraph.com sg start web-standalone

Production server

sg start web-standalone-prod

Web app should be available at https://${SOURCEGRAPH_HTTPS_DOMAIN}:${SOURCEGRAPH_HTTPS_PORT}. Build artifacts will be served from <rootRepoPath>/client/web/dist.

Note: If you are unable to use the above commands (e.g. you can't install Caddy), you can use sg run web-standalone-http instead. This will start a development server using only Node, and will be available at http://localhost:${SOURCEGRAPH_HTTP_PORT}.

API proxy

In both environments, server proxies API requests to SOURCEGRAPH_API_URL provided as the .env variable.