searchIndexIsCurrent function

bool searchIndexIsCurrent(
  1. SearchIndexBuild build,
  2. File output
)

Whether output already holds exactly build's JSON.

Meant for a --check flag: run this in CI instead of writing, so a content change that forgot to regenerate the index fails the build rather than silently going stale.

Implementation

bool searchIndexIsCurrent(SearchIndexBuild build, File output) =>
    output.existsSync() && output.readAsStringSync() == build.json;