Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Update README to pull in reviewer data #11506

Merged
merged 3 commits into from Mar 30, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 10 additions & 6 deletions README.md
Expand Up @@ -193,12 +193,12 @@ 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 +239,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 +258,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
44 changes: 37 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,41 @@ 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