This is an npm module for using ripgrep in a Node project. It's used by VS Code.
- Ripgrep is built in microsoft/ripgrep-prebuilt and published as release assets for each tag.
- At publish time, the binaries for every supported platform are downloaded by
build/prepare-binaries.js, verified againstbinaries.lock.json(SHA256), and placed underbin/<target>/rg[.exe]. They ship inside the npm tarball. - At runtime,
lib/index.jsresolvesrgPathfromprocess.platform/process.archto the correctbin/<target>/<binary>. - There is no
postinstallstep and no runtime network access.
const { rgPath } = require('@vscode/ripgrep');
// child_process.spawn(rgPath, ...)- Edit the
VERSION(orMULTI_ARCH_VERSION) constant inlib/platforms.js. - Run
npm run update-lock. This re-downloads every platform's archive and rewritesbinaries.lock.jsonwith the fresh SHA256 hashes. - Commit the updated
lib/platforms.jsandbinaries.lock.json.
npm run prepare-binaries— downloads any missing binaries and verifies them againstbinaries.lock.json. Fails on hash mismatch.npm run prepare-binaries -- --force— forces a clean re-download (still verifies).npm run update-lock— refreshesbinaries.lock.jsonafter a version bump.
Set GITHUB_TOKEN to avoid GitHub's anonymous API rate limit during downloads.