Skip to content

Conversation

@fellowseb
Copy link

Description

Alters the phrasing used in the Passing arguments to the command section of the Run Node.js scripts from the command line page as it is incorrect:

Also, changes the example as current one can confuse the reader into thinking it's a good example of enabling the Node.js watch option even though it's just passing an '--watch' argument to the app.js script (node app.js --watch).

Current docs:

{
  "type": "module",
  "scripts": {
    "start": "node app.js",
    "dev": "node --run start -- --watch",
    "test": "node --test"
  }
}
[...]
In this case, the --watch argument is passed to the dev script.

Updated docs:

{
  "type": "module",
  "scripts": {
    "start": "node app.js",
    "test": "node --test",
    "test:junit": "node --run test -- --test-reporter=\"junit\"",
  }
}
[...]
In this case, the `--test-reporter` argument is passed to the `node --test` command defined by the `test` script.

Validation

  • Run the example scripts locally

Related Issues

None

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.

…k runner

Fix the example used in the 'Passing arguments to the command' section of the
'Run Node.js scripts from the command line' as it is not referencing the right
package.json script.
Also, change the script used in the example ('node app.js --watch') as it can
confuse the reader into thinking it's a way to enable the Node.js watch option
even though it's just passing an '--watch' argument to the app.js script.
@fellowseb fellowseb requested a review from a team as a code owner December 13, 2025 21:21
@vercel
Copy link

vercel bot commented Dec 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nodejs-org Ready Ready Preview Dec 13, 2025 9:23pm

@github-actions
Copy link
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website

Please review the changes when you have a chance. Thank you! 🙏

@fellowseb fellowseb changed the title docs(learn): Correct unclear example of passing arguments using the task runner fix(learn): Correct unclear example of passing arguments using the task runner Dec 13, 2025
@fellowseb
Copy link
Author

(On an unrelated note: it's my first time opening a PR on this repo and I noticed that nearly nobody follows the commit message guideline of starting the commit message with a capital letter.)

@ovflowd
Copy link
Member

ovflowd commented Dec 14, 2025

(On an unrelated note: it's my first time opening a PR on this repo and I noticed that nearly nobody follows the commit message guideline of starting the commit message with a capital letter.)

There's no such rule, to my understanding? Could you reference it?

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.

I'm struggling to understand why the example you're giving is better suited for the example. Could you point out why these changes are better on demonstrating how to run scripts with node --run?

@fellowseb
Copy link
Author

(On an unrelated note: it's my first time opening a PR on this repo and I noticed that nearly nobody follows the commit message guideline of starting the commit message with a capital letter.)

There's no such rule, to my understanding? Could you reference it?

Sorry I forgot the link in my comment: https://github.com/nodejs/nodejs.org/blob/main/docs/code-style.md#commit-message-format

@avivkeller
Copy link
Member

I think that's a mistake, all characters should be lower case, except if it's a name, IMO

@fellowseb
Copy link
Author

fellowseb commented Dec 14, 2025

I'm struggling to understand why the example you're giving is better suited for the example. Could you point out why these changes are better on demonstrating how to run scripts with node --run?

There are two different (minor) issues:

  1. This line of text is wrong:

In this case, the --watch argument is passed to the dev script.

Saying it's passed to the start would be more accurate. (or even: to the app.js script)

  1. The example used resolves to node app.js --watch being executed: while it's a valid command I find it confusing because it doesn't do what the reader could think it does. It's not the same as node --watch app.js, the node option introduced in the section right above this one. Instead it passes the argument to app.js script. So I tried to find another simple example that relied on the existing package.json scripts. That's all !

@fellowseb
Copy link
Author

I think that's a mistake, all characters should be lower case, except if it's a name, IMO

Ok, I'll open another PR to amend the guidelines in that direction 👍.

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.

3 participants