Skip to content

Commit 5b4a6fb

Browse files
aduh95avivkeller
andcommitted
test: ensure cli.md is in alphabetical order
Co-authored-by: RedYetiDev <[email protected]>
1 parent 585f7bc commit 5b4a6fb

File tree

2 files changed

+119
-104
lines changed

2 files changed

+119
-104
lines changed

doc/api/cli.md

Lines changed: 104 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,18 @@ Affects the default output directory of:
556556
* [`--heap-prof-dir`][]
557557
* [`--redirect-warnings`][]
558558

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

561573
> Stability: 1.1 - Active development
@@ -650,18 +662,6 @@ users can at least run WebAssembly (with less optimal performance)
650662
when the virtual memory address space available to their Node.js
651663
process is lower than what the V8 WebAssembly memory cage needs.
652664

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

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

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

696677
<!-- YAML
@@ -797,6 +778,15 @@ node --entry-url --experimental-strip-types 'file.ts?query#hash'
797778
node --entry-url 'data:text/javascript,console.log("Hello")'
798779
```
799780

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

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

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

878859
<!-- YAML
@@ -928,17 +909,6 @@ files with no extension will be treated as WebAssembly if they begin with the
928909
WebAssembly magic number (`\0asm`); otherwise they will be treated as ES module
929910
JavaScript.
930911

931-
### `--experimental-transform-types`
932-
933-
<!-- YAML
934-
added: v22.7.0
935-
-->
936-
937-
> Stability: 1.1 - Active development
938-
939-
Enables the transformation of TypeScript-only syntax into JavaScript code.
940-
Implies `--experimental-strip-types` and `--enable-source-maps`.
941-
942912
### `--experimental-eventsource`
943913

944914
<!-- YAML
@@ -1018,6 +988,18 @@ following permissions are restricted:
1018988
* WASI - manageable through [`--allow-wasi`][] flag
1019989
* Addons - manageable through [`--allow-addons`][] flag
1020990

991+
### `--experimental-print-required-tla`
992+
993+
<!-- YAML
994+
added:
995+
- v22.0.0
996+
- v20.17.0
997+
-->
998+
999+
If the ES module being `require()`'d contains top-level `await`, this flag
1000+
allows Node.js to evaluate the module, try to locate the
1001+
top-level awaits, and print their location to help users find them.
1002+
10211003
### `--experimental-require-module`
10221004

10231005
<!-- YAML
@@ -1114,6 +1096,17 @@ added:
11141096
11151097
Enable module mocking in the test runner.
11161098

1099+
### `--experimental-transform-types`
1100+
1101+
<!-- YAML
1102+
added: v22.7.0
1103+
-->
1104+
1105+
> Stability: 1.1 - Active development
1106+
1107+
Enables the transformation of TypeScript-only syntax into JavaScript code.
1108+
Implies `--experimental-strip-types` and `--enable-source-maps`.
1109+
11171110
### `--experimental-vm-modules`
11181111

11191112
<!-- YAML
@@ -1159,6 +1152,25 @@ added: v22.4.0
11591152

11601153
Enable experimental [`Web Storage`][] support.
11611154

1155+
### `--expose-gc`
1156+
1157+
<!-- YAML
1158+
added:
1159+
- v22.3.0
1160+
- v20.18.0
1161+
-->
1162+
1163+
> Stability: 1 - Experimental. This flag is inherited from V8 and is subject to
1164+
> change upstream.
1165+
1166+
This flag will expose the gc extension from V8.
1167+
1168+
```js
1169+
if (globalThis.gc) {
1170+
globalThis.gc();
1171+
}
1172+
```
1173+
11621174
### `--force-context-aware`
11631175

11641176
<!-- YAML
@@ -1437,20 +1449,6 @@ When enabled, the parser will accept the following:
14371449
All the above will expose your application to request smuggling
14381450
or poisoning attack. Avoid using this option.
14391451

1440-
### `--inspect[=[host:]port]`
1441-
1442-
<!-- YAML
1443-
added: v6.3.0
1444-
-->
1445-
1446-
Activate inspector on `host:port`. Default is `127.0.0.1:9229`. If port `0` is
1447-
specified, a random available port will be used.
1448-
1449-
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
1450-
and profile Node.js instances. The tools attach to Node.js instances via a
1451-
tcp port and communicate using the [Chrome DevTools Protocol][].
1452-
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
1453-
14541452
<!-- Anchor to make sure old links find a target -->
14551453

14561454
<a id="inspector_security"></a>
@@ -1519,6 +1517,20 @@ a random available port will be used.
15191517

15201518
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
15211519

1520+
### `--inspect[=[host:]port]`
1521+
1522+
<!-- YAML
1523+
added: v6.3.0
1524+
-->
1525+
1526+
Activate inspector on `host:port`. Default is `127.0.0.1:9229`. If port `0` is
1527+
specified, a random available port will be used.
1528+
1529+
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
1530+
and profile Node.js instances. The tools attach to Node.js instances via a
1531+
tcp port and communicate using the [Chrome DevTools Protocol][].
1532+
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
1533+
15221534
### `-i`, `--interactive`
15231535

15241536
<!-- YAML
@@ -1879,18 +1891,6 @@ changes:
18791891

18801892
Identical to `-e` but prints the result.
18811893

1882-
### `--experimental-print-required-tla`
1883-
1884-
<!-- YAML
1885-
added:
1886-
- v22.0.0
1887-
- v20.17.0
1888-
-->
1889-
1890-
If the ES module being `require()`'d contains top-level `await`, this flag
1891-
allows Node.js to evaluate the module, try to locate the
1892-
top-level awaits, and print their location to help users find them.
1893-
18941894
### `--prof`
18951895

18961896
<!-- YAML
@@ -2166,6 +2166,17 @@ The following environment variables are set when running a script with `--run`:
21662166
* `NODE_RUN_PACKAGE_JSON_PATH`: The path to the `package.json` that is being
21672167
processed.
21682168

2169+
### `--secure-heap-min=n`
2170+
2171+
<!-- YAML
2172+
added: v15.6.0
2173+
-->
2174+
2175+
When using `--secure-heap`, the `--secure-heap-min` flag specifies the
2176+
minimum allocation from the secure heap. The minimum value is `2`.
2177+
The maximum value is the lesser of `--secure-heap` or `2147483647`.
2178+
The value given must be a power of two.
2179+
21692180
### `--secure-heap=n`
21702181

21712182
<!-- YAML
@@ -2191,17 +2202,6 @@ The secure heap is not available on Windows.
21912202

21922203
See [`CRYPTO_secure_malloc_init`][] for more details.
21932204

2194-
### `--secure-heap-min=n`
2195-
2196-
<!-- YAML
2197-
added: v15.6.0
2198-
-->
2199-
2200-
When using `--secure-heap`, the `--secure-heap-min` flag specifies the
2201-
minimum allocation from the secure heap. The minimum value is `2`.
2202-
The maximum value is the lesser of `--secure-heap` or `2147483647`.
2203-
The value given must be a power of two.
2204-
22052205
### `--snapshot-blob=path`
22062206

22072207
<!-- YAML
@@ -2912,11 +2912,6 @@ and `NODE_DISABLE_COLORS` environment variables are ignored.
29122912

29132913
Any other value will result in colorized output being disabled.
29142914

2915-
### `NO_COLOR=<any>`
2916-
2917-
[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the
2918-
environment variable is arbitrary.
2919-
29202915
### `NODE_COMPILE_CACHE=dir`
29212916

29222917
<!-- YAML
@@ -3323,6 +3318,11 @@ easier to instrument applications that call the `child_process.spawn()` family
33233318
of functions. `NODE_V8_COVERAGE` can be set to an empty string, to prevent
33243319
propagation.
33253320

3321+
### `NO_COLOR=<any>`
3322+
3323+
[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the
3324+
environment variable is arbitrary.
3325+
33263326
#### Coverage output
33273327

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

35083508
### `--harmony-shadow-realm`
35093509

3510-
### `--jitless`
3511-
35123510
### `--interpreted-frames-native-stack`
35133511

3514-
### `--prof`
3515-
3516-
### `--perf-basic-prof`
3517-
3518-
### `--perf-basic-prof-only-functions`
3519-
3520-
### `--perf-prof`
3521-
3522-
### `--perf-prof-unwinding-info`
3512+
### `--jitless`
35233513

35243514
<!-- Anchor to make sure old links find a target -->
35253515

@@ -3571,6 +3561,16 @@ for MiB in 16 32 64 128; do
35713561
done
35723562
```
35733563

3564+
### `--perf-basic-prof`
3565+
3566+
### `--perf-basic-prof-only-functions`
3567+
3568+
### `--perf-prof`
3569+
3570+
### `--perf-prof-unwinding-info`
3571+
3572+
### `--prof`
3573+
35743574
### `--security-revert`
35753575

35763576
### `--stack-trace-limit=limit`

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

Lines changed: 15 additions & 0 deletions
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)