Commit Graph

105 Commits

Author SHA1 Message Date
Quinn Slack
1fe876e89c
finish removing chromatic (#63966)
We removed Chromatic in
https://github.com/sourcegraph/sourcegraph/pull/62228, but there were
still some remnants.

## Test plan

CI
2024-07-21 18:37:02 -07:00
Michael Bahr
e85028b8bd
fix: update links for dev docs (#62758)
* fix: license checker info is in docs-legacy

* fix: update remaining dev links
2024-05-17 13:47:34 +02:00
Camden Cheek
1ead945267
Docs: update links to point to new site (#60381)
We have a number of docs links in the product that point to the old doc site. 

Method:
- Search the repo for `docs.sourcegraph.com`
- Exclude the `doc/` dir, all test fixtures, and `CHANGELOG.md`
- For each, replace `docs.sourcegraph.com` with `sourcegraph.com/docs`
- Navigate to the resulting URL ensuring it's not a dead link, updating the URL if necessary

Many of the URLs updated are just comments, but since I'm doing a manual audit of each URL anyways, I felt it was worth it to update these while I was at it.
2024-02-13 00:23:47 +00:00
Quinn Slack
4002774429
reapply "switch from jest to vitest for faster, simpler tests (#57886)" (#58145)
* reapply "switch from jest to vitest for faster, simpler tests (https://github.com/sourcegraph/sourcegraph/pull/57886)"

This was reverted in https://github.com/sourcegraph/sourcegraph/pull/58116 due to an issue with the browser tests.

* include fetch-mock

* fix flakiness

* rm mock that did not work in experimentalVmThreads

* fix

* timeout

* fixup

---------

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
2023-11-07 12:00:18 +02:00
William Bezuidenhout
7f4bebe29d
Revert: bazel+vitest - when running vitests concurrently the target //client/browser:test fails (#58116)
When running vitests concurrently the target //client/browser:test fails

Revert "switch from jest to vitest for faster, simpler tests (#57886)"

This reverts commit ae5325e432.
2023-11-06 14:02:35 +02:00
Quinn Slack
ae5325e432
switch from jest to vitest for faster, simpler tests (#57886)
Replaces our usage of jest with vitest. Also removes the babel transpiler. This simplifies our test configuration by a lot, makes tests run 10% faster, and makes further modernizations to our build/test stuff possible (such as using vite for frontend builds).

This removes some of the junit exporting for Buildkite, and the vitest bazel defs don't really cleanly implement bazel testing guidelines (like sharding). But vitest is only used for unit tests (all integration/e2e/regression tests have always run in mocha), so none of them are very slow anyway.

## Codemods for vitest imports

fastmod -e js,ts,tsx @jest/globals vitest client/ dev/release/
fastmod -e js,ts,tsx 'jest\.(\w+)\(' 'vi.$1(' client/ dev/release/
fastmod -e js,ts,tsx 'jest,' 'vi,' client/ dev/release/
fastmod -e js,ts,tsx 'jest }' 'vi }' client/ dev/release/
git diff --diff-filter=M --name-only | xargs pnpm exec prettier --write
2023-11-05 21:57:04 -10:00
Quinn Slack
6bdcd5e59c
simplify tsconfig.json files (#57913) 2023-10-26 03:03:11 -07:00
Quinn Slack
07f29c98d6
use @typescript-eslint projectService for faster eslint (#57851)
See https://github.com/typescript-eslint/typescript-eslint/pull/6754.

Also removes needless `.eslintrc.js` files (now that we can use the root `tsconfig.all.json` for linting and it's still fast enough).

Some of our eslint rules were unintentionally made ineffective in `client/web`, and this commit also re-enables them and in some cases suppresses the eslint warning where a fix is not urgent.
2023-10-24 01:40:40 +00:00
Quinn Slack
59c82bcfb1
disable frontend code coverage tracking (#57820)
Our tracking of frontend (TypeScript) code coverage has decayed and was no longer being used. The Codecov report at https://app.codecov.io/gh/sourcegraph/sourcegraph significantly under-counts coverage, and what coverage tasks we did have were flaky in CI and relied on old libraries that have not been updated recently to keep with modern practices (such as `@storybook/addon-storyshots` only supporting Jest with `injectGlobals`).

From https://sourcegraph.slack.com/archives/C04MYFW01NV/p1698059032863009?thread_ts=1698054092.709309&cid=C04MYFW01NV, the proposal is to remove coverage tracking for now and prioritize getting tests to run really fast and smooth locally first, including upgrading our testing infra, and then reenable code coverage tracking.
2023-10-23 21:29:40 +00:00
Quinn Slack
de613e92b6
use esbuild for client/web builds (#57365)
Use [esbuild](https://esbuild.github.io/) instead of Webpack for builds of `client/web`, for faster builds (dev and prod) and greater dev-prod parity. This PR completely removes all use of Webpack in this repository.

`client/web` is the last build target that still uses Webpack; all others have been recently migrated to esbuild. Most devs here have been using esbuild for local dev of `client/web` for the last 6-12 months anyway. The change here is that now our production builds will be built by esbuild.

All sg commands, integration/e2e tests, etc., continue to work as-is. The bundlesize report will take a while to stabilize because the new build products use different filenames.

## Benchmarks

Running `pnpm run generate && time pnpm -C client/web run task:gulp webBuild` and taking the `time` output from the last command:

- Webpack: 62.5s
- esbuild: 6.7s

Note: This understates esbuild's victory for 2 reasons: (1) because esbuild is building both the main and embed entrypoints, whereas Webpack only builds the main entrypoint in this benchmark) and (2) because a lot of it is in the fixed startup time of `gulp`; esbuild incremental rebuilds during local dev only take ~1s.

## Notes

We no longer use Babel to produce web builds (we use esbuild), so we don't need any Babel plugins that optimize the output or improve browser compatibility. Right now, Babel is only used by Jest (for tests) and by Bazel as an intermediate step.
2023-10-23 10:59:06 -07:00
Quinn Slack
b8d3b53015
remove storybook addon-docs (#57497)
This was not being used. It was there previously, but for some reason the upgrade to Storybook 7 made it more prominent.
2023-10-09 13:24:32 -10:00
Erik Seliger
7568df08fa
chromatic: Fixup project detection and emit TurboSnap metadata with vite (#57494)
This fixes a few project metadata detection issues, makes it easier to run chromatic locally for testing, and potentially fixes TurboSnap with vite.
2023-10-09 22:56:52 +02:00
Quinn Slack
afcdb98b70
Revert "temporarily disable Chromatic upload that is failing on main (#57455)" (#57463)
This reverts commit 4c23391014 and adds a workaround to the Storybook Vite configuration to make it work.
2023-10-09 02:01:48 -10:00
Quinn Slack
af800e527b
use vite instead of webpack for storybooks (#57438)
This reduces the build time for storybooks from ~45s to ~3s.
2023-10-07 14:04:10 -10:00
Quinn Slack
b3ee44f32d
migrate to storybook 7 (#57437)
- storybook-addon-designs was renamed to @storybook/addon-designs
2023-10-07 21:55:42 +00:00
Felix Kling
7363557f41
Eslint fix type imports (#54920)
This PR adds the eslint rules @typescript-eslint/consistent-type-imports and @typescript-eslint/no-import-type-side-effects. Having type imports be explicitly declared as such makes it easier for modern bundlers to strip those imports which is useful if e.g. a module is sent directly to the browser.

I added both rules as a warning because @typescript-eslint/consistent-type-exports is also a warning.
2023-08-10 21:12:31 +02:00
Quinn Slack
006bd2fea3
remove cody code that was moved to separate cody repo (#54729)
Cody code is being moved to https://github.com/sourcegraph/cody. This PR
removes the moved code and configures this repository to use the
`@sourcegraph/cody-{shared,ui}` packages published by the new separate
Cody repository.

## Test plan

Ensure that the new separate Cody repository tests pass. Ensure that
this repository's tests pass now that it uses 2 npm packages published
by the new separate Cody repository.
2023-07-10 00:31:47 -10:00
Greg Magolan
09d898704a
build: update to Aspect CLI 5.5.2 (#53692)
Required adding a few import ignore directives in
`client/web/BUILD.bazel`. @jbedard is working on a fix for those. Has to
do with tsconfig paths. Fix will land in a future release.

## Test plan

5.4.11 output:

```
$ bazel configure
Updating BUILD files for protobuf, go, javascript
WARN[0000] Failed to load base tsconfig file @sourcegraph/tsconfig: open /Users/greg/aspect/sourcegraph/sourcegraph/@sourcegraph/tsconfig: no such file or directory 
client/app-shell/src/app-shell.tsx parse error(s):
50: Top-level await is currently not supported with the "iife" output format
Failed to parse tsconfig file client/completions-review-tool/tsconfig.json: ERR: position:298 object key must be string pos:298 : 
933 BUILD files visited
0 BUILD files updated
```

5.5.2 output has some new spam as well:

```
$ bazel configure
Updating BUILD files for protobuf, go, javascript
WARN[0000] Failed to load base tsconfig file @sourcegraph/tsconfig: open /Users/greg/aspect/sourcegraph/sourcegraph/@sourcegraph/tsconfig: no such file or directory 
Failed to parse tsconfig file client/completions-review-tool/tsconfig.json: ERR: position:298 object key must be string pos:298 : 
client/web/src/globals.d.ts:
	     17: }
         ^

client/web/src/storm/backend/route-loader.ts:
	     41:     usePreloadedQueryData: () => ReturnType<typeof useSuspenseQuery<D, V>>
                                                    ^
	     41:     usePreloadedQueryData: () => ReturnType<typeof useSuspenseQuery<D, V>>
                                                     ^

934 BUILD files visited
0 BUILD files updated
```
2023-06-22 18:33:15 +02:00
Greg Magolan
b398952eca
Revert "revert "bazel: improve ESLint rule" (#52853)" (#52878)
- Revert "revert "bazel: improve ESLint rule" (#52853)"
- bazel: fix eslint custom rule so js_binary runfiles are included as
tool inputs to ctx.actions.run_shell

## Test plan

Tested locally that fix commit resolves the
```
FATAL: aspect_rules_js[js_test]: RUNFILES environment variable is not set
```
flaky issue that prompted the revert
2023-06-04 19:06:39 -07:00
Valery Bugakov
e4b4c631cf
revert "bazel: improve ESLint rule" (#52853)
This reverts commit ff3ce9fe93 because of
the flaky errors on `main`. See [this Slack
thread](https://sourcegraph.slack.com/archives/C02FLQDD3TQ/p1685697360822839?thread_ts=1685696480.396849&cid=C02FLQDD3TQ).
2023-06-02 13:29:06 +00:00
Valery Bugakov
ff3ce9fe93
bazel: improve ESLint rule and disable ESLint outside of Bazel (#52667)
- Custom ESLint Bazel rule now relies on `sh_test`. The build part of
the rule produces the output file with ESLint errors, and the `sh_test`
target verifies that it's empty. If it's not empty, the ESLint test
fails, and the report content is printed to stdout.
- Added additional ESLint targets to `*.js` files in the root of each
client package.
- Added additional ESLint targets for `*.story.tsx` files for client
packages with stories. It's temporary until we start building Storybook
story modules with `ts_project`.
- Disabled ESLint outside of Bazel: **10-12m job is gone!** 🎉

## Test plan

bazel test `bazel query 'attr("name", ".*_eslint$", //client/...)'`
2023-06-02 08:37:40 +00:00
Valery Bugakov
760db946dd
bazel: implement custom ESLint Bazel rule (#52062)
- Upgraded `aspect_bazel_lib`, `aspect_rules_js` and `aspect_rules_ts`
to the latest versions.
- Ran [bazel run
//.aspect/bazelrc:update_aspect_bazelrc_presets](40a7422385)
- Added `eslint_config` macro for client package eslint configuration
`js_library` targets.
- Implemented the custom ESLint rule, which copies `srcs` with
dependencies and **declarations** to the Bazel to lint them. This way,
we maintain the ability to do type-aware linting in Bazel.
- Added a custom ESLint formatter used in Bazel to print out relative
paths in ESLint reports.

In the follow-up PR, I will look into improvements suggested by
@alexeagle that should allow us to convert ESLint build targets into
test targets and gracefully manage linting failures.

## Test plan

1. CI
2. `bazel build $(bazel query 'kind("_eslint_test_with_types",
//client/...)')`
2023-05-22 04:05:45 -07:00
Quinn Slack
838a029b99
add storybooks for easier local dev on vscode UI (#50772)
Running `cd client/cody && pnpm run storybook` will open storybooks for
the VS Code extension. There is a light shim in place to support
rendering the VS Code extension UI with roughly the right theme colors.

### Storybook for `<App />` (VS Code main webview UI)


![image](https://user-images.githubusercontent.com/1976/232655933-1886568f-c305-42d1-91a0-5555768e92f4.png)

![image](https://user-images.githubusercontent.com/1976/232655957-8e27e258-2214-4d81-a900-2b9f76e84f8c.png)


### Storybook for login component showing invalid state


![image](https://user-images.githubusercontent.com/1976/232655884-6632dfc8-859e-4e0e-ad1b-2fa3320154f4.png)


## Test plan

n/a; dev only

---------

Co-authored-by: Naman Kumar <naman@outlook.in>
2023-04-18 19:49:44 -07:00
Quinn Slack
476ca9e63d
cody-ui chat refactors (#50682)
No behavior change.

- extract cody-ui ChatMessages and add storybook
- split apart cody-ui ChatMessages component
- remove duplicate cody vscode CSS vars
2023-04-15 20:10:15 +00:00
Tom Ross
d2cb50405d
Better import ordering with prettier (#48188) 2023-03-13 08:37:23 +00:00
Dominic Cooney
91baccdcc6
Merge the history from the Cody repository (#48800)
This was generated with:

```
git remote add cody git@github.com:sourcegraph/cody.git
git subtree add --prefix=client/cody cody master
```

The Cody repository contains prototype frontends which are now defunct
and will be replaced with calls to #48248. The client/cody directory
will focus on the Cody VSCode extension, and over time Cody will be
integrated into other clients.

## Test plan

See client/cody/README.md for how to run the tests.

## App preview:

- [Web](https://sg-web-dpc-merge-cody.onrender.com/search)

Check out the [client app preview
documentation](https://docs.sourcegraph.com/dev/how-to/client_pr_previews)
to learn more.

---------

Co-authored-by: Beyang Liu <beyang@sourcegraph.com>
Co-authored-by: Rok Novosel <novosel.rok@gmail.com>
Co-authored-by: Rok Novosel <rok@sourcegraph.com>
Co-authored-by: Beatrix <beatrix@sourcegraph.com>
Co-authored-by: Quinn Slack <qslack@qslack.com>
Co-authored-by: Quinn Slack <quinn@slack.org>
Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
Co-authored-by: Beatrix <68532117+abeatrix@users.noreply.github.com>
2023-03-13 16:25:37 +09:00
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
Valery Bugakov
ce38bbc724
web: fix pnpm-lock issue (#47478)
Fixes the issue caused by the presence of the `sourcegraph: ''` entry in the `pnpm-lock.yaml`. If we install any new dependency, the `pnpm install` command fails on CI. [Failure example](https://github.com/sourcegraph/sourcegraph/actions/runs/4121774771/jobs/7117792725).
2023-02-09 22:04:31 -08:00
Jason Bedard
7efb0d9727
build: add sass bazel build (#47139) 2023-02-02 19:14:25 -08:00
Valery Bugakov
3512fb9aa2
web: sync TS project refenreces (#46407) 2023-01-16 18:55:10 -08:00
Valery Bugakov
304acdb5da
web: migrate from yarn to pnpm (#46143)
Bazel's rules_js rely on the pnpm package manager. To simplify the integration, we're migrating to pnpm from our current package manager — yarn. Another reason to migrate is that pnpm is cool and fast. 😉
2023-01-11 19:50:09 -08:00
GitStart-SourceGraph
2729f21766
[SG-46115] - Merge the search-ui package into the branded package (#46197)
* chore: merge search-ui package into branded package
2023-01-11 18:27:19 +01:00
Valery Bugakov
b10c94b717
web: eliminate storybook & wildcard circle (#45976) 2023-01-04 18:39:15 -08:00
Juliana Peña
28e8c7679b
notebooks: remove elm compute component (#45360)
* notebooks: remove elm compute component

* fix update

* fix go build

* fix go tests

* update changelog

* remove elm-stuff
2022-12-07 12:59:05 -08:00
GitStart-SourceGraph
51befbfa52
[SG-39797] Enable no-console ESLint rule (#40458) 2022-10-03 07:19:17 -07:00
Rok Novosel
d66dbbc0e4
Remove core workflow improvements flag (#41986) 2022-09-27 07:26:12 +02:00
Juliana Peña
e84daee944
search ui: permanently enable simple ui (but keep temp setting) (#41021)
* changes

* update changelog

* fix unit tests

* fix ts build

* rename temp setting so users that have turned it off get the new UI

* fix broken merge

* remove unneeded stories and add stories for new UI

* fix test
2022-09-02 15:53:01 -07:00
GitStart-SourceGraph
b283d24198
[SG-39284] Upgrade yarn to the latest version (#39728) 2022-08-31 20:39:53 -07:00
Petri-Johan Last
c80ec5787f
Remove last storybook/addon-knobs reference (#40498)
* Remove last storybook/addon-knobs reference

* Fix issue with infinite recursion in story

* Remove failing snapshot

Co-authored-by: Laura Hacker <laura.hacker@sourcegraph.com>
2022-08-17 21:14:19 +02:00
Lauren Melendez
0568790ed2
Storybook Knobs to Control Migration (#39720)
* Start of Knobs to Control Migration

* last migration of the remaining knobs

* small fix

* testing fixes

* fixed comments containing knobs

* merge conflict resolution

* yarn duplicate fix

* possible merge conflict fix

* fix

* Update yarn.lock

* batch change preview page fix

* removal of additional knobs

* removing knobs addon

* fix ui visual changes

* fix ui visual changes with additional fix

* visual changes fix update

* BatchChangeDetailsPage visual change fix

* BatchChangeDetailsPage visual change fix update

* Update client/web/src/batches/RepoBatchChangesButton.story.tsx

Co-authored-by: Laura Hacker <laura.hacker@sourcegraph.com>

* Update client/web/src/components/ActivationDropdown/ActivationDropdown.story.tsx

Co-authored-by: Laura Hacker <laura.hacker@sourcegraph.com>

* Update client/web/src/enterprise/batches/batch-spec/edit/workspaces-preview/ImportingChangesetsPreviewList.story.tsx

Co-authored-by: Laura Hacker <laura.hacker@sourcegraph.com>

* Update client/web/src/components/diff/DiffStat.story.tsx

Co-authored-by: Laura Hacker <laura.hacker@sourcegraph.com>

* Update client/web/src/components/ActivationDropdown/ActivationDropdown.story.tsx

Co-authored-by: Laura Hacker <laura.hacker@sourcegraph.com>

* code review updates

* continued code review updates

* format fix

* buildkite fix

* Additional minor updates

Co-authored-by: Tom Ross <tom@umpox.com>
Co-authored-by: Laura Hacker <laura.hacker@sourcegraph.com>
2022-08-17 10:52:15 -04:00
David Veszelovszki
167b585f58
JetBrains: Add storybook for Chromatic tests (#38639)
* Add storybook for JetBrains, and hook it up
* Add custom webpack settings for JetBrains
* Bug fix: add missing commit from path matches
* Fix initial search in standalone version
* Order scripts alphabetically
* Extract callJava
2022-07-15 12:45:58 +02:00
Lauren Melendez
81d211eb32
Storybook Storysource addon implementation (#38502)
* implemented storysource addon and docs addon

* format fix

* removed props for UI bug

* props error fix

* added comment for context

* added comment for context
2022-07-12 18:17:48 -04:00
Valery Bugakov
33a4527404
web: enable storyStoreV7 in Storybook (#38199) 2022-07-06 19:36:29 -07:00
Chris Wendt
20f937d00b
Update jsonc-parser (#37050) 2022-07-01 10:59:43 -06:00
Valery Bugakov
4a09ea0f27
web: upgrade Storybook (#36437) 2022-06-06 20:30:11 -07:00
GitStart-SourceGraph
00039658b5
Upgrade to the latest version of ESLint (#35111)
Co-authored-by: gitstart-sourcegraph <gitstart@users.noreply.github.com>
Co-authored-by: Valery Bugakov <skymk1@gmail.com>
2022-05-31 07:08:01 +01:00
Juliana Peña
ec4e74fcaa
Move compute Elm component to more generic location (#35908)
Move compute block to more generic location
2022-05-25 10:08:46 -07:00
GitStart-SourceGraph
9adaf3702e
Codedmod migration to implicit children (#34882)
Co-authored-by: gitstart-sourcegraph <gitstart@users.noreply.github.com>
2022-05-05 07:39:18 +01:00
GitStart-SourceGraph
44082f5b73
[SG-33302] Upgrade all client packages to use the latest version of the JSX transform (#34287)
Co-authored-by: gitstart-sourcegraph <gitstart@users.noreply.github.com>
2022-04-22 12:25:38 +01:00
Valery Bugakov
f3a11939af
web: review environment variables before the Datadog integration (#33994) 2022-04-19 02:22:48 -07:00