nodejs.org icon indicating copy to clipboard operation
nodejs.org copied to clipboard

[nit] Select ARM64 by default in the dropdown if user is visiting from M1

Open trivikr opened this issue 11 months ago • 6 comments

Enter your suggestions in details:

Is your feature request related to a problem? Please describe.

Not a big issue, but I was browsing new redesigned website from M1 (on ARM architecture) and noticed that X64 was selected in the dropdown by default for prebuilt installer and binaries

https://nodejs-org-git-meta-remove-legacy-website-code-openjs.vercel.app/en/download

Prebuilt Installer prebuilt-installer
Prebuilt Binaries prebuilt-binaries

Describe the solution you'd like

Select the architecture of visitors machine, if it's detectable from JavaScript.

For example, it's detectable from experimental await navigator.userAgentData.getHighEntropyValues(['architecture']) API call.

The website uses the experimental API to get bitness https://github.com/nodejs/nodejs.org/blob/04fd007aa4528b88abcd0722c1c6ff1788cb08cc/util/getBitness.ts#L8-L10

Describe alternatives you've considered

N/A, as the user can explicitly select ARM option from the dropdown even if X64 is selected by default.

trivikr avatar Feb 29 '24 01:02 trivikr

The architecture might not matter in the dropdown for macOS, as both binaries link to the same .pkg installer.

trivikr avatar Feb 29 '24 01:02 trivikr

Enter your suggestions in details:

Is your feature request related to a problem? Please describe.

Not a big issue, but I was browsing new redesigned website from M1 (on ARM architecture) and noticed that X64 was selected in the dropdown by default for prebuilt installer and binaries

nodejs-org-git-meta-remove-legacy-website-code-openjs.vercel.app/en/download

Prebuilt Installer Prebuilt Binaries

Describe the solution you'd like

Select the architecture of visitors machine, if it's detectable from JavaScript.

For example, it's detectable from experimental await navigator.userAgentData.getHighEntropyValues(['architecture']) API call.

The website uses the experimental API to get bitness

https://github.com/nodejs/nodejs.org/blob/04fd007aa4528b88abcd0722c1c6ff1788cb08cc/util/getBitness.ts#L8-L10

Describe alternatives you've considered

N/A, as the user can explicitly select ARM option from the dropdown even if X64 is selected by default.

Feel free to create a PR or patch to use the right bitness. We use the getBitness in that button but I believe the Bitness doesn't say the architecture (i.e. ARM)

Because the architecture is ARM and the bitness is 64. So, technically, the result is correct.

ovflowd avatar Mar 02 '24 00:03 ovflowd

Pretty much an idea for a PR is to introduce the "getArchitecture" utility and embed it on our util that detects the UserOS (https://github.com/nodejs/nodejs.org/blob/main/hooks/react-client/useDetectOS.ts)

So you could add an extra field "architecture" that would then be used on our BitnessDropdown (https://github.com/nodejs/nodejs.org/blob/3808cb7682d50c8876791e356b3e486196c68934/components/Downloads/Release/BitnessDropdown.tsx#L9)

(Which is actually an architecture + bitness dropdown...)

ovflowd avatar Mar 02 '24 00:03 ovflowd

I added good first issue and website redesign labels if anyone else wants to give it a try.

trivikr avatar Mar 04 '24 04:03 trivikr

I can take it

Vadimchesh avatar Mar 04 '24 18:03 Vadimchesh

I have fixed the issue and have also created a PR. Please have a look

rhlshah avatar Mar 04 '24 23:03 rhlshah