// Find for and inject list of i18n volunteers in between import fs from 'fs'; const i18nVolunteers = JSON.parse(fs.readFileSync('i18n-volunteers.json')); const readme = fs.readFileSync('README.md', 'utf8'); const i18nVolunteersStart = ''; const i18nVolunteersEnd = ''; const i18nVolunteersList = i18nVolunteers .map((member) => { return `- ${ member.username } (${member.languages.join(', ')})`; }) .join('\n'); const readmeUpdated = readme.replace( new RegExp(`${i18nVolunteersStart}.*${i18nVolunteersEnd}`, 's'), `${i18nVolunteersStart}\n${i18nVolunteersList}\n${i18nVolunteersEnd}`, ); fs.writeFileSync('README.md', readmeUpdated); console.log('Updated README.md');