diff options
author | 2021-11-11 15:59:52 -0800 | |
---|---|---|
committer | 2021-11-11 15:59:52 -0800 | |
commit | 2f46e87fe38cbe35d7203d65956dd9e6707b97f9 (patch) | |
tree | 35d8b7a116b4fa5725b74c6f0b3598218688b974 /scripts/stats/index.js | |
parent | 3d7d63aa8a106b2af0474c74ec3a047c66c9ec7b (diff) | |
download | astro-2f46e87fe38cbe35d7203d65956dd9e6707b97f9.tar.gz astro-2f46e87fe38cbe35d7203d65956dd9e6707b97f9.tar.zst astro-2f46e87fe38cbe35d7203d65956dd9e6707b97f9.zip |
reverse order the stats.csv file (#1802)
Diffstat (limited to 'scripts/stats/index.js')
-rw-r--r-- | scripts/stats/index.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/stats/index.js b/scripts/stats/index.js index 9f1519de8..42a58486d 100644 --- a/scripts/stats/index.js +++ b/scripts/stats/index.js @@ -1,7 +1,7 @@ // @ts-check import { Octokit } from '@octokit/action'; import { execSync } from 'child_process'; -import { appendFileSync, readFileSync, writeFileSync } from 'fs'; +import { readFileSync, writeFileSync } from 'fs'; const octokit = new Octokit(); const owner = 'snowpackjs'; @@ -110,9 +110,12 @@ export async function run() { (await countCards(COLUMN_ID_RFCS_ACCEPTED)).length + (await countCards(COLUMN_ID_RFCS_PRIORITIZED)).length, // Date (ISO) `"${new Date().toISOString()}"`, - ]; + ].join(','); - appendFileSync('scripts/stats/stats.csv', entry.join(',') + '\n'); + const statCsv = readFileSync('scripts/stats/stats.csv', {encoding: 'utf-8'}); + const [statHeader, ...statItems] = statCsv.split('\n'); + const updatedStatCsv = [statHeader, entry, ...statItems].join('\n'); + writeFileSync('scripts/stats/stats.csv', updatedStatCsv); } run(); |