Skip to content

feat(README): Sync to nodejs/learn - #423

Merged
avivkeller merged 2 commits into
mainfrom
learn
Aug 9, 2026
Merged

feat(README): Sync to nodejs/learn#423
avivkeller merged 2 commits into
mainfrom
learn

Conversation

@avivkeller

@avivkeller avivkeller commented Apr 6, 2026

Copy link
Copy Markdown
Member

This PR does two things:

  1. It rewrites all READMEs to conform to a new docs/writing-a-readme.md guide, which explains how to write the README so it appears like a good article on nodejs.org/learn
  2. Adds a CI/CD action to update learn

Copilot AI review requested due to automatic review settings April 6, 2026 16:57
@avivkeller avivkeller added the blocked:upstream Depends on another PR or external change/fix label Apr 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes recipe documentation so each recipe README reads like a consistent article (intended for nodejs.org/learn), and starts wiring CI/CD to trigger a downstream refresh in nodejs/learn after publishing.

Changes:

  • Rewrites many recipes/*/README.md files to follow a shared structure (frontmatter, Usage, Examples, optional Notes/Limitations).
  • Adds docs/writing-a-readme.md documenting the required README template and conventions.
  • Extends the publish workflow to trigger a refresh workflow in nodejs/learn after a successful publish.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
recipes/zlib-bytesread-to-byteswritten/README.md Reformats recipe README into the new article-style template with usage + examples.
recipes/util-print-to-console-log/README.md Rewrites README to structured format and expands examples per import style.
recipes/util-log-to-console-log/README.md Rewrites README to structured format and adds multiple examples.
recipes/util-is/README.md Rewrites README with a replacement table and structured usage/examples.
recipes/util-extend-to-object-assign/README.md Rewrites README with multiple import-style examples and usage section.
recipes/types-is-native-error/README.md Rewrites README with structured examples for multiple call/import patterns.
recipes/tmpdir-to-tmpdir/README.md Rewrites README to structured template (but Usage command currently incorrect).
recipes/tls-create-secure-pair-to-tls-socket/README.md Rewrites README with clearer mapping notes and structured examples.
recipes/timers-deprecations/README.md Rewrites README with multiple examples covering each deprecated timers API.
recipes/slow-buffer-to-buffer-alloc-unsafe-slow/README.md Rewrites README with structured examples for CJS/ESM patterns.
recipes/rmdir/README.md Rewrites README to structured template and clarifies transformation scope.
recipes/repl-classes-with-new/README.md Rewrites README with structured usage and CJS/ESM examples.
recipes/repl-builtin-modules/README.md Rewrites README with structured usage and examples for require/import cases.
recipes/process-main-module/README.md Rewrites README with structured examples for multiple access patterns.
recipes/process-assert-to-node-assert/README.md Rewrites README and clarifies behavior re: module type detection and reuse of existing imports.
recipes/node-url-to-whatwg-url/README.md Rewrites README to structured template and documents property-mapping nuances.
recipes/mock-module-exports/README.md Rewrites README to structured template with multiple option-shape examples.
recipes/import-assertions-to-attributes/README.md Rewrites README with structured examples (but title currently doesn’t match naming guidance).
recipes/http-outgoingmessage-headers/README.md Adds new canonical README.md for the recipe in the new template format.
recipes/http-outgoingmessage-headers/readme.md Removes old non-canonical lowercase readme file.
recipes/http-classes-with-new/README.md Rewrites README with structured examples for namespace + named imports.
recipes/fs-truncate-fd-deprecation/README.md Rewrites README with structured usage, examples, and limitations notes.
recipes/fs-access-mode-constants/README.md Rewrites README with structured examples across require/import styles.
recipes/dirent-path-to-parent-path/README.md Rewrites README with structured examples for loops, callbacks, and destructuring.
recipes/crypto-rsa-pss-update/README.md Rewrites README with structured examples and a limitations note.
recipes/crypto-fips-to-getFips/README.md Rewrites README with structured examples for read/write scenarios.
recipes/crypto-createcipheriv-migration/README.md Rewrites README with structured examples and notes explaining required manual review.
recipes/createCredentials-to-createSecureContext/README.md Rewrites README to structured template (but Usage command currently doesn’t match published package name).
recipes/create-require-from-path/README.md Rewrites README with structured examples including aliased import case.
recipes/correct-ts-specifiers/README.md Rewrites README to shorter structured form with a single consolidated diff example + limitations note.
recipes/chalk-to-util-styletext/README.md Rewrites README with structured examples and limitations note (but title is not very descriptive).
recipes/buffer-atob-btoa/README.md Rewrites README with structured examples and notes about import removal behavior.
docs/writing-a-readme.md Introduces the canonical README writing guide and mandatory template.
.github/workflows/codemod_publish.yml Adds a post-publish job to trigger a refresh workflow in nodejs/learn.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Run this codemod with:

```sh
npx codemod @nodejs/tmpDir-to-tmpdir

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

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

The npx codemod command uses @nodejs/tmpDir-to-tmpdir, but the published package name is all-lowercase (@nodejs/tmpdir-to-tmpdir, per this recipe’s package.json). As written, npx will fail to resolve the package on npm. Update the Usage command to the correct package name (lowercase).

Suggested change
npx codemod @nodejs/tmpDir-to-tmpdir
npx codemod @nodejs/tmpdir-to-tmpdir

Copilot uses AI. Check for mistakes.
Run this codemod with:

```sh
npx codemod @nodejs/createCredentials-to-createSecureContext

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

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

The Usage command uses @nodejs/createCredentials-to-createSecureContext, but npm package names must be lowercase and this recipe’s package.json declares the published name as @nodejs/createcredentials-to-createsecurecontext. Using the current command will fail. Please update the command to match the actual package name.

Suggested change
npx codemod @nodejs/createCredentials-to-createSecureContext
npx codemod @nodejs/createcredentials-to-createsecurecontext

Copilot uses AI. Check for mistakes.
Comment thread docs/writing-a-readme.md
Comment on lines +18 to +22
Run this codemod with:

```sh
npx codemod @nodejs/<recipe-directory-name>
```

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

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

The mandatory template says to run recipes using npx codemod @nodejs/<recipe-directory-name>, but npm package names must be lowercase and may not match a directory name if the directory contains uppercase (e.g., recipes/createCredentials-to-createSecureContext publishes as @nodejs/createcredentials-to-createsecurecontext). Consider updating the guidance to reference the package name from the recipe’s package.json (or explicitly require lowercase directory names that match the package name).

Copilot uses AI. Check for mistakes.
---

This recipe converts import assertions (`assert` syntax) to the standardized import attributes (`with` syntax). It modifies code like:
# import assert import with

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

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

The title # import assert import with doesn’t follow the naming guidance in docs/writing-a-readme.md for non-deprecation migrations (use a plain descriptive title like “Import Assertions to Attributes”), and it’s ambiguous when rendered as an article heading. Please rename the title to a clearer, descriptive form consistent with the guide.

Suggested change
# import assert import with
# Import Assertions to Attributes

Copilot uses AI. Check for mistakes.
---

This recipe migrates from the external `chalk` package to Node.js built-in `util.styleText` API. It transforms chalk method calls to use the native Node.js styling functionality.
# chalk util.styleText

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

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

The title # chalk util.styleText is not very descriptive as an article heading and doesn’t match the title patterns in docs/writing-a-readme.md (non-deprecation migrations should use a plain descriptive title). Consider renaming it to something like “Chalk to util.styleText” (or similar) to match the convention and improve readability on nodejs.org/learn.

Suggested change
# chalk util.styleText
# Chalk to util.styleText

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# chalk util.styleText
# Chalk to `util.styleText()`

@JakobJingleheimer JakobJingleheimer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome, thanks for this! I'm slowly making my way through it (6/36 so far).

Comment thread .github/workflows/refresh-learn.yml Outdated
Comment thread docs/writing-a-readme.md
Comment thread docs/writing-a-readme.md Outdated
Comment thread docs/writing-a-readme.md Outdated
Comment thread docs/writing-a-readme.md Outdated
Comment thread recipes/correct-ts-specifiers/README.md
Comment thread recipes/correct-ts-specifiers/README.md
Comment thread recipes/correct-ts-specifiers/README.md
Comment thread recipes/correct-ts-specifiers/README.md
Comment thread recipes/correct-ts-specifiers/README.md

@JakobJingleheimer JakobJingleheimer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Btw, let's include patch version bumps for each migration so the published README matches what'll be in Learn.

Comment thread recipes/create-require-from-path/README.md Outdated
---

This recipe migrates from the external `chalk` package to Node.js built-in `util.styleText` API. It transforms chalk method calls to use the native Node.js styling functionality.
# chalk util.styleText

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# chalk util.styleText
# Chalk to `util.styleText()`

Comment thread recipes/buffer-atob-btoa/README.md Outdated
Comment thread recipes/create-require-from-path/README.md Outdated
@JakobJingleheimer

Copy link
Copy Markdown
Member
  1. READMEs to conform to a new docs/writing-a-readme.md guide

Should we add a markdown validation workflow to ensure new READMEs conform? Perhaps we could leverage mdvalidator.

@avivkeller

Copy link
Copy Markdown
Member Author

Sure! To be honest, however, this is kinda on hold until we get a token

@JakobJingleheimer

Copy link
Copy Markdown
Member

Plus it's huge, so it takes a while to review 😅

@avivkeller avivkeller removed the blocked:upstream Depends on another PR or external change/fix label Jul 11, 2026
Comment thread .github/workflows/refresh-learn.yml Outdated
@avivkeller

Copy link
Copy Markdown
Member Author

Still waiting for a token, btw

@AugustinMauroy

AugustinMauroy commented Aug 9, 2026

Copy link
Copy Markdown
Member

also after re-read with new discussion I realized that all codemod will have dedicated page. right ?
that not seem good idea since some of theme is just one deprecation.

maybe having a json with list of coemod that can be synced

@avivkeller

Copy link
Copy Markdown
Member Author

oh! we got the token a while ago, let me rebase and merge

Comment thread recipes/chalk-to-util-styletext/README.md
Comment thread recipes/correct-ts-specifiers/.codemodrc.json
Signed-off-by: Aviv Keller <me@aviv.sh>
@avivkeller
avivkeller merged commit aedfc76 into main Aug 9, 2026
3 checks passed
@avivkeller
avivkeller deleted the learn branch August 9, 2026 20:54
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.

4 participants