Skip to content

Commit

Permalink
Change build to autoname latest.json as YYYY-MM-DD.json
Browse files Browse the repository at this point in the history
Closes GH-5.

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
wojtekmaj authored Feb 1, 2024
1 parent 836eac0 commit 7b6086f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ You need a `NPM_TOKEN` environment variable with a token to crawl npm.

[`script/crawl.js`][crawl] analyzes the `package.json` files of `latest`
releases of [high-impact][] npm packages.
After running it, please rename `data/latest.json` to the current date.
This script finishes in about 5 minutes.
You should likely first contribute to `npm-high-impact`, which can take like
24 hours to complete.
Expand Down
8 changes: 7 additions & 1 deletion script/crawl.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ if (!token) {

let slice = 0
const size = 20
const destination = new URL('../data/latest.json', import.meta.url)
const now = new Date()
const destination = new URL(
`../data/${now.getUTCFullYear()}-${
now.getUTCMonth() + 1
}-${now.getUTCDate()}.json`,
import.meta.url
)

/** @type {Record<string, Style>} */
const allResults = {}
Expand Down

0 comments on commit 7b6086f

Please sign in to comment.