Skip to content

Commit a67d9a7

Browse files
avivkellerrichardlau
authored andcommitted
build: allow linting node.1
Signed-off-by: avivkeller <me@aviv.sh> PR-URL: #64157 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 6d14279 commit a67d9a7

4 files changed

Lines changed: 263 additions & 235 deletions

File tree

Makefile

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,22 @@ out/doc/apilinks.json: $(wildcard lib/*.js) tools/doc/node_modules | out/doc
932932
) \
933933
fi
934934

935+
doc/node.1:
936+
$(error Please use 'make node.1' instead of 'make $@'.)
937+
938+
.PHONY: node.1
939+
node.1: doc/api/cli.md tools/doc/node_modules
940+
@if [ "$(shell $(node_use_openssl_and_icu))" != "true" ]; then \
941+
echo "Skipping $@ (no crypto and/or no ICU)"; \
942+
else \
943+
$(call available-node, \
944+
$(DOC_KIT) generate \
945+
-v $(VERSION) \
946+
--config-file tools/doc/man-page.doc-kit.config.mjs \
947+
-o doc \
948+
) \
949+
fi
950+
935951
.PHONY: docopen
936952
docopen: doc-only ## Open the documentation in a web browser.
937953
@$(PYTHON) -mwebbrowser file://$(abspath $<)
@@ -1480,8 +1496,26 @@ tools/.mdlintstamp: tools/lint-md/node_modules/remark-parse/package.json $(LINT_
14801496
@$(call available-node,$(run-lint-md))
14811497
@touch $@
14821498

1499+
tools/.manpagelintstamp: doc/node.1 doc/api/cli.md tools/doc/node_modules
1500+
$(info Verifying that $< is up to date...)
1501+
@if [ "$(shell $(node_use_openssl_and_icu))" != "true" ]; then \
1502+
echo "Skipping $< verification (no crypto and/or no ICU)"; \
1503+
else \
1504+
$(RM) -r tools/doc/.manpagecheck && \
1505+
$(call available-node, \
1506+
$(DOC_KIT) generate \
1507+
-v $(VERSION) \
1508+
--config-file tools/doc/man-page.doc-kit.config.mjs \
1509+
) \
1510+
if ! diff -u $< tools/doc/.manpagecheck/node.1; then \
1511+
echo '$< is out of date; run `make node.1` to regenerate it.' >&2; \
1512+
exit 1; \
1513+
fi; \
1514+
fi
1515+
@touch $@
1516+
14831517
.PHONY: lint-md
1484-
lint-md: lint-js-doc | tools/.mdlintstamp ## Lint the markdown documents maintained by us in the codebase.
1518+
lint-md: lint-js-doc | tools/.mdlintstamp tools/.manpagelintstamp ## Lint the markdown documents maintained by us in the codebase.
14851519

14861520
run-format-md = tools/lint-md/lint-md.mjs --format $(LINT_MD_FILES)
14871521
.PHONY: format-md

doc/node.1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ The valid arguments for the \fB--allow-fs-read\fR flag are:
147147
\fB*\fR - To allow all \fBFileSystemRead\fR operations.
148148
.It
149149
Multiple paths can be allowed using multiple \fB--allow-fs-read\fR flags.
150-
Example \fB--allow-fs-read=/folder1/ --allow-fs-read=/folder1/\fR
150+
Example \fB--allow-fs-read=/folder1/ --allow-fs-read=/folder2/\fR
151151
.El
152152
Examples can be found in the File System Permissions documentation.
153153
The initializer module and custom \fB--require\fR modules has a implicit
@@ -175,7 +175,7 @@ The valid arguments for the \fB--allow-fs-write\fR flag are:
175175
\fB*\fR - To allow all \fBFileSystemWrite\fR operations.
176176
.It
177177
Multiple paths can be allowed using multiple \fB--allow-fs-write\fR flags.
178-
Example \fB--allow-fs-write=/folder1/ --allow-fs-write=/folder1/\fR
178+
Example \fB--allow-fs-write=/folder1/ --allow-fs-write=/folder2/\fR
179179
.El
180180
Paths delimited by comma (\fB,\fR) are no longer allowed.
181181
When passing a single flag with a comma a warning will be displayed.
@@ -742,7 +742,8 @@ passing a second \fBparentURL\fR argument for contextual resolution.
742742
Previously gated the entire \fBimport.meta.resolve\fR feature.
743743
.
744744
.It Fl -experimental-import-text
745-
Enable experimental support for importing modules with \fBwith { type: 'text' }\fR.
745+
Enable experimental support for importing modules with
746+
\fBwith { type: 'text' }\fR.
746747
.
747748
.It Fl -experimental-inspector-network-resource
748749
Enable experimental support for inspector network resources.
@@ -767,9 +768,8 @@ See Package maps for details on the configuration file format and
767768
resolution algorithm.
768769
.
769770
.It Fl -experimental-print-required-tla
770-
If the ES module being \fBrequire()\fR'd contains top-level \fBawait\fR, this flag
771-
allows Node.js to evaluate the module, try to locate the
772-
top-level awaits, and print their location to help users find them.
771+
If the ES module graph cannot be \fBrequire()\fR'd because it contains any top-level \fBawait\fR,
772+
this flag allows Node.js to locate and print their locations.
773773
.
774774
.It Fl -experimental-quic
775775
Enable experimental support for the QUIC protocol.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// @node-core/doc-kit configuration for generating and linting the Node.js
2+
// man-page (doc/node.1).
3+
4+
import { fileURLToPath } from 'node:url';
5+
6+
const root = new URL('../../', import.meta.url);
7+
8+
const fromRoot = (path) => fileURLToPath(new URL(path, root));
9+
10+
export default {
11+
target: ['man-page'],
12+
13+
global: {
14+
input: [fromRoot('doc/api/cli.md')],
15+
output: fromRoot('tools/doc/.manpagecheck'),
16+
17+
// Point every loadable URL at its local file so no network request is made.
18+
changelog: fromRoot('CHANGELOG.md'),
19+
index: fromRoot('doc/api/index.md'),
20+
},
21+
};

0 commit comments

Comments
 (0)