Skip to content

Conversation

@rschristian
Copy link
Member

@rschristian rschristian commented Jan 15, 2021

This list hasn't been update in about a year and a half or so, since it was first created. I think it's due for an update, as quite a few new names have helped out since then.

Edit: Though now that I look a bit more closely, there's a couple names from the old list that aren't in the new. Is there another list that should be appended in? Not sure how that should be handled.

@developit
Copy link
Member

developit commented Jan 15, 2021

I'm guessing this is because of paging? I wonder if there's a way to pull the full list from all repos under the preactjs org. Maybe through the GraphQL API...

@rschristian
Copy link
Member Author

rschristian commented Jan 15, 2021

Edit: Didn't realize GH capped the list to 100 contributors arbitrarily. Makes sense.

Not sure. The landing page (I guess you'd call it) for the repo shows 263 contributors, but the actual contributors link is 100. I think it'll do that for contributions that aren't linked to an account, but that's still a pretty big difference.

The names I noticed that were different (though there might be others) are kristopherbaxter and reznord, right at the end of the old list. As they're not on the repo's contributors page, and as they're at the end of the list, I'm guessing they were manually added? Not sure.

Will go get the full list of people.

@rschristian rschristian marked this pull request as draft January 15, 2021 02:00
@developit
Copy link
Member

Running this in a JS console should return a deduped list of names for all org repos, but it hits GitHub's rate limit (or at least it did for me after running it twice):

https://gist.github.com/developit/d8c53ec368d56ca113b191dd5a3642b4

@rschristian
Copy link
Member Author

So there's a tad few more names now....

This PR brought the list from 32 to 565!

@rschristian rschristian marked this pull request as ready for review January 15, 2021 03:42
@developit
Copy link
Member

now that I think of it, we should inject these at build time to avoid putting all the names in the client-side JS. I can try to come up with a hacky solution...

@rschristian
Copy link
Member Author

That did dawn on me once I saw the number of names.

Could set up some tiny API too to return a random name. The footer is a pretty safe place to have a flash of content as the name changes.

@developit
Copy link
Member

developit commented Feb 2, 2021

@rschristian yeah either that or a JSON file that we fetch lazily seems like the way to go here. We can still either "bake in" one name randomly each time the site gets prerendered, or even just have the initial footer not include a name and it only gets injected when changing the URL.

For the API thing, we currently have two Netlify functions, this could be a third? I think I'm slightly inclined to try the simple JSON-file-loaded-via-fetch approach first since it's free. Something like:

footer.js:

-const CONTRIBS = ' <snip> '
+let contributors;

export function useContributors(deps) {
-	const [value, setValue] = useState(CONTRIBS[new Date().getMonth()]);
+	const [value, setValue] = useState(contributors ? contributors[new Date().getMonth()] : undefined);
+	useEffect(() => {
+		fetch('/assets/contributors.json').then(r => r.json()).then(data => contributors = data);
+	}, []);
	useEffect(() => {
-		setValue(CONTRIBS[(Math.random() * (CONTRIBS.length - 1)) | 0]);
+		if (contributors) {
+			setValue(contributors[(Math.random() * (contributors.length - 1)) | 0]);
+		}
	}, deps);
	return value;
}

... then later on:

				<p style="line-height: 1">
					Built by a bunch of{' '}
					<a
						href="https://github.com/preactjs/preact/graphs/contributors"
						target="_blank"
						rel="noopener noreferrer"
					>
						lovely people
-					</a>{' '}
-					like{' '}
+					</a>
+					{contrib && [
+						' like ',
						<a
							href={'https://github.com/' + contrib}
							target="_blank"
							rel="noopener noreferrer"
						>
							@{contrib}
						</a>
+					]}
					.
				</p>

@rschristian
Copy link
Member Author

Totally forgot about this thing. Will try to figure out something tomorrow. Whoops!

@rschristian
Copy link
Member Author

@developit Should (hopefully) be good now. Went with the static JSON file as you suggested. Will be ~4.5kb of transferred JSON but I'm guessing that should be okay.

As a side note, we're up 92 unique new contributors to PreactJS repos since Jan 14 which is pretty cool! ~15% of the total unique contributors to the org have contributed for the first time in the last 95 or so days.

@developit developit changed the base branch from master to update-contribs January 2, 2022 21:49
@developit developit merged commit f0c02c8 into preactjs:update-contribs Jan 2, 2022
developit added a commit that referenced this pull request Jan 3, 2022
* chore: Update contributors list for footer (#742)

* chore: Update contributors list for footer

* refactor: All names, all repos

* refactor: Updating contributor list + retrieval method

* docs: Adding additional comment to contributors list update

* fix: Typo in jsdoc

* filter contribs to 2+ to keep size down

* Update index.js

Co-authored-by: Ryan Christian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants