Make popularities.json dynamic instead of checked into git #4286
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of #4217
The idea is that we drive the popularities from
/popularities.json
instead. Reading it is always done via thegetPopularities()
function and it now hardcodes the location of the file.If you're doing local development in
yari
withyarn dev
you get:which makes consecutive runs of
yarn dev
fast.Then, when it bundles up yari as an NPM package, you're going to get a tarball that, at its root, contains a
popularities.json
which got created (every time) from the.github/workflows/npm-publish.yml
. So when you run yari from within themdn/content
repo, you will find anode_modules/@mdn/yari/popularities.json
which thenode_modules/@mdn/yari/content/popularities.js
can always reach.This way, every new npm package will have a fresh
popularities.json
from S3. So writers, who use the autocomplete search on localhost:5000 will get the latest and greatest (or at least as fresh as the Athena job runs). And theiryarn start
will still be fast and not need to download from S3.The reason this PR is only
Part of #4217
is because once shipped to NPM we need to go intomdn/content
and rungit rm files/popularities.json
.