MCPcopy Index your code
hub / github.com/adobe/react-spectrum / main

Function main

scripts/sendWeeklyExcelSheet.mjs:86–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84}
85
86async function main() {
87 let args = parseArgs({allowPositionals: true});
88 let {startDate, endDate} = (() => {
89 if (args.positionals.length === 0) {
90 return getPreviousWeekRange();
91 }
92 if (args.positionals.length < 2) {
93 console.error('Expected two date arguments: <startDate> <endDate>');
94 process.exit(1);
95 }
96 let start = new Date(args.positionals[0]);
97 let end = new Date(args.positionals[1]);
98 if (isNaN(start.getTime()) || isNaN(end.getTime())) {
99 console.error('Please verify that your dates are correctly formatted (YYYY-MM-DD)');
100 process.exit(1);
101 }
102 return {startDate: args.positionals[0], endDate: args.positionals[1]};
103 })();
104 console.log(`Generating testing sheet for ${startDate} – ${endDate}...`);
105
106 let {v3PRs, s2PRs, racPRs, otherPRs, offPRs, counts} = await generateData(startDate, endDate);
107 console.log(
108 `Found: V3=${counts.v3}, S2=${counts.s2}, RAC=${counts.rac}, Other=${counts.other}, Off PRs=${counts.offPRs}`
109 );
110
111 let buffer = await createTestingSheet({v3PRs, s2PRs, racPRs, otherPRs, offPRs});
112
113 let startLabel = formatDateLabel(startDate);
114 let endLabel = formatDateLabel(endDate);
115 let total = counts.v3 + counts.s2 + counts.rac + counts.other;
116 let filename = `${endLabel}.xlsx`;
117 let message = `*Testing sheet for ${startLabel} – ${endLabel}*\nV3: ${counts.v3} | S2: ${counts.s2} | RAC: ${counts.rac} | Other: ${counts.other} | Off PR: ${counts.offPRs} | Total: ${total}`;
118
119 await uploadToSlack(buffer, filename, message);
120 console.log('Posted to Slack successfully.');
121}
122
123main().catch(err => {
124 console.error(err);

Callers 1

Calls 6

generateDataFunction · 0.90
createTestingSheetFunction · 0.90
getPreviousWeekRangeFunction · 0.85
formatDateLabelFunction · 0.85
uploadToSlackFunction · 0.85
parseArgsFunction · 0.70

Tested by

no test coverage detected