MCPcopy Index your code
hub / github.com/nodejs/node / moveVotingToRegular

Function moveVotingToRegular

tools/find-inactive-tsc.mjs:107–187  ·  view source on GitHub ↗
(peopleToMove)

Source from the content-addressed store, hash-verified

105}
106
107async function moveVotingToRegular(peopleToMove) {
108 const readmeText = readline.createInterface({
109 input: fs.createReadStream(new URL('../README.md', import.meta.url)),
110 crlfDelay: Infinity,
111 });
112 let fileContents = '';
113 let inTscVotingSection = false;
114 let inTscRegularSection = false;
115 let memberFirstLine = '';
116 const textToMove = [];
117 let moveToInactive = false;
118 for await (const line of readmeText) {
119 // If we've been processing TSC regular members and we reach the end of
120 // the list, print out the remaining entries to be moved because they come
121 // alphabetically after the last item.
122 if (inTscRegularSection && line === '' &&
123 fileContents.endsWith('>\n')) {
124 while (textToMove.length) {
125 fileContents += textToMove.pop();
126 }
127 }
128
129 // If we've found the TSC heading already, stop processing at the
130 // next heading.
131 if (line.startsWith('#')) {
132 inTscVotingSection = false;
133 inTscRegularSection = false;
134 }
135
136 const isTscVoting = inTscVotingSection && line.length;
137 const isTscRegular = inTscRegularSection && line.length;
138
139 if (line === '#### TSC voting members') {
140 inTscVotingSection = true;
141 }
142 if (line === '#### TSC regular members') {
143 inTscRegularSection = true;
144 }
145
146 if (isTscVoting) {
147 if (line.startsWith('* ')) {
148 memberFirstLine = line;
149 const match = line.match(/^\* \[([^\]]+)/);
150 if (match && peopleToMove.includes(match[1])) {
151 moveToInactive = true;
152 }
153 } else if (line.startsWith(' **')) {
154 if (moveToInactive) {
155 textToMove.push(`${memberFirstLine}\n${line}\n`);
156 moveToInactive = false;
157 } else {
158 fileContents += `${memberFirstLine}\n${line}\n`;
159 }
160 } else {
161 fileContents += `${line}\n`;
162 }
163 }
164

Callers 1

Calls 6

popMethod · 0.80
includesMethod · 0.80
matchMethod · 0.65
createReadStreamMethod · 0.45
pushMethod · 0.45
shiftMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…