Skip to content

Commit 18bf48d

Browse files
committed
Write to CSV as well
1 parent 8fc95a4 commit 18bf48d

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

build-filtered-data.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { writeFileSync } from 'fs'
2+
import { json2csv } from 'json-2-csv'
23

34
import { Octokit, RequestError } from 'octokit'
45
import { throttling } from '@octokit/plugin-throttling'
@@ -249,10 +250,14 @@ async function filterDeps() {
249250

250251
const currentDate = new Date().toISOString().split('T')[0]
251252

253+
// Write JSON file
252254
await writeFileSync(
253-
`data/${currentDate}-filtered-data.json`,
255+
`data/json/${currentDate}-filtered-data.json`,
254256
JSON.stringify(builtData, null, 2)
255257
)
258+
// Write CSV file
259+
const csv = json2csv(builtData)
260+
await writeFileSync(`data/csv/${currentDate}-filtered-data.csv`, csv)
256261
console.log('Data updated')
257262

258263
const index = rawDeps.all_public_dependent_repos.findIndex(

package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,8 @@
2424
"eslint": "^9.17.0",
2525
"globals": "^15.13.0",
2626
"octokit": "^4.0.2"
27+
},
28+
"dependencies": {
29+
"json-2-csv": "^5.5.7"
2730
}
2831
}

0 commit comments

Comments
 (0)