镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Commit 3febbc5

Browse files
committed
Revert "build, doc: move to redesign"
This reverts commit 4f84c4b.
1 parent 2dc4638 commit 3febbc5

10 files changed

Lines changed: 786 additions & 1400 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ updates:
5858
semver-minor-days: 5
5959
semver-patch-days: 5
6060
exclude:
61-
- '@doc-kit/*'
62-
- '@node-core/*'
61+
- '@node-core/doc-kit'
6362
commit-message:
6463
prefix: tools
6564
open-pull-requests-limit: 10

‎.github/workflows/build-tarball.yml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ env:
6767
PYTHON_VERSION: '3.14'
6868
FLAKY_TESTS: keep_retrying
6969
CLANG_VERSION: '19'
70-
NODE_VERSION: lts/*
7170

7271
permissions:
7372
contents: read
@@ -85,10 +84,6 @@ jobs:
8584
with:
8685
python-version: ${{ env.PYTHON_VERSION }}
8786
allow-prereleases: true
88-
- name: Use Node.js ${{ env.NODE_VERSION }}
89-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
90-
with:
91-
node-version: ${{ env.NODE_VERSION }}
9287
- name: Make tarball
9388
run: |
9489
export DISTTYPE=nightly

‎Makefile‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ ifeq ($(OSTYPE),os400)
402402
DOCBUILDSTAMP_PREREQS := $(DOCBUILDSTAMP_PREREQS) out/$(BUILDTYPE)/node.exp
403403
endif
404404

405-
DOC_KIT ?= tools/doc/node_modules/@doc-kit/cli/bin/cli.mjs
405+
DOC_KIT ?= tools/doc/node_modules/@node-core/doc-kit/bin/cli.mjs
406406

407407
node_use_openssl_and_icu = $(call available-node,"-p" \
408408
"process.versions.openssl != undefined && process.versions.icu != undefined")
@@ -871,7 +871,7 @@ VERSION=v$(RAWVER)
871871

872872
.PHONY: doc-only
873873
.NOTPARALLEL: doc-only
874-
doc-only: $(apidoc_dirs) $(apidocs_html) $(apidocs_json) out/doc/api/all.json out/doc/llms.txt out/doc/apilinks.json ## Builds the docs with the local or the global Node.js binary.
874+
doc-only: $(apidoc_dirs) $(apidocs_html) $(apidocs_json) out/doc/api/all.html out/doc/api/all.json out/doc/llms.txt out/doc/apilinks.json ## Builds the docs with the local or the global Node.js binary.
875875

876876
.PHONY: doc
877877
doc: $(NODE_EXE) doc-only ## Build Node.js, and then build the documentation with the new binary.
@@ -908,10 +908,15 @@ $(apidocs_html) $(apidocs_json) out/doc/api/all.html out/doc/api/all.json &: $(a
908908
else \
909909
$(call available-node, \
910910
$(DOC_KIT) generate \
911-
--log-level debug \
912-
--config-file tools/doc/web.doc-kit.config.mjs \
911+
-t legacy-html-all \
912+
-t legacy-json-all \
913+
-i doc/api/*.md \
914+
--ignore $(skip_apidoc_files) \
915+
-o out/doc/api \
916+
-c ./CHANGELOG.md \
913917
-v $(VERSION) \
914-
$(if $(JOBS),-p $(JOBS)) \
918+
--index doc/api/index.md \
919+
--type-map doc/type-map.json \
915920
) \
916921
fi
917922
endif
@@ -922,10 +927,13 @@ out/doc/llms.txt: $(apidoc_sources) tools/doc/node_modules | out/doc
922927
else \
923928
$(call available-node, \
924929
$(DOC_KIT) generate \
925-
--config-file tools/doc/web.doc-kit.config.mjs \
926930
-t llms-txt \
931+
-i doc/api/*.md \
932+
--ignore $(skip_apidoc_files) \
927933
-o $(@D) \
934+
-c ./CHANGELOG.md \
928935
-v $(VERSION) \
936+
--type-map doc/type-map.json \
929937
) \
930938
fi
931939

@@ -935,9 +943,12 @@ out/doc/apilinks.json: $(wildcard lib/*.js) tools/doc/node_modules | out/doc
935943
else \
936944
$(call available-node, \
937945
$(DOC_KIT) generate \
938-
--config-file tools/doc/api-links.doc-kit.config.mjs \
946+
-t api-links \
947+
-i lib/*.js \
939948
-o $(@D) \
949+
-c ./CHANGELOG.md \
940950
-v $(VERSION) \
951+
--type-map doc/type-map.json \
941952
) \
942953
fi
943954

‎doc/node.1‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.\"
2-
.\" This file was generated automatically by Node.js's doc-kit tool.
2+
.\" This file was generated automatically by the @node-core/doc-kit tool.
33
.\" Please do not edit this file manually. Make any updates to cli.md
44
.\" and regenerate the file afterward.
55
.\"
6-
.\" To regenerate this file, run `make node.1`.
6+
.\" To regenerate this file, run `make doc/node.1`.
77
.\"
88
.\"======================================================================
99
.Dd $Mdocdate$
@@ -236,7 +236,7 @@ Error: connect ERR_ACCESS_DENIED Access to this API has been restricted. Use --a
236236
.It Fl -allow-openssl-store
237237
When using the Permission Model, the process will not be able to use
238238
OpenSSL STORE loaders by default, for example to load a private key from a
239-
\fB{URL}\fR passed to \fBcrypto.createPrivateKey()\fR. Attempts to do so will throw
239+
\fB<URL>\fR passed to \fBcrypto.createPrivateKey()\fR. Attempts to do so will throw
240240
an \fBERR_ACCESS_DENIED\fR unless the user explicitly passes the
241241
\fB--allow-openssl-store\fR flag. This permission can be dropped at runtime via
242242
\fBpermission.drop()\fR.
@@ -408,11 +408,11 @@ creation behavior.
408408
The following options are currently supported:
409409
.Bl -bullet
410410
.It
411-
\fBbuilder\fR \fB{string}\fR Required. Provides the name to the script that is executed
412-
before building the snapshot, as if \fB--build-snapshot\fR had been passed
411+
\fBbuilder\fR \fB<string>\fR Required. Provides the name to the script that is executed
412+
before building the snapshot, as if \fB--build-snapshot\fR had been passed
413413
with \fBbuilder\fR as the main script name.
414414
.It
415-
\fBwithoutCodeCache\fR \fB{boolean}\fR Optional. Including the code cache reduces the
415+
\fBwithoutCodeCache\fR \fB<boolean>\fR Optional. Including the code cache reduces the
416416
time spent on compiling functions included in the snapshot at the expense
417417
of a bigger snapshot size and potentially breaking portability of the
418418
snapshot.
@@ -1201,7 +1201,7 @@ Legacy alias for \fB--no-require-module\fR.
12011201
Disable the experimental \fBnode:sqlite\fR module.
12021202
.
12031203
.It Fl -no-experimental-websocket
1204-
Disable exposition of \fB{WebSocket}\fR on the global scope.
1204+
Disable exposition of \fB<WebSocket>\fR on the global scope.
12051205
.
12061206
.It Fl -no-experimental-webstorage
12071207
Disable \fBWeb Storage\fR support.
@@ -1939,7 +1939,7 @@ Print node's version.
19391939
.It Fl -vfs-load Ns = Ns Ar source
19401940
.Bl -bullet
19411941
.It
1942-
\fBsource\fR \fB{string}\fR A directory or an archive file to mount and run.
1942+
\fBsource\fR \fB<string>\fR A directory or an archive file to mount and run.
19431943
.El
19441944
Requires \fB--experimental-vfs\fR. May be given at most once.
19451945
Mounts \fBsource\fR as a virtual file system (\fBnode:vfs\fR), and runs the entry

‎test/doctool/test-make-doc.mjs‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import * as common from '../common/index.mjs';
2+
3+
import assert from 'assert';
4+
import fs from 'fs';
5+
import path from 'path';
6+
7+
if (common.isWindows) {
8+
common.skip('`make doc` does not run on Windows');
9+
}
10+
11+
// This tests that `make doc` generates the documentation properly.
12+
// Note that for this test to pass, `make doc` must be run first.
13+
14+
const apiURL = new URL('../../out/doc/api/', import.meta.url);
15+
const mdURL = new URL('../../doc/api/', import.meta.url);
16+
const allMD = fs.readdirSync(mdURL);
17+
const allDocs = fs.readdirSync(apiURL);
18+
assert.ok(allDocs.includes('index.html'));
19+
20+
const actualDocs = allDocs.filter(
21+
(name) => {
22+
const extension = path.extname(name);
23+
return extension === '.html' || extension === '.json';
24+
},
25+
);
26+
27+
for (const name of actualDocs) {
28+
if (name.startsWith('all.') || name === 'apilinks.json') continue;
29+
30+
assert.ok(
31+
allMD.includes(name.replace(/\.\w+$/, '.md')),
32+
`Unexpected output: out/doc/api/${name}, remove and rerun.`,
33+
);
34+
}
35+
36+
const toc = fs.readFileSync(new URL('./index.html', apiURL), 'utf8');
37+
const re = /href=("([^/]+\.html)"|([^/]+\.html))/;
38+
const globalRe = new RegExp(re, 'g');
39+
const links = toc.match(globalRe);
40+
assert.notStrictEqual(links, null);
41+
42+
// Filter out duplicate links, leave just filenames, add expected JSON files.
43+
const linkedHtmls = [...new Set(links)].map((link) => link.match(re)[1])
44+
.concat(['index.html']);
45+
const expectedJsons = linkedHtmls
46+
.map((name) => name.replace('.html', '.json'));
47+
const expectedDocs = linkedHtmls.concat(expectedJsons);
48+
const renamedDocs = ['policy.json', 'policy.html'];
49+
const skipedDocs = ['dtls.json', 'dtls.html', 'quic.json', 'quic.html'];
50+
51+
// Test that all the relative links in the TOC match to the actual documents.
52+
for (const expectedDoc of expectedDocs) {
53+
if (skipedDocs.includes(expectedDoc)) continue;
54+
assert.ok(actualDocs.includes(expectedDoc), `${expectedDoc} does not exist`);
55+
}
56+
57+
// Test that all the actual documents match to the relative links in the TOC
58+
// and that they are not empty files.
59+
for (const actualDoc of actualDocs) {
60+
// When renaming the documentation, the old url is lost
61+
// Unless the old file is still available pointing to the correct location
62+
// 301 redirects are not yet automated. So keeping the old URL is a
63+
// reasonable workaround.
64+
if (renamedDocs.includes(actualDoc) || skipedDocs.includes(actualDoc) ||
65+
actualDoc === 'apilinks.json') continue;
66+
assert.ok(
67+
expectedDocs.includes(actualDoc), `${actualDoc} does not match TOC`);
68+
69+
assert.notStrictEqual(
70+
fs.statSync(new URL(`./${actualDoc}`, apiURL)).size,
71+
0,
72+
`${actualDoc} is empty`,
73+
);
74+
}

‎tools/doc/api-links.doc-kit.config.mjs‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)