From 7249933f8376a26b3d5d31dbe9e0040dfc92b84a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 1 Nov 2024 14:18:00 -0700 Subject: [PATCH] add CSV data --- .github/workflows/cacheCycles.yml | 4 ++++ csv.mjs | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 csv.mjs diff --git a/.github/workflows/cacheCycles.yml b/.github/workflows/cacheCycles.yml index 0474f99..28642d2 100644 --- a/.github/workflows/cacheCycles.yml +++ b/.github/workflows/cacheCycles.yml @@ -32,6 +32,10 @@ jobs: - uses: ljharb/actions/node/install@main - run: node cacheCycles.mjs + name: cache EOL data + + - run: node csv.mjs + name: update cached CSV data - run: git checkout data diff --git a/csv.mjs b/csv.mjs new file mode 100644 index 0000000..b838c7f --- /dev/null +++ b/csv.mjs @@ -0,0 +1,16 @@ +import { join } from 'path'; +import { writeFile } from 'fs/promises'; +import data from './out/data.json' with { type: 'json' }; + +const dataRows = Object.entries(data); + +const csv = [ + ['package', 'version', 'released', 'eol'], +].concat(dataRows.flatMap(([p, os]) => os.map(x => ( + [p, x.latest, x.latestReleaseDate, x.eol] +)))); + +const outDir = join(process.cwd(), 'out'); +const outFile = join(outDir, 'data.csv'); + +await writeFile(outFile, csv.join('\n'));