summaryrefslogtreecommitdiff
path: root/scripts/stats/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/stats/index.js')
-rw-r--r--scripts/stats/index.js9
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();