-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathformat-reviewers-markdown.mjs
More file actions
186 lines (168 loc) · 6.16 KB
/
Copy pathformat-reviewers-markdown.mjs
File metadata and controls
186 lines (168 loc) · 6.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
/**
* This script was used to seed the initial data for
* https://github.com/facebook/lexical/pull/8270
* and may be removed later
*/
import fs from 'fs';
import {dirname, join} from 'path';
import {fileURLToPath} from 'url';
/**
* A single team member as stored in team.json
* @typedef {Object} TeamMember
* @property {string} username the GitHub username
* @property {string} name the GitHub display name
*/
/**
* The shape of team.json
* @typedef {Object} TeamData
* @property {Array<TeamMember>} core
* @property {Array<TeamMember>} emeriti
* @property {Array<TeamMember>} distinguished
*/
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// ALL historical reviewers from PR scan (hardcoded - this is the complete list)
// Each entry is {name, username} where name is their GitHub display name
// Names from team.json will override these values if present
// This was generated from the find-all-pr-reviewers.mjs script.
const allHistoricalReviewers = [
{name: 'Achim Weimert', username: 'a-xin'},
{name: 'Abhijit Tomar', username: 'abhijitt'},
{name: 'Acy Watson', username: 'acywatson'},
{name: 'amyworrall', username: 'amyworrall'},
{name: 'bailey-meta', username: 'bailey-meta'},
{name: 'Tong Xi', username: 'btezzxxt'},
{name: 'Daniel Lo Nigro', username: 'Daniel15'},
{name: 'Ebad', username: 'ebads67'},
{name: 'Bob Ippolito', username: 'etrepum'},
{name: 'Maksim Horbachevsky', username: 'fantactuka'},
{name: 'Luis Silva', username: 'Fetz'},
{name: 'freddymeta', username: 'freddymeta'},
{name: 'Max Haubenstock', username: 'haubey'},
{name: 'Ivaylo Pavlov', username: 'ivailop7'},
{name: 'Justin Haaheim', username: 'justinhaaheim'},
{name: 'kraisler', username: 'kraisler'},
{name: 'Yuncheng Lu', username: 'lilshady'},
{name: 'Marc Laval', username: 'marclaval'},
{name: 'Jaime Oyarzún Knittel', username: 'mitoyarzun'},
{name: 'Niels Y.', username: 'nyogi'},
{name: 'Sherry', username: 'potatowagon'},
{name: 'Denys Mikhalenko', username: 'prontiol'},
{name: 'Sahejkm', username: 'Sahejkm'},
{name: 'Shubhanker Srivastava', username: 'Shubhankerism'},
{name: 'Steven Luscher', username: 'steveluscher'},
{name: 'Vlad Fedosov', username: 'StyleT'},
{name: 'Daniel Teo', username: 'takuyakanbr'},
{name: 'John Flockton', username: 'thegreatercurve'},
{name: 'Dominic Gannaway', username: 'trueadm'},
{name: 'Tyler Bainbridge', username: 'tylerjbainbridge'},
{name: 'Yangshun Tay', username: 'yangshun'},
{name: 'Gerard Rovira', username: 'zurfyx'},
];
// Read current team.json to categorize them
const teamDataPath = join(
__dirname,
'../packages/lexical-website/src/data/team.json',
);
const teamData = /** @type {TeamData} */ (
JSON.parse(fs.readFileSync(teamDataPath, 'utf8'))
);
const coreUsernames = teamData.core.map(m => m.username);
const emeritiUsernames = teamData.emeriti.map(m => m.username);
const distinguishedUsernames = teamData.distinguished.map(m => m.username);
// Create a map of username -> display name
// Priority: team.json data, then hardcoded historical data
const usernameToName = new Map();
// First add all hardcoded names
allHistoricalReviewers.forEach(({name, username}) => {
usernameToName.set(username, name);
});
// Then override with team.json data (which is more authoritative)
[...teamData.core, ...teamData.emeriti, ...teamData.distinguished].forEach(
member => {
usernameToName.set(member.username, member.name);
},
);
/**
* Helper function to format a reviewer with name and username
* @param {string} username the GitHub username
* @returns {string} the formatted "Display Name (@username)" string
*/
function formatReviewer(username) {
const displayName = usernameToName.get(username);
return `${displayName} (@${username})`;
}
// Categorize all historical reviewers
const core = allHistoricalReviewers
.filter(r => coreUsernames.includes(r.username))
.sort((a, b) =>
a.username.toLowerCase().localeCompare(b.username.toLowerCase()),
);
const emeriti = allHistoricalReviewers
.filter(r => emeritiUsernames.includes(r.username))
.sort((a, b) =>
a.username.toLowerCase().localeCompare(b.username.toLowerCase()),
);
const distinguished = allHistoricalReviewers
.filter(r => distinguishedUsernames.includes(r.username))
.sort((a, b) =>
a.username.toLowerCase().localeCompare(b.username.toLowerCase()),
);
const notInTeamData = allHistoricalReviewers
.filter(
r =>
!coreUsernames.includes(r.username) &&
!emeritiUsernames.includes(r.username) &&
!distinguishedUsernames.includes(r.username),
)
.sort((a, b) =>
a.username.toLowerCase().localeCompare(b.username.toLowerCase()),
);
console.log('```markdown');
console.log(
`## All Historical PR Reviewers (${allHistoricalReviewers.length} total)`,
);
console.log('');
console.log(`### ✅ Core Team (${core.length})`);
core.forEach(({username}) => {
console.log(`- ${formatReviewer(username)}`);
});
console.log('');
console.log(`### 🎖️ Core Team Emeriti (${emeriti.length})`);
emeriti.forEach(({username}) => {
console.log(`- ${formatReviewer(username)}`);
});
console.log('');
console.log(`### ⭐ Distinguished Contributors (${distinguished.length})`);
distinguished.forEach(({username}) => {
console.log(`- ${formatReviewer(username)}`);
});
console.log('');
console.log(
`### 📜 Historical - Not in Current Team Data (${notInTeamData.length})`,
);
notInTeamData.forEach(({username}) => {
console.log(`- ${formatReviewer(username)}`);
});
console.log('');
console.log('---');
console.log('');
console.log(
`**Summary:** ${allHistoricalReviewers.length} unique people have had PR approval access throughout Lexical's history`,
);
console.log(`- ${core.length} current core team members`);
console.log(`- ${emeriti.length} core team emeriti`);
console.log(
`- ${distinguished.length} distinguished contributors (with >10 contributions)`,
);
console.log(
`- ${notInTeamData.length} historical reviewers (not currently tracked in team data)`,
);
console.log('```');