Navigation Menu

Skip to content

Commit

Permalink
Chore: Update README to pull in reviewer data (#11506)
Browse files Browse the repository at this point in the history
* Chore: Update README to pull in reviewer data

* Fix linting errors

* Fix Markdown lint warnings
  • Loading branch information
nzakas authored and ilyavolodin committed Mar 30, 2019
1 parent afe3d25 commit b452f27
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 13 deletions.
17 changes: 11 additions & 6 deletions README.md
Expand Up @@ -193,12 +193,13 @@ According to our policy, any minor update may report more errors than the previo

These folks keep the project moving and are resources for help.

<!-- NOTE: This section is autogenerated. Do not manually edit.-->
<!--teamstart-->

### Technical Steering Committee (TSC)

The people who manage releases, review feature requests, and meet regularly to ensure ESLint is properly maintained.

<!-- NOTE: This section is autogenerated. Do not manually edit.-->
<!--tscstart-->
<table><tbody><tr><td align="center" valign="top" width="11%">
<a href="https://github.com/nzakas">
<img src="https://github.com/nzakas.png?s=75" width="75" height="75"><br />
Expand Down Expand Up @@ -239,14 +240,15 @@ Kai Cataldo
<img src="https://github.com/not-an-aardvark.png?s=75" width="75" height="75"><br />
Teddy Katz
</a>
</td></tr></tbody></table><!--tscend-->
</td></tr></tbody></table>




### Committers

The people who review and fix bugs and help triage issues.

<!-- NOTE: This section is autogenerated. Do not manually edit.-->
<!--committersstart-->
<table><tbody><tr><td align="center" valign="top" width="11%">
<a href="https://github.com/aladdin-add">
<img src="https://github.com/aladdin-add.png?s=75" width="75" height="75"><br />
Expand All @@ -257,7 +259,10 @@ The people who review and fix bugs and help triage issues.
<img src="https://github.com/g-plane.png?s=75" width="75" height="75"><br />
Pig Fang
</a>
</td></tr></tbody></table><!--committersend-->
</td></tr></tbody></table>


<!--teamend-->

## Sponsors

Expand Down
45 changes: 38 additions & 7 deletions tools/update-readme.js
Expand Up @@ -16,6 +16,7 @@
const path = require("path");
const fs = require("fs");
const { stripIndents } = require("common-tags");
const ejs = require("ejs");

//-----------------------------------------------------------------------------
// Data
Expand All @@ -37,28 +38,26 @@ const heights = {
// remove backers from sponsors list - not shown on readme
delete allSponsors.backers;


//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------

/**
* Formats an array of team members for inclusion in the readme.
* @param {Array} members The array of members to format.
* @param {string} label The label for the section of the readme.
* @returns {string} The HTML for the members list.
*/
function formatTeamMembers(members, label) {
function formatTeamMembers(members) {
/* eslint-disable indent*/
return stripIndents`<!--${label}start-->
return stripIndents`
<table><tbody><tr>${
members.map((member, index) => `<td align="center" valign="top" width="11%">
<a href="https://github.com/${member.username}">
<img src="https://github.com/${member.username}.png?s=75" width="75" height="75"><br />
${member.name}
</a>
</td>${(index + 1) % 9 === 0 ? "</tr><tr>" : ""}`).join("")
}</tr></tbody></table><!--${label}end-->`;
}</tr></tbody></table>`;
/* eslint-enable indent*/
}

Expand Down Expand Up @@ -86,10 +85,42 @@ function formatSponsors(sponsors) {
// Main
//-----------------------------------------------------------------------------

const HTML_TEMPLATE = stripIndents`
<!--teamstart-->
### Technical Steering Committee (TSC)
The people who manage releases, review feature requests, and meet regularly to ensure ESLint is properly maintained.
<%- formatTeamMembers(team.tsc) %>
<% if (team.reviewers.length > 0) { %>
### Reviewers
The people who review and implement new features.
<%- formatTeamMembers(team.reviewers) %>
<% } %>
<% if (team.committers.length > 0) { %>
### Committers
The people who review and fix bugs and help triage issues.
<%- formatTeamMembers(team.committers) %>
<% } %>
<!--teamend-->
`;

// replace all of the section
let newReadme = readme.replace(/<!--tscstart-->[\w\W]*?<!--tscend-->/u, formatTeamMembers(team.tsc, "tsc"));
let newReadme = readme.replace(/<!--teamstart-->[\w\W]*?<!--teamend-->/u, ejs.render(HTML_TEMPLATE, {
team,
formatTeamMembers
}));

newReadme = newReadme.replace(/<!--committersstart-->[\w\W]*?<!--committersend-->/u, formatTeamMembers(team.committers, "committers"));
newReadme = newReadme.replace(/<!--sponsorsstart-->[\w\W]*?<!--sponsorsend-->/u, formatSponsors(allSponsors));

// output to the file
Expand Down

0 comments on commit b452f27

Please sign in to comment.