sourcegraph/client/web
Jason Bedard 10aefc4bb7
bazel: add bazel build,tests for client/* (#46193)
Webpack bundles compile but need further testing. Jest + mocha tests
compile but are marked as `manual` until further work is done to get them
passing. The four jest tests are green and enabled now, though.

## Test plan

`bazel build //client/...` and `bazel test //client/...`
2023-02-28 20:46:03 -08:00
..
bookmarklet
dev bazel: add bazel build,tests for client/* (#46193) 2023-02-28 20:46:03 -08:00
scripts web: upgrade prettier to the latest version to support TS satisfies operator (#45400) 2022-12-08 02:37:23 -08:00
src bazel: add bazel build,tests for client/* (#46193) 2023-02-28 20:46:03 -08:00
.bazelignore bazel: ignore files generated into src (#45922) 2022-12-21 20:43:29 -08:00
.eslintignore
.eslintrc.js dx: inject remote js-context into local index.html (#47413) 2023-02-06 19:13:09 -08:00
.stylelintrc.json
babel.config.js
BUILD.bazel bazel: add bazel build,tests for client/* (#46193) 2023-02-28 20:46:03 -08:00
bundlesize.config.js Lazy load the new inlined code intel APIs (#41504) 2022-09-08 12:42:23 +00:00
gulpfile.js web: drop legacy GraphQL schema generator (#45945) 2022-12-25 18:10:20 -08:00
jest.config.js
package.json the enterprise parts of client/web/ are not Apache 2-licensed (#48234) 2023-02-26 05:59:44 +00:00
README.md
statoscope Report bundle size diff in PRs (#42277) 2022-10-12 10:19:51 +02:00
tsconfig.json web: fix pnpm-lock issue (#47478) 2023-02-09 22:04:31 -08:00
webpack.bazel.config.js bazel: add bazel build,tests for client/* (#46193) 2023-02-28 20:46:03 -08:00
webpack.config.js web: remove worker-loader from the web package (#48243) 2023-02-27 03:06:50 -08: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. WEBPACK_SERVE_INDEX should be set to true to enable HTMLWebpackPlugin.
  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

For open-source version:

sg start oss-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

For open-source version:

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

Production server

sg start web-standalone-prod

For open-source version:

sg start oss-web-standalone-prod

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

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.

esbuild (experimental)

See https://docs.sourcegraph.com/dev/background-information/web/build#esbuild.