Commit Graph

57 Commits

Author SHA1 Message Date
Quinn Slack
dc478c82dd
chore(ci): remove Percy visual tests (#63515)
These are more frequently erroneous than helpful.

See
https://sourcegraph.slack.com/archives/C04MYFW01NV/p1719209633005499.

This eliminates a source of frustration and flakiness in pull requests
and removes a lot of code and Bazel complexity.

If we want to revive them, we can revert this commit. Note that
`client/web-sveltekit` does not use Percy, and if we want it to, we can
always revert this commit or start over from scratch if that's easier.


<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->

## Test plan

CI

Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>
2024-06-27 16:20:06 +02:00
Noah S-C
ec40e72e63
bazel: fetch code-intel-extensions bundle as bazel repository (#59708)
Reimplement fetching & building code-intel-extension bundle as a bazel `http_archive` repository & refactored `js_run_binary`. This should allow the extensions bundle to be cached in the repository cache, instead of being affected by changing action environments

## Test plan

`bazel build //client/browser:code-intel-extensions` and `cd client/browser && pnpm run create-source-zip` run without error
2024-01-25 04:50:54 -08:00
Camden Cheek
55fdf1b105
Browser extension: disable inline extensions firefox (#57881)
This disables the bundling of code intel extensions with the firefox browser extension. The bundled files are minified, and I failed to run the build steps for the extensions locally (they're pretty out of date), so I can't really test the changes needed to build a non-minified version.

For now, rather than spending more time on extensions that live in a hazy state of support, this just removes the extensions from the firefox addon so we don't get removed from the store.
2023-10-26 00:43:45 +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
fb3c9c6015
use esbuild for browser extension builds (#57231)
* move bext-only extension host worker to client/browser

* use esbuild for browser extension build

esbuild is much faster and simpler than Webpack.
2023-10-08 14:18:52 +09:00
Quinn Slack
6456733516
clean up browser extension webpack build (#57229)
* use single-file entrypoints for browser ext webpack config

This is more standard and puts more of the config in code not config. This also makes it easier to support esbuild builds for the browser extension (esbuild does not support multiple sources for an entrypoint, because such behavior is undefined except by webpack, and who knows what it does).

* use different file basenames for native & phabricator integrations

This makes it easier (in the future) to simplify our bundler config for the browser extension because some bundlers (esbuild via Bazel, for example) do not support 2 entrypoints with the same file basename.

* name entrypoint bundles after their entrypoint, not a custom name

This removes another source of "names" and also makes it so that the browser extension can be built by esbuild via Bazel in the future (which does not support renaming entrypoints).

Also remove Webpack auto-reloading because its implementation depended on this. There is a workaround, but the intent is to remove Webpack for bext builds, so it's not worth keeping it.
2023-10-02 10:43:40 -07: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
Valery Bugakov
59ce236cca
bazel: Bazel build browser extension + code-intel-extensions (#51135)
1. Adds `//client/browser:bundle` for the browser extension build.
2. Adds `//client/browser:code-intel-extensions` for the inlined code
extension logic.
3. Adds `//client/browser:integration-assets` for the browser extension
integration assets which should be added to each sourcegraph image.
4. Adds `client/browser/config/webpack/base.config.bazel.ts` in the same
way we do it for the web application — duplicated webpack config
specifically for Bazel with the idea to delete non-Bazel one later.
5. Restructures browser extension `config` folder to make it
Bazel-friendly.
6. Instead of
[sourcegraph-extension-bundles-revision.txt](https://github.com/sourcegraph/sourcegraph/pull/51135/files#diff-eed06bee70ccc222acfa612bdcd09a2417f01072da91b3de1a76611b2ef44d53)
we now use function arguments for revision numbers.
7. Adds browser integration assets target to UI assets.

## Test plan

1. CI
2. `bazel build //client/browser:bundle`
3. `bazel build //client/browser:integration-asssets`
4. `bazel build //ui/assets/oss:copy_bundle`
5. `bazel build //ui/assets/enterprise:copy_bundle`
2023-05-02 03:33:52 -07:00
Taras Yemets
ef692b42cd
bext: include code-intel extensions to native integration bundle (#49396) 2023-03-15 18:45:02 +02: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
Philipp Spiess
a2ca304f3b
Remove gsutil copying during Firefox publishing (#44804) 2022-11-25 10:29:34 +01:00
Philipp Spiess
0e68f416b7
Manually trap web-ext return code to avoid throwing when uploading to the Mozilla store (#44380) 2022-11-15 10:48:37 +01:00
Beatrix
5ecd2af1be
Browser extension: add Microsoft Edge build (#43573) 2022-10-28 08:18:37 -07:00
GitStart-SourceGraph
27cb498e0d
[SG-42488] Upgrade socket.io to fix the security vulnerability (#42916)
* chore: upgrade socket.io to fix the security vulnerability
2022-10-14 08:41:28 +01:00
Philipp Spiess
e0cd3c89f0
Bundle legacy code intel extension for native integrations (#42106)
Part of #41921

We have a deployment method of the browser extensions that we call
"native integrations". The idea here is that we inject the browser
extension code directly from the code host so that users do not need to
install an extension. Most prominently, this is used by GitLab who
currently bundles a version of the native integrations package with
their on-premise builds so instance admins can enable this for users.

The issue with this deployment model is that we have no impact on when
these clients are updated. We rely on GitLabs rollout and update
policies so these cycles are super slow. For the upcoming release, we
had to cut a corner for this and made the extensions GraphQL endpoints
handle eventual native integration requests with special care to not
break them. 

Since we eventually want to remove these APIs, we want to move fast here
and provide a new native integration build that does not use these APIs
anymore. Before we can update the bundled version on the GitLab end, we
need to make sure that the package contains a bundled version of the
code intel APIs (similar to our browser extensions right now). This is
what's happening here:

- This PR adds bundles the legacy code intel APIs to the
  `@sourcegraph/code-host-integration` package.
- It also changes the gating of the inlined extensions so that they are
  loaded on GitLab.

Co-authored-by: Taras Yemets <yemets.taras@gmail.com>
2022-09-27 12:24:48 +02:00
Taras Yemets
d42ca16c02
Disable flaky e2e test and restore reverted PRs (#41847) 2022-09-21 14:39:26 +02:00
Jean-Hadrien Chabran
ddb8a43d72
Revert "bext: fix firefox release script (#41655)" (#41842) 2022-09-21 11:52:36 +02:00
Taras Yemets
5735d49c3b
bext: fix firefox release script (#41655) 2022-09-21 11:37:06 +03:00
GitStart-SourceGraph
b283d24198
[SG-39284] Upgrade yarn to the latest version (#39728) 2022-08-31 20:39:53 -07:00
Taras Yemets
bfad2ed26f
bext: load extensions based on the enableLegacyExtensions experimental feature (#40258) 2022-08-22 17:16:46 +03:00
Taras Yemets
897cc20445
Refactor code-intel extensions bundling for VSCE and browser extension (#40017) 2022-08-09 12:18:57 +03:00
Tom Ross
ba62261f2c
Integration tests: Suppress Chromium install log (and other Percy noise that isn't errors) (#34343) 2022-04-22 11:46:19 +01:00
Taras Yemets
b294788fea
bext: record integration in the nightly pipeline (#33893) 2022-04-18 13:25:13 +03:00
Taras Yemets
dab3ed4915
bext: refactor integration tests (#33598) 2022-04-13 11:03:08 +03:00
Taras Yemets
32969882ec
bext: refactor to use yarn workspaces in commands (#33700) 2022-04-12 10:13:18 +03:00
Erzhan Torokulov
92ce6f7ed6
Fix native integration to pass cookies/credentials for "Extensions" info graphql request (#33406) 2022-04-07 17:39:26 +06:00
Taras Yemets
0e71b5ef02
bext: cover 'Search on Sourcegraph' buttons on GitHub search pages with integration tests (#31572)
* Add GitHub search pages enhancements integration tests

* Configure git-lfs for *.har files (#31624)
2022-03-08 14:50:25 +02:00
Taras Yemets
be5917aa79
bext: automate refetching of code intel extensions (#31471)
Co-authored-by: Erzhan Torokulov <erzhan.torokulov@gmail.com>
2022-02-18 11:46:02 +02:00
Taras Yemets
246b18541a
Revert "Revert "bext: make 'single click to definition' an advanced setting (#30540)" (#30912)" (#30958)
This reverts commit 89e2ceb703.
2022-02-10 13:52:16 +00:00
Taras Yemets
89e2ceb703
Revert "bext: make 'single click to definition' an advanced setting (#30540)" (#30912)
This reverts commit f616428454.
2022-02-09 21:29:20 +02:00
Taras Yemets
f616428454
bext: make 'single click to definition' an advanced setting (#30540)
* Make bext 'click to defition' an adcanced setting

Co-authored-by: Erzhan Torokulov <erzhan.torokulov@gmail.com>

* Fix types

* bext: Edit setting label

* Fix "sg test bext-integration" command

* Fix "shows hover tooltips when hovering a token" to hover on correct token

Co-authored-by: Taras Yemets <yemets.taras@gmail.com>

* Update bext recordings

* WIP

Co-authored-by: Taras Yemets <yemets.taras@gmail.com>

* WIP

* WIP: Add click-go-def test

Co-authored-by: Taras Yemets <yemets.taras@gmail.com>

* refactor test

* refactor mock extensions logic

* reduce wait for redirect timeout

* Update changelog

* Enable all tests

* Refactor integrtion tests

* Fix comment

* Update bext integration build process to be deterministic

Co-authored-by: Taras Yemets <yemets.taras@gmail.com>

* Fix code style

* Update changelog

* Rename variable

* Remove redundant mock

* Remove unused fixtures

Co-authored-by: Erzhan Torokulov <erzhan.torokulov@gmail.com>
2022-02-09 20:03:49 +02:00
Chris Wendt
8e14a3a40d
tests: Default to Polly.js passthrough rather than record (#29087) 2021-12-15 23:08:18 -07:00
Erzhan Torokulov
54584a583d
Fix browser extension excessive "all websites" permissions for Safari (#26832)
* Refactor build script
* Remove manifest.content_scripts in regards to run-time/dynamic injection
* Update client/browser/CHANGELOG.md
* Rename package.json script "release:ff" to "release:firefox"
2021-11-11 09:40:28 +00:00
Valery Bugakov
be9aafd3aa
web: include CSS modules assets into the browser extension (#25727) 2021-10-08 16:27:26 +08:00
TJ Kandala
05e167e884
extensibility: create integration test harness for browser extension (#23235)
Recently, the end-to-end tests have been failing due to variability in GraphQL API responses. This motivated us to create a more controlled testing environment for the browser extension relative to end-to-end tests, but that still run in a browser against real code hosts, unlike our unit test suite.

The integration tests introduced in this PR validate that Sourcegraph commits don't break the browser extension ahead of time, not 0-24 hours after a regression is introduced. Since these tests are run against (Polly.JS) recordings of code hosts and use mock data for our backend, they complete fast enough to not require nightly tests.
2021-08-04 09:28:47 -04:00
Valery Bugakov
e31288f052
Attempt #3: upgrade to Webpack v5 (#22580)
- web: upgrade `Webpack` to v5 for the web app
- web: upgrade `Webpack` to v5 for Storybook
- web: upgrade `Webpack` to v5 for the browser extension
- web: enable filesystem cache only in the development environment
- web: disable node.js polyfills
- web: disable `webpack.IgnorePlugin` for the web app
- web: switch to `react-refresh-webpack-plugin` from `react-hot-loader`
- web: use `cache` only in development mode
- web: remove redundant polyfill dependencies
- web: do not use `Webpack` cache on CI
- web: use runtime bundle in development mode by `frontend` server
2021-07-19 16:08:50 +08:00
Murat Sutunc
e71453ed71
firefox extension scripts (#20289) 2021-04-23 19:22:43 +00:00
Valery Bugakov
d3af5d54db
web: enable import/order ESLint rule (#19806)
* web: enabled import/order ESLint rule

* web: auto fix import/order ESLint rule

* web: revert tsconfig.json change

* web: auto fix import/order rule

* web: auto fix import/order rule

* web: auto fix import/order rule
2021-04-10 14:58:33 +08:00
Marek
553a0cc93c
Fix the create-source-zip script (#19241) 2021-03-30 13:22:35 -04:00
Tom Ross
9c4e472679
Remove default exports (#17565) 2021-01-25 10:45:34 +00:00
Marek
a037b4a352
Update build steps for Safari browser extension and shorten description field (#16610) 2020-12-15 07:39:09 -05:00
Marek
5be6dd884e
Add safari support and build steps (#15999) 2020-12-09 15:26:03 -05:00
renovate[bot]
9f34563c12
Update dependency @sourcegraph/eslint-config to ^0.20.9 (#14602)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Felix Becker <felix.b@outlook.com>
2020-10-12 23:27:42 +02:00
Felix Becker
cf65dec202
Add after install page to browser extension (#14407) 2020-10-09 18:57:22 +02:00
Felix Becker
45f9839011
Move all client code into client/ folder (#14480) 2020-10-07 22:23:53 +02:00
Felix Becker
cc5de96d4b
mv client/browser browser (#3826)
* mv client/browser browser

* Fix paths

* tslint --fix

* Add back .bin symlink

* Relative path for symlink
2019-05-06 19:36:03 +02:00
Felix Becker
d6a6bdccbf
Use modern browser API (#3606)
* Use browser API

* Renames

* Polyfill globalThis in Jest

* Don't use dynamic import

* More type safe storage access

* Prettier webpack log

* Don't use NonNullable

* Remove unused background page handlers

* Replace sourcegraph.com string literals with constant

* Use BackgroundMessageHandlers interface in client too
2019-05-03 23:20:47 +02:00
Quinn Slack
a88871c5df
support TARGETS=chrome or TARGETS=firefox for faster bext builds (#3390)
When developing for just a single browser (eg Chrome), this makes rebuilds of the bext slightly faster.
2019-04-16 02:13:28 -07:00
Felix Becker
cb8813fc0f
Fix sourcemaps for browser extension (#2767) 2019-03-18 13:10:24 -07:00
Loic Guychard
077319232d
Stricter tsconfig for the browser extension (#2411)
* Stricter tsconfig for the browsr extension

* Refactor getPhabricatorState() to async function

This was the best way to fix the many noImplicitReturns violations in this function.

* Fix Alerts.tsx

* Update client/browser/src/shared/repo/backend.tsx

Co-Authored-By: lguychard <l.guychard@gmail.com>

* `| null` -> `| undefined`

* Add return type
2019-02-25 19:48:03 +01:00