sourcegraph/doc/dev/how-to/test_phabricator.md
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

2.3 KiB

Testing a Phabricator and Gitolite instance

Browser Extension

  1. Verify sourcegraph.enabled is set to true
  2. Point your browser extension to a Sourcegraph instance with the following code host:
    {
      "prefix": "gitolite.sgdev.org/",
      "host": "git@gitolite.sgdev.org",
    }
    
  3. Verify the sourcegraph.callsignMappings are correctly set
  4. Make sure your browser extension has permissions for https://phabricator.sgdev.org (you can check this through the popup)
  5. Navigate to a single file
    • Verify "View on Sourcegraph" button is present and working correctly
    • Verify hovers work as expected
  6. Navigate to a diff
    • Verify "View on Sourcegraph" buttons are present on all change types, and working correctly
    • Verify hovers are working correctly on added, removed, unchanged lines

Native Integration

  1. Run a local Sourcegraph dev instance tunnelled through ngrok
  2. Set corsOrigin to "https://phabricator.sgdev.org" in your site config
  3. Add the following Gitolite code host:
    {
      "prefix": "gitolite.sgdev.org/",
      "host": "git@gitolite.sgdev.org",
    }
    
  4. Verify that the phabricator assets are served:
    • %NGROK_URL%/.assets/extension/scripts/phabricator.bundle.js
    • %NGROK_URL%/.assets/extension/css/main.css
  5. Set sourcegraph.url to your tunnelled ngrok URL
  6. Verify the sourcegraph.callsignMappings are correctly set
  7. Verify sourcegraph.enabled is set to true
  8. Navigate to a single file
    • Verify "View on Sourcegraph" button is present and working correctly
    • Verify hovers work as expected
  9. Navigate to a diff
    • Verify "View on Sourcegraph" buttons are present on all change types, and working correctly
    • Verify hovers are working correctly on added, removed, unchanged lines