-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
doc, src: sort cli cmd options and env vars #19878
Conversation
Tricky diff) |
Let's do the check in some steps.
Found now during the comparison:
### `--force-fips`
<!-- YAML
- added: v6.0.0
-->
### `--force-fips`
<!-- YAML
+added:
+ - v5.0.0
+ - v4.2.0
+changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/19600
+ description: The `--require` option is now supported when checking a file.
--> ### `-c`, `--check`
<!-- YAML
added:
- v5.0.0
- v4.2.0
-changes:
- - version: REPLACEME
- pr-url: https://github.com/nodejs/node/pull/19600
- description: The `--require` option is now supported when checking a file.
-->
### `-c`, `--check`
<!-- YAML
added:
- v5.0.0
- v4.2.0
--> |
While fixing the metadata change, you can also add an extra blank line between |
Yes, very tricky diff; thank you for the thorough review! I got a little tripped up on the 0876a03#diff-85b6573bc4afd5e06ed3b9d9b553635d
EDIT: Looks like the metadata between those options got switched. I'll go ahead get this updated along with the blank lines, but let me know if that doesn't seem correct. |
It seems the removal from |
@vsemozhetbyt, you're right. Making these changes now. |
0936cf3
to
27eb437
Compare
Now I am trying to find a way to check if nothing is changed inside the reordered sections by chance... |
@vsemozhetbyt it's definitely non-trivial to sift through the changes. I'm also working on making the same adjustments in If there happens to be a better way to do it so the diff isn't so difficult to read, please let me know. |
I am not aware of any simpler way( But to check if the sections are not changed I've used this trick
And they are! |
Sorting is also OK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now:
- Nothing is added or deleted except appropriate new lines.
- Nothing is regrouped inside the sections.
- Sorting is right.
Changes in |
27eb437
to
d5a5eb3
Compare
@vsemozhetbyt, as there were some logic changes with the latest commit, I'd like to take a stab at creating some c++ tests before this moves forward. Also, noticed some cli options enumerated in
Should I add those to the doc as part of this PR or create a different one? |
I think as we are at this so deep and as we've already added some things from |
Got it, @vsemozhetbyt! |
So, I do not know C++, so the second commit needs to be reviewed by someone else. Maybe @Trott? + " -- indicate the end of node options\n"
+ " -h, --help print node command line options\n"
+#if defined(NODE_HAVE_I18N_SUPPORT)
+ "NODE_PRESERVE_SYMLINKS set to 1 to preserve symbolic links\n"
+ " when resolving and caching modules\n"
+#endif (TBH, I do not know why - " - script read from stdin (default; "
- "interactive mode if a tty)\n"
+ " - script read from stdin (default; \n"
+ " interactive mode if a tty)\n"
- "--require", "-r",
+ "--require",
...
+ "-r", And also these added and deleted lines in various places: -#endif /* NODE_FIPS_MODE */
-#endif /* HAVE_OPENSSL */ +#endif // defined(NODE_HAVE_I18N_SUPPORT)
+#endif // defined(NODE_HAVE_I18N_SUPPORT)
+#endif // HAVE_INSPECTOR
+#endif // HAVE_OPENSSL
+#endif // HAVE_OPENSSL
+#endif // HAVE_OPENSSL
+#endif // HAVE_OPENSSL
+#endif // NODE_FIPS_MODE
+#if defined(NODE_HAVE_I18N_SUPPORT)
+#if defined(NODE_HAVE_I18N_SUPPORT)
+#if HAVE_OPENSSL
+#if HAVE_OPENSSL
+#if HAVE_OPENSSL |
Intermediate full CI to check the current stage: https://ci.nodejs.org/job/node-test-pull-request/14131/ |
One fail of |
Indeed, appears unrelated. Should re-run node-test-commit-linux just to set a good example if nothing else. (Well, that and I think our current governance rules require it.) But I can't restart or add any node-test-commit-linux jobs right now. They just disappear in CI. @nodejs/build |
I found a job (git-clean-rpi) that had a big queue cause old machines it was trying to run had been removed. I've fixed that up for now and new runs seem to be going through. I'm going to restart jenkins when I see it idle but for now it seems to be working OK. |
I'm curious about this as well. I added that check because the -#if defined(NODE_HAVE_I18N_SUPPORT)
- " --icu-data-dir=dir set ICU data load path to dir\n"
- " (overrides NODE_ICU_DATA)\n"
-#if !defined(NODE_HAVE_SMALL_ICU)
- " note: linked-in ICU data is present\n"
-#endif
- " --preserve-symlinks preserve symbolic links when resolving\n"
- " --experimental-modules experimental ES Module support\n"
- " and caching modules\n"
- " --experimental-vm-modules experimental ES Module support\n"
- " in vm module\n"
-#endif I may be reading the code wrong (which very well may be the case as I don't know c++ either), but if |
node-test-pull-request @ https://ci.nodejs.org/job/node-test-pull-request/14133/ I think you need to also edit doc/node.1 for completeness here, it has the same list of arguments in the same order I think. So you'd better get your roff on and figure that one out too ( |
haha yep @rvagg! Was going to ask if that needed to be done as well. Started looking at mdoc and roff... should be fun! Thanks for the test command! |
d5a5eb3
to
ca84066
Compare
Do we have a way to perform tests against different versions of the compiled binary? I'd like to validate the latest commit against different build configurations. Specifically, the output of the
Is there any way to test against these with the current toolset? |
function testForSubstring(options) { | ||
if (options.compileConstant) { | ||
options.flags.forEach((flag) => { | ||
assert.strictEqual(true, stdOut.indexOf(flag) !== -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you swap the arguments around? assert arguments are actual, expected
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}); | ||
} else { | ||
options.flags.forEach((flag) => { | ||
assert.strictEqual(-1, stdOut.indexOf(flag)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you swap the arguments around? assert arguments are actual, expected
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
function startPrintHelpTest() { | ||
exec('./node --help', common.mustCall((err, stdout, stderr) => { | ||
if (err) { | ||
assert.ifError(err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be wrapped in if (err) {}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
|
||
function startPrintHelpTest() { | ||
exec('./node --help', common.mustCall((err, stdout, stderr) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use process.execPath
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Test failing on Windows, e.g., https://ci.nodejs.org/job/node-test-binary-windows/16492/COMPILED_BY=vs2017,RUNNER=win10,RUN_SUBSET=1/console:
|
@willhayslett Using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm putting the "Request Changes" red X here until the test is fixed. I don't want anyone to accidentally land this.
Alphabetizing the command line options and environment variables in doc/api/cli.md for consistency and readability. Refs: nodejs#19814
Updated the node.PrintHelp() function to return command line options and environment variables sorted in ascii order. Additionally, added missing options as sourced from doc/api/cli.md. Options added include "--", "--help" and the "NODE_PRESERVE_SYMLINKS" environment variable. Also updated the comments in the PrintHelp() method to C++ style. Fixes: nodejs#19814
Updated doc/api/cli.md to include command line options being printed in the node.PrintHelp() function in src/node.cc but weren't otherwise documented in the cli spec. Options added include:: --napi-modules --v8-pool-size=num --experimental-modules --experimental-vm-modules
Ascii sorted the node man page command line options. This change brings sort order consistency between the cli options displayed in doc/node.1 and the cli options enumerated in other areas of the project. Also rearranged the language for "--use-bundled-ca, --use-openssl-ca" to correspond with the order of the options as displayed. Fixes: nodejs#19814
Created tests to validate that the newly ascii sorted cli options in the node.PrintHelp() function are being returned according to build configurations as expected.
e7e685a
to
dd33653
Compare
Thanks @richardlau and @Trott, changes committed. |
Is one fail of |
@vsemozhetbyt Sure seems like it ought to be unrelated, but no landing without a green CI everywhere, so here's a FreeBSD re-run: https://ci.nodejs.org/job/node-test-commit-freebsd/16998/ |
This time a different test failed on FreeBSD, also seemingly unrelated. Trying again: https://ci.nodejs.org/job/node-test-commit-freebsd/16999/ |
Rerun CI is green. I will land soon if nobody objects. |
Last one was green. 👍 |
* Alphabetize the command line options and environment variables in doc/api/cli.md for consistency and readability. * Update doc/api/cli.md to include command line options being printed in the `node.PrintHelp()` function in src/node.cc but weren't otherwise documented in the cli spec. Options added include: --napi-modules --v8-pool-size=num --experimental-modules --experimental-vm-modules * ASCII sort the node man page command line options. This change brings sort order consistency between the cli options displayed in doc/node.1 and the cli options enumerated in other areas of the project. Also rearrange the language for `--use-bundled-ca`, `--use-openssl-ca` to correspond with the order of the options as displayed. * Update `node.PrintHelp()` function to return command line options and environment variables sorted in ASCII order. Additionally, add missing options as sourced from doc/api/cli.md. Options added include `--`, `--help` and the `NODE_PRESERVE_SYMLINKS` environment variable. Also update the comments in the `node.PrintHelp()` method to C++ style. * Create tests to validate that the newly ASCII sorted cli options in the `node.PrintHelp()` function are being returned according to build configurations as expected. PR-URL: #19878 Refs: #19814 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: James M Snell <[email protected]>
Squashed and landed in a43e889 @willhayslett Thank you for all the heavy lifting! |
Woo hoo! Thanks, everyone! |
* Alphabetize the command line options and environment variables in doc/api/cli.md for consistency and readability. * Update doc/api/cli.md to include command line options being printed in the `node.PrintHelp()` function in src/node.cc but weren't otherwise documented in the cli spec. Options added include: --napi-modules --v8-pool-size=num --experimental-modules --experimental-vm-modules * ASCII sort the node man page command line options. This change brings sort order consistency between the cli options displayed in doc/node.1 and the cli options enumerated in other areas of the project. Also rearrange the language for `--use-bundled-ca`, `--use-openssl-ca` to correspond with the order of the options as displayed. * Update `node.PrintHelp()` function to return command line options and environment variables sorted in ASCII order. Additionally, add missing options as sourced from doc/api/cli.md. Options added include `--`, `--help` and the `NODE_PRESERVE_SYMLINKS` environment variable. Also update the comments in the `node.PrintHelp()` method to C++ style. * Create tests to validate that the newly ASCII sorted cli options in the `node.PrintHelp()` function are being returned according to build configurations as expected. PR-URL: #19878 Refs: #19814 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: James M Snell <[email protected]>
* Alphabetize the command line options and environment variables in doc/api/cli.md for consistency and readability. * Update doc/api/cli.md to include command line options being printed in the `node.PrintHelp()` function in src/node.cc but weren't otherwise documented in the cli spec. Options added include: --napi-modules --v8-pool-size=num --experimental-modules --experimental-vm-modules * ASCII sort the node man page command line options. This change brings sort order consistency between the cli options displayed in doc/node.1 and the cli options enumerated in other areas of the project. Also rearrange the language for `--use-bundled-ca`, `--use-openssl-ca` to correspond with the order of the options as displayed. * Update `node.PrintHelp()` function to return command line options and environment variables sorted in ASCII order. Additionally, add missing options as sourced from doc/api/cli.md. Options added include `--`, `--help` and the `NODE_PRESERVE_SYMLINKS` environment variable. Also update the comments in the `node.PrintHelp()` method to C++ style. * Create tests to validate that the newly ASCII sorted cli options in the `node.PrintHelp()` function are being returned according to build configurations as expected. PR-URL: nodejs#19878 Refs: nodejs#19814 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: James M Snell <[email protected]>
Alphabetizing the command line options and environment
variables in doc/api/cli.md for consistency and readability.
Refs: #19814
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes