Skip to content

Commit 046e642

Browse files
aduh95RedYetiDev
authored andcommitted
test: ensure cli.md is in alphabetical order
Co-authored-by: RedYetiDev <redyetidev@gmail.com> PR-URL: #56025 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 59d6891 commit 046e642

File tree

2 files changed

+119
-104
lines changed

2 files changed

+119
-104
lines changed

doc/api/cli.md

+104-104
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,18 @@ Affects the default output directory of:
553553
* [`--heap-prof-dir`][]
554554
* [`--redirect-warnings`][]
555555

556+
### `--disable-proto=mode`
557+
558+
<!-- YAML
559+
added:
560+
- v13.12.0
561+
- v12.17.0
562+
-->
563+
564+
Disable the `Object.prototype.__proto__` property. If `mode` is `delete`, the
565+
property is removed entirely. If `mode` is `throw`, accesses to the
566+
property throw an exception with the code `ERR_PROTO_ACCESS`.
567+
556568
### `--disable-warning=code-or-type`
557569

558570
> Stability: 1.1 - Active development
@@ -647,18 +659,6 @@ users can at least run WebAssembly (with less optimal performance)
647659
when the virtual memory address space available to their Node.js
648660
process is lower than what the V8 WebAssembly memory cage needs.
649661

650-
### `--disable-proto=mode`
651-
652-
<!-- YAML
653-
added:
654-
- v13.12.0
655-
- v12.17.0
656-
-->
657-
658-
Disable the `Object.prototype.__proto__` property. If `mode` is `delete`, the
659-
property is removed entirely. If `mode` is `throw`, accesses to the
660-
property throw an exception with the code `ERR_PROTO_ACCESS`.
661-
662662
### `--disallow-code-generation-from-strings`
663663

664664
<!-- YAML
@@ -669,25 +669,6 @@ Make built-in language features like `eval` and `new Function` that generate
669669
code from strings throw an exception instead. This does not affect the Node.js
670670
`node:vm` module.
671671

672-
### `--expose-gc`
673-
674-
<!-- YAML
675-
added:
676-
- v22.3.0
677-
- v20.18.0
678-
-->
679-
680-
> Stability: 1 - Experimental. This flag is inherited from V8 and is subject to
681-
> change upstream.
682-
683-
This flag will expose the gc extension from V8.
684-
685-
```js
686-
if (globalThis.gc) {
687-
globalThis.gc();
688-
}
689-
```
690-
691672
### `--dns-result-order=order`
692673

693674
<!-- YAML
@@ -793,6 +774,15 @@ node --entry-url --experimental-strip-types 'file.ts?query#hash'
793774
node --entry-url 'data:text/javascript,console.log("Hello")'
794775
```
795776

777+
### `--env-file-if-exists=config`
778+
779+
<!-- YAML
780+
added: v22.9.0
781+
-->
782+
783+
Behavior is the same as [`--env-file`][], but an error is not thrown if the file
784+
does not exist.
785+
796786
### `--env-file=config`
797787

798788
> Stability: 1.1 - Active development
@@ -860,15 +850,6 @@ export USERNAME="nodejs" # will result in `nodejs` as the value.
860850
If you want to load environment variables from a file that may not exist, you
861851
can use the [`--env-file-if-exists`][] flag instead.
862852

863-
### `--env-file-if-exists=config`
864-
865-
<!-- YAML
866-
added: v22.9.0
867-
-->
868-
869-
Behavior is the same as [`--env-file`][], but an error is not thrown if the file
870-
does not exist.
871-
872853
### `-e`, `--eval "script"`
873854

874855
<!-- YAML
@@ -907,17 +888,6 @@ flows within the application. As such, it is presently recommended to be sure
907888
your application behaviour is unaffected by this change before using it in
908889
production.
909890

910-
### `--experimental-transform-types`
911-
912-
<!-- YAML
913-
added: v22.7.0
914-
-->
915-
916-
> Stability: 1.1 - Active development
917-
918-
Enables the transformation of TypeScript-only syntax into JavaScript code.
919-
Implies `--experimental-strip-types` and `--enable-source-maps`.
920-
921891
### `--experimental-eventsource`
922892

923893
<!-- YAML
@@ -997,6 +967,18 @@ following permissions are restricted:
997967
* WASI - manageable through [`--allow-wasi`][] flag
998968
* Addons - manageable through [`--allow-addons`][] flag
999969

970+
### `--experimental-print-required-tla`
971+
972+
<!-- YAML
973+
added:
974+
- v22.0.0
975+
- v20.17.0
976+
-->
977+
978+
If the ES module being `require()`'d contains top-level `await`, this flag
979+
allows Node.js to evaluate the module, try to locate the
980+
top-level awaits, and print their location to help users find them.
981+
1000982
### `--experimental-require-module`
1001983

1002984
<!-- YAML
@@ -1093,6 +1075,17 @@ added:
10931075
10941076
Enable module mocking in the test runner.
10951077

1078+
### `--experimental-transform-types`
1079+
1080+
<!-- YAML
1081+
added: v22.7.0
1082+
-->
1083+
1084+
> Stability: 1.1 - Active development
1085+
1086+
Enables the transformation of TypeScript-only syntax into JavaScript code.
1087+
Implies `--experimental-strip-types` and `--enable-source-maps`.
1088+
10961089
### `--experimental-vm-modules`
10971090

10981091
<!-- YAML
@@ -1138,6 +1131,25 @@ added: v22.4.0
11381131

11391132
Enable experimental [`Web Storage`][] support.
11401133

1134+
### `--expose-gc`
1135+
1136+
<!-- YAML
1137+
added:
1138+
- v22.3.0
1139+
- v20.18.0
1140+
-->
1141+
1142+
> Stability: 1 - Experimental. This flag is inherited from V8 and is subject to
1143+
> change upstream.
1144+
1145+
This flag will expose the gc extension from V8.
1146+
1147+
```js
1148+
if (globalThis.gc) {
1149+
globalThis.gc();
1150+
}
1151+
```
1152+
11411153
### `--force-context-aware`
11421154

11431155
<!-- YAML
@@ -1416,20 +1428,6 @@ When enabled, the parser will accept the following:
14161428
All the above will expose your application to request smuggling
14171429
or poisoning attack. Avoid using this option.
14181430

1419-
### `--inspect[=[host:]port]`
1420-
1421-
<!-- YAML
1422-
added: v6.3.0
1423-
-->
1424-
1425-
Activate inspector on `host:port`. Default is `127.0.0.1:9229`. If port `0` is
1426-
specified, a random available port will be used.
1427-
1428-
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
1429-
and profile Node.js instances. The tools attach to Node.js instances via a
1430-
tcp port and communicate using the [Chrome DevTools Protocol][].
1431-
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
1432-
14331431
<!-- Anchor to make sure old links find a target -->
14341432

14351433
<a id="inspector_security"></a>
@@ -1498,6 +1496,20 @@ a random available port will be used.
14981496

14991497
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
15001498

1499+
### `--inspect[=[host:]port]`
1500+
1501+
<!-- YAML
1502+
added: v6.3.0
1503+
-->
1504+
1505+
Activate inspector on `host:port`. Default is `127.0.0.1:9229`. If port `0` is
1506+
specified, a random available port will be used.
1507+
1508+
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
1509+
and profile Node.js instances. The tools attach to Node.js instances via a
1510+
tcp port and communicate using the [Chrome DevTools Protocol][].
1511+
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
1512+
15011513
### `-i`, `--interactive`
15021514

15031515
<!-- YAML
@@ -1845,18 +1857,6 @@ changes:
18451857

18461858
Identical to `-e` but prints the result.
18471859

1848-
### `--experimental-print-required-tla`
1849-
1850-
<!-- YAML
1851-
added:
1852-
- v22.0.0
1853-
- v20.17.0
1854-
-->
1855-
1856-
If the ES module being `require()`'d contains top-level `await`, this flag
1857-
allows Node.js to evaluate the module, try to locate the
1858-
top-level awaits, and print their location to help users find them.
1859-
18601860
### `--prof`
18611861

18621862
<!-- YAML
@@ -2132,6 +2132,17 @@ The following environment variables are set when running a script with `--run`:
21322132
* `NODE_RUN_PACKAGE_JSON_PATH`: The path to the `package.json` that is being
21332133
processed.
21342134

2135+
### `--secure-heap-min=n`
2136+
2137+
<!-- YAML
2138+
added: v15.6.0
2139+
-->
2140+
2141+
When using `--secure-heap`, the `--secure-heap-min` flag specifies the
2142+
minimum allocation from the secure heap. The minimum value is `2`.
2143+
The maximum value is the lesser of `--secure-heap` or `2147483647`.
2144+
The value given must be a power of two.
2145+
21352146
### `--secure-heap=n`
21362147

21372148
<!-- YAML
@@ -2157,17 +2168,6 @@ The secure heap is not available on Windows.
21572168

21582169
See [`CRYPTO_secure_malloc_init`][] for more details.
21592170

2160-
### `--secure-heap-min=n`
2161-
2162-
<!-- YAML
2163-
added: v15.6.0
2164-
-->
2165-
2166-
When using `--secure-heap`, the `--secure-heap-min` flag specifies the
2167-
minimum allocation from the secure heap. The minimum value is `2`.
2168-
The maximum value is the lesser of `--secure-heap` or `2147483647`.
2169-
The value given must be a power of two.
2170-
21712171
### `--snapshot-blob=path`
21722172

21732173
<!-- YAML
@@ -2878,11 +2878,6 @@ and `NODE_DISABLE_COLORS` environment variables are ignored.
28782878

28792879
Any other value will result in colorized output being disabled.
28802880

2881-
### `NO_COLOR=<any>`
2882-
2883-
[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the
2884-
environment variable is arbitrary.
2885-
28862881
### `NODE_COMPILE_CACHE=dir`
28872882

28882883
<!-- YAML
@@ -3288,6 +3283,11 @@ easier to instrument applications that call the `child_process.spawn()` family
32883283
of functions. `NODE_V8_COVERAGE` can be set to an empty string, to prevent
32893284
propagation.
32903285

3286+
### `NO_COLOR=<any>`
3287+
3288+
[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the
3289+
environment variable is arbitrary.
3290+
32913291
#### Coverage output
32923292

32933293
Coverage is output as an array of [ScriptCoverage][] objects on the top-level
@@ -3472,19 +3472,9 @@ documented here:
34723472

34733473
### `--harmony-shadow-realm`
34743474

3475-
### `--jitless`
3476-
34773475
### `--interpreted-frames-native-stack`
34783476

3479-
### `--prof`
3480-
3481-
### `--perf-basic-prof`
3482-
3483-
### `--perf-basic-prof-only-functions`
3484-
3485-
### `--perf-prof`
3486-
3487-
### `--perf-prof-unwinding-info`
3477+
### `--jitless`
34883478

34893479
<!-- Anchor to make sure old links find a target -->
34903480

@@ -3536,6 +3526,16 @@ for MiB in 16 32 64 128; do
35363526
done
35373527
```
35383528

3529+
### `--perf-basic-prof`
3530+
3531+
### `--perf-basic-prof-only-functions`
3532+
3533+
### `--perf-prof`
3534+
3535+
### `--perf-prof-unwinding-info`
3536+
3537+
### `--prof`
3538+
35393539
### `--security-revert`
35403540

35413541
### `--stack-trace-limit=limit`

test/parallel/test-cli-node-options-docs.js

+15
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@ for (const [, envVar, config] of nodeOptionsCC.matchAll(addOptionRE)) {
123123
}
124124
}
125125

126+
{
127+
const sections = /^## (.+)$/mg;
128+
const cliOptionPattern = /^### (?:`-\w.*`, )?`([^`]+)`/mg;
129+
let match;
130+
let previousIndex = 0;
131+
do {
132+
const sectionTitle = match?.[1];
133+
match = sections.exec(cliText);
134+
const filteredCLIText = cliText.slice(previousIndex, match?.index);
135+
const options = Array.from(filteredCLIText.matchAll(cliOptionPattern), (match) => match[1]);
136+
assert.deepStrictEqual(options, options.toSorted(), `doc/api/cli.md ${sectionTitle} subsections are not in alphabetical order`);
137+
previousIndex = match?.index;
138+
} while (match);
139+
}
140+
126141
// add alias handling
127142
manPagesOptions.delete('-trace-events-enabled');
128143

0 commit comments

Comments
 (0)