codeintel: Automatically fetch and index LSIF-referenced NPM dependencies
Created by: varungandhi-src
Builds on top of https://github.com/sourcegraph/sourcegraph/pull/28057 and https://github.com/sourcegraph/sourcegraph/pull/22984/ .
TODOs:
-
Add automated tests. -
Figure out where to put the scheme constants. Earlier, I ran into an import cycle error when I did it carelessly. This has some explicit TODOs in the code.
Manual testing steps:
- Start with
sg start enterprise-codeintel
. - Set
npmPackages
to enabled under experimental features under site-admin. - Refresh and add NPM Dependencies as a code host.
- Add
"[email protected]"
under"dependencies"
in the code host settings. -
Turn on auto-indexing and set up a policy. Make sure that repos with URLs matching
npm/*
will be covered. -
npm pack [email protected] tar -xzvf got-12.0.0.tgz cd package git init && git add . && git commit -m "Temp." echo '{"compilerOptions":{"allowJs":true}}' > tsconfig.json npm install --ignore-scripts lsif-tsc -p . # Assuming you've got SRC_ACCESS_TOKEN and SRC_ENDPOINT set up in the environment src lsif upload -repo=npm/got -root=. -commit=bb23d1f0cb5d634d1da32804860810f8f2d5c176
-
got
and its dependencies should be available for search shortly (e.g. try searching forinterface
).