Skip to content

Commit

Permalink
make semester parameterizable
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew032011 committed Dec 31, 2024
1 parent b75cb45 commit 143bb82
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion backend/scripts/create-member-archive.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import * as fs from 'fs';
import { approvedMemberCollection } from '../src/firebase';

const semester = process.argv[2];

if (!semester) {
// eslint-disable-next-line no-console
console.error('Please provide a semester identifier (e.g., fa24) as an argument');
process.exit(1);
}

approvedMemberCollection.get().then(async (colRef) => {
const members = await Promise.all(colRef.docs.map((doc) => doc.data()));
fs.writeFileSync('src/members-archive/fa24.json', JSON.stringify({ members }, undefined, 2));
fs.writeFileSync(
`src/members-archive/${semester}.json`,
JSON.stringify({ members }, undefined, 2)
);
});

0 comments on commit 143bb82

Please sign in to comment.