electron / website

:electron: The Electron website
https://electronjs.org
Apache License 2.0
111 stars 127 forks source link

feat: API History #594

Closed piotrpdev closed 3 weeks ago

piotrpdev commented 2 months ago

[!NOTE] This PR is part of the 2024 Electron GSoC [Project] [Proposal].

Use export GH_TOKEN=<token> before yarn start if you want to test the releases fetching and unzipping.

You might have to manually modify sidebars.js to make yarn start work.

[!NOTE] In development mode, clicking on one of the breaking changes in the table will open the correct page but not jump to the linked header. This is an issue with Docusaurus.

TODO

piotrpdev commented 1 month ago

I found that in the current changes, we only need the number of the PR, not the whole URL of the PR. Moreover, the code has a lot of handling of URLs (fetching the PR number through URLs), so can we consider changing pr-url to pr-id?

@BlackHole1 Sorry, can you be a bit more specific on where you want to change pr-url to pr-id? Are you talking about making that change in the schema (https://github.com/electron/rfcs/pull/6), or just in some of the code in this PR?

Personally, I like pr-url and dislike changing it to pr-id. I like the history data being as close to the original API History block as possible. Using URLs also doesn't restrict us to just electron/electron which could be useful in the future.

It's also useful in scenarios like these:

https://github.com/electron/website/pull/594/files#diff-1dd7a747a324f6f8916a65d87d4c435b9041ed1b0a0d9fa48518423b4d3012edR42-R57

  const formattedVersions = allVersions.map((version) => {
    return (
      <a
        key={version}
        href={change['pr-url']}
        target="_blank"
        rel="noopener noreferrer"
      >
        {/* Semver shenanigans, feature backported to both ^7.1.0 and ^6.3.0 would not be present in 7.0.0 */}
        <pre>
          {release === version ? '>=' : '^'}
          {version}
        </pre>
      </a>
    );
  });
BlackHole1 commented 1 month ago

Before answering this question, I need to apologize first. Due to work and time zone differences, I wasn't able to participate in the RFC discussions and Slack discussions, which caused me to miss a lot of context.


@BlackHole1 Sorry, can you be a bit more specific on where you want to change pr-url to pr-id? Are you talking about making that change in the schema (https://github.com/electron/rfcs/pull/6), or just in some of the code in this PR?

I recently discovered during the code review of this PR that the current changes almost do not use the pr-url, but only use the pr-id within it. To get the pr id, there are many lines of code like Number(added['pr-url'].split('/').at(-1)). I believe this is redundant code. I looked through https://github.com/electron/rfcs/pull/6, but did not see any relevant discussion, so I am raising this question here.

Using URLs also doesn't restrict us to just electron/electron which could be useful in the future.

Although I don't see when support will be extended to repositories outside of electron/electron in the short term, I can reluctantly accept this reason.

It's also useful in scenarios like these: https://github.com/electron/website/pull/594/files#diff-1dd7a747a324f6f8916a65d87d4c435b9041ed1b0a0d9fa48518423b4d3012edR42-R57

Yes, pr-url is only used here. My question is, why not use pr-id directly and then use something like: https://github.com/electron/electron/pulls/${prID} here? Wouldn't this reduce the redundancy in the code overall?


Overall, this PR, CODE LGTM. Since other members think pr-url is acceptable, I won't strongly oppose it, just raising a question :)

dsanders11 commented 3 weeks ago

I think this is ready. 🎉 @piotrpdev, can you go ahead and remove the docs/ changes? Then I'll go ahead and merge.

piotrpdev commented 3 weeks ago

@dsanders11 I think this is ready. 🎉 @piotrpdev, can you go ahead and remove the docs/ changes? Then I'll go ahead and merge.

Done, hopefully nothing breaks on merge 🤞