Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add streams guide #7123

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

feat: add streams guide #7123

wants to merge 7 commits into from

Conversation

Ceres6
Copy link

@Ceres6 Ceres6 commented Oct 16, 2024

Description

This PR adds a stream guide for the learn section

Validation

Lint passing and checked visually

Related Issues

Closes nodejs/node#8646

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npm run format to ensure the code follows the style guide.
  • I have run npm run test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

Co-authored-by: Matteo Collina <[email protected]>
@Ceres6 Ceres6 requested a review from a team as a code owner October 16, 2024 08:25
Copy link

vercel bot commented Oct 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Nov 17, 2024 11:15am

@Ceres6
Copy link
Author

Ceres6 commented Oct 16, 2024

I'm missing translation for the titles as I didn't want to use translator ones

package.json Outdated Show resolved Hide resolved
@AugustinMauroy
Copy link
Member

I'm missing translation for the titles as I didn't want to use translator ones

You mustn't touch to translation fille it's handle with crowdin

@Ceres6
Copy link
Author

Ceres6 commented Oct 16, 2024

I'm missing translation for the titles as I didn't want to use translator ones

You mustn't touch to translation fille it's handle with crowdin

So should I remove the en.json change?

@AugustinMauroy
Copy link
Member

I'm missing translation for the titles as I didn't want to use translator ones

You mustn't touch to translation fille it's handle with crowdin

So should I remove the en.json change?

I mean you just have to update en.json and don't touch to translated file

@Ceres6
Copy link
Author

Ceres6 commented Oct 21, 2024

cc @mcollina @Trott

@mcollina
Copy link
Member

Can you please add a sentence at the beginning or end saying that this guide is a derivative of https://blog.platformatic.dev/a-guide-to-reading-and-writing-nodejs-streams?

@simoneb
Copy link

simoneb commented Oct 22, 2024

@mcollina do we want any corporate references to material that lands on the Node.js website? Asking because, in a similar vein, the article was reviewed by multiple people at Nearform, including myself, and we weren't going to ask @Ceres6 to attribute us.

On the other hand, we were considering to publish the very same article on our company's blog, with a reference to the official documentation, as the authoring has in practice being supported by us.

@mcollina
Copy link
Member

@mcollina do we want any corporate references to material that lands on the Node.js website? Asking because, in a similar vein, the article was reviewed by multiple people at Nearform, including myself, and we weren't going to ask @Ceres6 to attribute us.

@simoneb You can see there are very few original contributions to what has been added here compared to what I wrote in the article, as multiple paragraphs were taken verbatim, including the whole of the introduction.

By all intents and purposes, I'm the primary author of this PR, and I gave permission to use my original piece if I was included as a co-author of it and kindly asked for a backlink if possible.

Adding a backlink is not unreasonable to ask. It's also ok if it's not added, but I would prefer it.


do we want any corporate references to material that lands on the Node.js website?

I think the question for the @nodejs/tsc is:

Should we add a backlink in case existing material is used in the Learn section of the website?

(We should not be using existing material without the author permission anyway).

@mcollina
Copy link
Member

mcollina commented Oct 25, 2024

Here is a proposal, how about you include in the commit description:

  1. a link of the original piece
  2. a mention of all people at NearForm that reviewed it

So we keep a record of the origin of this content.

@Ceres6
Copy link
Author

Ceres6 commented Oct 25, 2024

@mcollina I'm happy to add the backlink. I'm guessing now the TSC is tagged we should wait until that gets discussed, right?

EDIT: I saw that some resources in the learn section have an authors frontmatter prop, maybe that's another option to consider?

@mcollina mcollina removed the blocked label Oct 25, 2024
@mcollina
Copy link
Member

I think it's good if the TSC discuss this because I suspect it would come out more and more.

@Ceres6 you should definitely fill in the authors block in the frontmatter. It should appear something like:

Screenshot 2024-10-25 at 17 59 53

@Ceres6
Copy link
Author

Ceres6 commented Oct 25, 2024

Cool! I'll add authors then and wait for the TSC discussion on the backlink. Just one doubt, should I add Nearform reviewers as authors or are those not considered as such? @mcollina

@mcollina
Copy link
Member

I would list them all.

@ovflowd
Copy link
Member

ovflowd commented Oct 28, 2024

Hey folks 👋 are we happy here?

Copy link
Contributor

github-actions bot commented Oct 28, 2024

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟠 87 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 100 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 99 🟢 100 🟢 100 🟢 92 🔗
/en/download 🟢 99 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 92 🔗

Copy link
Contributor

github-actions bot commented Oct 28, 2024

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 91%
90.38% (592/655) 75.43% (172/228) 94.26% (115/122)

Unit Test Report

Tests Skipped Failures Errors Time
132 0 💤 0 ❌ 0 🔥 5.166s ⏱️

@@ -323,6 +323,10 @@
"backpressuringInStreams": {
"link": "/learn/modules/backpressuring-in-streams",
"label": "components.navigation.learn.modules.links.backpressuringInStreams"
},
"howToUseStreams": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This learn page should be before backpressure in streams IMO.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it, I thought they needed to be in order of creation, but it makes sense to have this first as it is more basic/general

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content-wise (first glance) it looks great. @nodejs/tsc I see this is still in the TSC agenda. Any blocker here?

Copy link
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reads well, just some minor grammar adjustments, among other things.

apps/site/pages/en/learn/modules/how-to-use-streams.md Outdated Show resolved Hide resolved
apps/site/pages/en/learn/modules/how-to-use-streams.md Outdated Show resolved Hide resolved
apps/site/pages/en/learn/modules/how-to-use-streams.md Outdated Show resolved Hide resolved
apps/site/pages/en/learn/modules/how-to-use-streams.md Outdated Show resolved Hide resolved
apps/site/pages/en/learn/modules/how-to-use-streams.md Outdated Show resolved Hide resolved
apps/site/pages/en/learn/modules/how-to-use-streams.md Outdated Show resolved Hide resolved
apps/site/pages/en/learn/modules/how-to-use-streams.md Outdated Show resolved Hide resolved
apps/site/pages/en/learn/modules/how-to-use-streams.md Outdated Show resolved Hide resolved
[`process.stdout`]: https://nodejs.org/api/process.html#processstdout
[`process.stderr`]: https://nodejs.org/api/process.html#processstderr
[Matteo Collina]: https://github.com/mcollina
[Platformatic's Blog]: https://blog.platformatic.dev/a-guide-to-reading-and-writing-nodejs-streams
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some links are inline, while others are like this, can you make them all uniform?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule that should be applied is this. If the link is used once, we put it inline if it is used several times in the bottom

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not what happening in this article. In this article, some are inline, some aren't. IMO one of the following should be done

  1. All inline (preferably not)
  2. All text-based references (I like this the best)
  3. Inline unless used multiple times

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think (almost) all of them are used only once. I like the idea of having them all at the bottom as it's like a bibliography. I haven't seen anything documented about this rule, but I'm happy to go either way as long as we agree

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO as you said, having them at the bottom is cleaner

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put them all at the end, hope that's okay

@avivkeller
Copy link
Member

Content-wise (first glance) it looks great. @nodejs/tsc I see this is still in the TSC agenda. Any blocker here?

According to the minutes from November 13th, they are still? deliberating on the policy of external content attribution.

@Ceres6
Copy link
Author

Ceres6 commented Nov 17, 2024

Content-wise (first glance) it looks great. @nodejs/tsc I see this is still in the TSC agenda. Any blocker here?

According to the minutes from November 13th, they are still? deliberating on the policy of external content attribution.

As far as I can see there were only opinions in favour of adding them, not sure if there should be a formal ruling or something

Co-authored-by: Aviv Keller <[email protected]>
Signed-off-by: Carlos Espa <[email protected]>
@avivkeller
Copy link
Member

It'll be discussed at every-ish meeting while it's on the agenda. Once they remove the label, they should come to a formal dicision.

(Also BTW this isn't the first time we've reposted external content with permission, see

_This is a guest post by James "SubStack" Halliday, originally posted [on his blog](http://substack.net/posts/16a9d8/multi-server-continuous-deployment-with-fleet), and reposted here with permission._
)

@Ceres6
Copy link
Author

Ceres6 commented Nov 26, 2024

@mcollina did you have time to review it?

class MyStream extends Readable {
#count = 0;
_read(size) {
this.push(':-)');
Copy link
Member

@styfle styfle Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why :-)? Could this be changed to something that helps the reader understand?

Also can we use size since this parameter is currently unused.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Ceres6

@ovflowd
Copy link
Member

ovflowd commented Dec 16, 2024

@mcollina did you have time to review it?

Bump, @mcollina

@simoneb
Copy link

simoneb commented Dec 18, 2024

Hey folks, this has been here for a couple of months, can we try to move it forward? It's just a guide to be added to the docs.

I believe we agreed that we're going to credit @mcollina and Platformatic explicitly in the content, and myself and @codyzu in the markdown metadata.

I'm happy with that, so unless anybody disagrees, I would suggest to move this forward.

@ovflowd
Copy link
Member

ovflowd commented Dec 18, 2024

Hey folks, this has been here for a couple of months here, can we try to move it forward? It's just a guide to be added to the docs.

I believe we agreed that we're going to credit @mcollina and Platformatic explicitly in the content, and myself and @codyzu in the markdown metadata.

I'm happy with that, so unless anybody disagrees, I would suggest to move this forward.

Hey there, we can only move forward with explicit approval from the TSC. Hence we gotta wait for @mcollina

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina
Copy link
Member

Sorry about the wait, I had a significant build-up of OSS work to crunch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
learn Issues/pr concerning the learn section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc: guide/topic on how to use streams
9 participants