/** * @fileoverview Script to update the README with team and sponsors. * Note that this requires eslint/website to be available in the same * directory as the eslint repo. * * node tools/update-readme.js * * @author Nicholas C. Zakas */ "use strict"; //----------------------------------------------------------------------------- // Requirements //----------------------------------------------------------------------------- const fs = require("fs"); const { stripIndents } = require("common-tags"); const ejs = require("ejs"); const got = require("got"); //----------------------------------------------------------------------------- // Data //----------------------------------------------------------------------------- const SPONSORS_URL = "https://raw.githubusercontent.com/eslint/eslint.org/main/src/_data/sponsors.json"; const TEAM_URL = "https://raw.githubusercontent.com/eslint/eslint.org/main/src/_data/team.json"; const README_FILE_PATH = "./README.md"; const readme = fs.readFileSync(README_FILE_PATH, "utf8"); const heights = { gold: 96, silver: 64, bronze: 32 }; //----------------------------------------------------------------------------- // Helpers //----------------------------------------------------------------------------- /** * Fetches the latest sponsors data from the website. * @returns {Object} The sponsors data object. */ async function fetchSponsorsData() { const data = await got(SPONSORS_URL).json(); // remove backers from sponsors list - not shown on readme delete data.backers; return data; } /** * Fetches the latest team data from the website. * @returns {Object} The sponsors data object. */ async function fetchTeamData() { return got(TEAM_URL).json(); } /** * Formats an array of team members for inclusion in the readme. * @param {Array} members The array of members to format. * @returns {string} The HTML for the members list. */ function formatTeamMembers(members) { /* eslint-disable indent -- Allow deeper template substitution indent */ return stripIndents`
![]() ${member.name.trim()} | ${(index + 1) % 9 === 0 ? "