Skip to content

Move the browser-extensions repo (and others) into this repo

Warren Gifford requested to merge monorepo into master

Created by: chrismwendt

The main reason to move this into one repo is to enable atomic changes across the browser extension, web app, and Sourcegraph extension API.

Here's the new directory structure:

sourcegraph/sourcegraph/
|-- package.json
|-- yarn.lock <--- only 1 yarn.lock
|-- node_modules/
|   |-- sourcegraph -> ../packages/sourcegraph-extension-api (symlink)
|   `-- @sourcegraph/
|       `-- extensions-client-common -> ../../packages/extensions-client-common (symlink)
`-- packages/
    |-- webapp/
    |   |-- package.json
    |   `-- node_modules/
    |-- browser-extensions/
    |   |-- package.json
    |   `-- node_modules/
    |-- extensions-client-common/
    |   |-- package.json
    |   `-- node_modules/
    `-- sourcegraph-extension-api/
        |-- package.json
        `-- node_modules/
  • Each package is in a subdirectory with its own package.json
  • There's 1 yarn.lock
  • This uses yarn workspaces to automatically link all the packages together

Random notes during the migration:

  • Prior art: https://medium.com/trabe/monorepo-setup-with-lerna-and-yarn-workspaces-5d747d7c0e91
  • Tip: yarn workspace <name> expects the package name (e.g. @sourcegraph/extensions-client-common), not the directory name
  • I got errors like "Cannot find name 'Blob'", so I added skipLibCheck to tsconfig.json
  • I got errors like "groupEnd not defined" on Console, so I bumped @types/node to 10
  • Tip: each packages/*/package.json version has to match top level yarn.lock in order for linking to work

TODO before merging

  • Figure out how to get sourcegraph-extension-api's tests to typecheck (they're missing types for string-score)
  • Migrate all CI scripts

TODO later

  • Set up push-to-branch to release the browser extension
  • Automate the release process for sourcegraph-extension-api
  • Move browser extension e2e tests that depend on GitHub into a separate pipeline so that CI doesn't depend on external services
  • Move issues over to this repo
  • Update links in docs, etc.
  • Move extension API docs into sourcegraph/sourcegraph

This PR does not need to update the CHANGELOG because it's a bunch of refactoring.

Merge request reports

Loading