For consuming the ripgrep binary from microsoft/ripgrep-prebuilt in a Node project
Перейти к файлу
Andrea Mah e1773d7264
Merge pull request #57 from microsoft/voluntary-mongoose
bump to 1.15.9
2023-11-21 09:56:23 -08:00
.vscode Rewrite to have no runtime dependencies 2019-07-06 13:01:15 -07:00
build Bump dependencies, prepare 1.15.6 (#51) 2023-10-11 15:57:58 -07:00
lib use yauzl instead of jszip (#56) 2023-11-20 17:41:15 -08:00
.gitignore Prefer existing node_modules, 0.0.20 2017-08-06 20:00:20 -07:00
.npmignore cleanup 2019-07-16 20:17:28 -07:00
LICENSE Add license 2017-03-13 12:02:19 -07:00
README.md Update README.md 2020-06-18 08:47:26 -05:00
SECURITY.md Add SECURITY.md 2021-03-10 12:17:34 -08:00
jsconfig.json Include package version in cache path, force redownload when vscode-ripgrep version changes 2018-10-05 10:40:57 -07:00
package-lock.json use yauzl instead of jszip (#56) 2023-11-20 17:41:15 -08:00
package.json bump to 1.15.9 2023-11-21 09:44:55 -08:00

README.md

vscode-ripgrep

This is an npm module for using ripgrep in a Node project. It's used by VS Code.

How it works

  • Ripgrep is built in microsoft/ripgrep-prebuilt and published to releases for each tag in that repo.
  • In this module's postinstall task, it determines which platform it is being installed on and downloads the correct binary from ripgrep-prebuilt for the platform.
  • The path to the ripgrep binary is exported as rgPath.

Usage example

const { rgPath } = require('vscode-ripgrep');

// child_process.spawn(rgPath, ...)

Dev note

Runtime dependencies are not allowed in this project. This code runs on postinstall, and any dependencies would only be needed for postinstall, but they would have to be declared as dependencies, not devDependencies. Then if they were not cleaned up manually, they would end up being included in any project that uses this. I allow https-proxy-agent as an exception because we already ship that in VS Code, and proxy-from-env because it's very small and much easier to use it than reimplement it.

GitHub API Limit note

You can produce an API key, set the GITHUB_TOKEN environment var to it, and vscode-ripgrep will use it when downloading from GitHub. This increases your API limit.