MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / WithDownloadArchive

Function WithDownloadArchive

apps/site/components/withDownloadArchive.tsx:22–44  ·  view source on GitHub ↗
({
  children: Component,
})

Source from the content-addressed store, hash-verified

20 * fetches release data, and provides download artifacts to child component
21 */
22const WithDownloadArchive: FC<WithDownloadArchiveProps> = async ({
23 children: Component,
24}) => {
25 const { pathname } = getClientContext();
26
27 // Extract version from pathname
28 const version = extractVersionFromPath(pathname);
29
30 // Find the release data for the given version
31 const releaseData = await provideReleaseData();
32 const release = releaseData.find(release =>
33 // Match major version only (e.g., v22.x.x for release.major v22)
34 version.startsWith(`v${release.major}`)
35 )!;
36
37 if (!release) {
38 return notFound();
39 }
40
41 const releaseArtifacts = buildReleaseArtifacts(release, version);
42
43 return <Component {...releaseArtifacts} />;
44};
45
46export default WithDownloadArchive;

Callers

nothing calls this directly

Calls 2

extractVersionFromPathFunction · 0.90
buildReleaseArtifactsFunction · 0.90

Tested by

no test coverage detected