From b0d214bf67ad1701009b58c699a00b27c9f390ae Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 5 Dec 2021 15:49:57 +0000 Subject: [PATCH] build: skip documentation generation if no ICU Closes: https://github.com/nodejs/node/issues/41077 --- Makefile | 26 ++++++++++++++++++++++---- tools/doc/package-lock.json | 14 +++++++------- tools/doc/package.json | 2 +- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 827d401cbfcd26..97da1c0192dfdc 100644 --- a/Makefile +++ b/Makefile @@ -737,21 +737,39 @@ $(LINK_DATA): $(wildcard lib/*.js) tools/doc/apilinks.mjs | out/doc $(VERSIONS_DATA): CHANGELOG.md src/node_version.h tools/doc/versions.mjs $(call available-node, tools/doc/versions.mjs $@) +node_use_icu = $(call available-node,"-p" "process.versions.icu != undefined") + out/doc/api/%.json out/doc/api/%.html: doc/api/%.md tools/doc/generate.mjs \ tools/doc/markdown.mjs tools/doc/html.mjs tools/doc/json.mjs \ tools/doc/apilinks.mjs $(VERSIONS_DATA) | $(LINK_DATA) out/doc/api - $(call available-node, $(gen-api)) + @if [ "$(shell $(node_use_icu))" != "true" ]; then \ + echo "Skipping documentation generation (no ICU)"; \ + else \ + $(call available-node, $(gen-api)) \ + fi out/doc/api/all.html: $(apidocs_html) tools/doc/allhtml.mjs \ tools/doc/apilinks.mjs | out/doc/api - $(call available-node, tools/doc/allhtml.mjs) + @if [ "$(shell $(node_use_icu))" != "true" ]; then \ + echo "Skipping HTML single-page doc generation (no ICU)"; \ + else \ + $(call available-node, tools/doc/allhtml.mjs) \ + fi out/doc/api/all.json: $(apidocs_json) tools/doc/alljson.mjs | out/doc/api - $(call available-node, tools/doc/alljson.mjs) + @if [ "$(shell $(node_use_icu))" != "true" ]; then \ + echo "Skipping JSON single-file generation (no ICU)"; \ + else \ + $(call available-node, tools/doc/alljson.mjs) \ + fi .PHONY: out/doc/api/stability out/doc/api/stability: out/doc/api/all.json tools/doc/stability.mjs | out/doc/api - $(call available-node, tools/doc/stability.mjs) + @if [ "$(shell $(node_use_icu))" != "true" ]; then \ + echo "Skipping stability indicator generation (no ICU)"; \ + else \ + $(call available-node, tools/doc/stability.mjs) \ + fi .PHONY: docopen docopen: out/doc/api/all.html diff --git a/tools/doc/package-lock.json b/tools/doc/package-lock.json index 96140510b9cec3..12b382a191d106 100644 --- a/tools/doc/package-lock.json +++ b/tools/doc/package-lock.json @@ -11,7 +11,7 @@ "node-doc-generator": "generate.js" }, "devDependencies": { - "highlight.js": "^11.2.0", + "highlight.js": "^11.3.1", "js-yaml": "^4.1.0", "rehype-raw": "^6.1.0", "rehype-stringify": "^9.0.2", @@ -413,9 +413,9 @@ } }, "node_modules/highlight.js": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.2.0.tgz", - "integrity": "sha512-JOySjtOEcyG8s4MLR2MNbLUyaXqUunmSnL2kdV/KuGJOmHZuAR5xC54Ko7goAXBWNhf09Vy3B+U7vR62UZ/0iw==", + "version": "11.3.1", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.3.1.tgz", + "integrity": "sha512-PUhCRnPjLtiLHZAQ5A/Dt5F8cWZeMyj9KRsACsWT+OD6OP0x6dp5OmT5jdx0JgEyPxPZZIPQpRN2TciUT7occw==", "dev": true, "engines": { "node": ">=12.0.0" @@ -2124,9 +2124,9 @@ } }, "highlight.js": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.2.0.tgz", - "integrity": "sha512-JOySjtOEcyG8s4MLR2MNbLUyaXqUunmSnL2kdV/KuGJOmHZuAR5xC54Ko7goAXBWNhf09Vy3B+U7vR62UZ/0iw==", + "version": "11.3.1", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.3.1.tgz", + "integrity": "sha512-PUhCRnPjLtiLHZAQ5A/Dt5F8cWZeMyj9KRsACsWT+OD6OP0x6dp5OmT5jdx0JgEyPxPZZIPQpRN2TciUT7occw==", "dev": true }, "html-void-elements": { diff --git a/tools/doc/package.json b/tools/doc/package.json index f86dd46ee0a121..1ac3c78a3596f2 100644 --- a/tools/doc/package.json +++ b/tools/doc/package.json @@ -7,7 +7,7 @@ "node": ">=14.8.0" }, "devDependencies": { - "highlight.js": "^11.2.0", + "highlight.js": "^11.3.1", "js-yaml": "^4.1.0", "rehype-raw": "^6.1.0", "rehype-stringify": "^9.0.2",