in eng/scripts/inventory-dashboard/src/csvData.ts [14:33]
export default async function collectCSVData(): Promise<any[]> {
// Retrieve CSV files from latest release dir
const csvFiles = fs.readdirSync(csvDirPath);
// Get CSV contents from all files and convert to JSON
const packagesJSONArr: any[] = []; // Array to contain all CSV contents
for (let csv of csvFiles) {
// Ignore the specs index for now
if (csv === "specs.csv") { continue; }
// Convert csv file to json arr
const jsonContent = await csvToJSON().fromFile(path.join(csvDirPath, csv));
// Add Language property to each pkg object
for (let pkg of jsonContent) {
packagesJSONArr.push({
...pkg,
Language: csvNameToLanguage(csv)
});
}
}
return packagesJSONArr;
}