Skip to content

Commit 556f1ae

Browse files
aduh95RedYetiDev
and
RedYetiDev
committed
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 c4aa34a commit 556f1ae

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
@@ -794,6 +775,15 @@ node --entry-url --experimental-strip-types 'file.ts?query#hash'
794775
node --entry-url 'data:text/javascript,console.log("Hello")'
795776
```
796777

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

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

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

875856
<!-- YAML
@@ -893,17 +874,6 @@ and `"` are usable.
893874
It is possible to run code containing inline types by passing
894875
[`--experimental-strip-types`][].
895876

896-
### `--experimental-transform-types`
897-
898-
<!-- YAML
899-
added: v22.7.0
900-
-->
901-
902-
> Stability: 1.1 - Active development
903-
904-
Enables the transformation of TypeScript-only syntax into JavaScript code.
905-
Implies `--experimental-strip-types` and `--enable-source-maps`.
906-
907877
### `--experimental-eventsource`
908878

909879
<!-- YAML
@@ -983,6 +953,18 @@ following permissions are restricted:
983953
* WASI - manageable through [`--allow-wasi`][] flag
984954
* Addons - manageable through [`--allow-addons`][] flag
985955

956+
### `--experimental-print-required-tla`
957+
958+
<!-- YAML
959+
added:
960+
- v22.0.0
961+
- v20.17.0
962+
-->
963+
964+
If the ES module being `require()`'d contains top-level `await`, this flag
965+
allows Node.js to evaluate the module, try to locate the
966+
top-level awaits, and print their location to help users find them.
967+
986968
### `--experimental-require-module`
987969

988970
<!-- YAML
@@ -1081,6 +1063,17 @@ added:
10811063
10821064
Enable module mocking in the test runner.
10831065

1066+
### `--experimental-transform-types`
1067+
1068+
<!-- YAML
1069+
added: v22.7.0
1070+
-->
1071+
1072+
> Stability: 1.1 - Active development
1073+
1074+
Enables the transformation of TypeScript-only syntax into JavaScript code.
1075+
Implies `--experimental-strip-types` and `--enable-source-maps`.
1076+
10841077
### `--experimental-vm-modules`
10851078

10861079
<!-- YAML
@@ -1126,6 +1119,25 @@ added: v22.4.0
11261119

11271120
Enable experimental [`Web Storage`][] support.
11281121

1122+
### `--expose-gc`
1123+
1124+
<!-- YAML
1125+
added:
1126+
- v22.3.0
1127+
- v20.18.0
1128+
-->
1129+
1130+
> Stability: 1 - Experimental. This flag is inherited from V8 and is subject to
1131+
> change upstream.
1132+
1133+
This flag will expose the gc extension from V8.
1134+
1135+
```js
1136+
if (globalThis.gc) {
1137+
globalThis.gc();
1138+
}
1139+
```
1140+
11291141
### `--force-context-aware`
11301142

11311143
<!-- YAML
@@ -1404,20 +1416,6 @@ When enabled, the parser will accept the following:
14041416
All the above will expose your application to request smuggling
14051417
or poisoning attack. Avoid using this option.
14061418

1407-
### `--inspect[=[host:]port]`
1408-
1409-
<!-- YAML
1410-
added: v6.3.0
1411-
-->
1412-
1413-
Activate inspector on `host:port`. Default is `127.0.0.1:9229`. If port `0` is
1414-
specified, a random available port will be used.
1415-
1416-
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
1417-
and profile Node.js instances. The tools attach to Node.js instances via a
1418-
tcp port and communicate using the [Chrome DevTools Protocol][].
1419-
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
1420-
14211419
<!-- Anchor to make sure old links find a target -->
14221420

14231421
<a id="inspector_security"></a>
@@ -1486,6 +1484,20 @@ a random available port will be used.
14861484

14871485
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
14881486

1487+
### `--inspect[=[host:]port]`
1488+
1489+
<!-- YAML
1490+
added: v6.3.0
1491+
-->
1492+
1493+
Activate inspector on `host:port`. Default is `127.0.0.1:9229`. If port `0` is
1494+
specified, a random available port will be used.
1495+
1496+
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
1497+
and profile Node.js instances. The tools attach to Node.js instances via a
1498+
tcp port and communicate using the [Chrome DevTools Protocol][].
1499+
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
1500+
14891501
### `-i`, `--interactive`
14901502

14911503
<!-- YAML
@@ -1848,18 +1860,6 @@ changes:
18481860

18491861
Identical to `-e` but prints the result.
18501862

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

18651865
<!-- YAML
@@ -2135,6 +2135,17 @@ The following environment variables are set when running a script with `--run`:
21352135
* `NODE_RUN_PACKAGE_JSON_PATH`: The path to the `package.json` that is being
21362136
processed.
21372137

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

21402151
<!-- YAML
@@ -2160,17 +2171,6 @@ The secure heap is not available on Windows.
21602171

21612172
See [`CRYPTO_secure_malloc_init`][] for more details.
21622173

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

21762176
<!-- YAML
@@ -2881,11 +2881,6 @@ and `NODE_DISABLE_COLORS` environment variables are ignored.
28812881

28822882
Any other value will result in colorized output being disabled.
28832883

2884-
### `NO_COLOR=<any>`
2885-
2886-
[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the
2887-
environment variable is arbitrary.
2888-
28892884
### `NODE_COMPILE_CACHE=dir`
28902885

28912886
<!-- YAML
@@ -3291,6 +3286,11 @@ easier to instrument applications that call the `child_process.spawn()` family
32913286
of functions. `NODE_V8_COVERAGE` can be set to an empty string, to prevent
32923287
propagation.
32933288

3289+
### `NO_COLOR=<any>`
3290+
3291+
[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the
3292+
environment variable is arbitrary.
3293+
32943294
#### Coverage output
32953295

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

34763476
### `--harmony-shadow-realm`
34773477

3478-
### `--jitless`
3479-
34803478
### `--interpreted-frames-native-stack`
34813479

3482-
### `--prof`
3483-
3484-
### `--perf-basic-prof`
3485-
3486-
### `--perf-basic-prof-only-functions`
3487-
3488-
### `--perf-prof`
3489-
3490-
### `--perf-prof-unwinding-info`
3480+
### `--jitless`
34913481

34923482
<!-- Anchor to make sure old links find a target -->
34933483

@@ -3539,6 +3529,16 @@ for MiB in 16 32 64 128; do
35393529
done
35403530
```
35413531

3532+
### `--perf-basic-prof`
3533+
3534+
### `--perf-basic-prof-only-functions`
3535+
3536+
### `--perf-prof`
3537+
3538+
### `--perf-prof-unwinding-info`
3539+
3540+
### `--prof`
3541+
35423542
### `--security-revert`
35433543

35443544
### `--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)