Skip to content

Commit 6ced651

Browse files
committed
build: add crypto check to markdown lint target
Currently, if configured --without-ssl the following error will be repored by remark-cli: Running Markdown linter on misc docs... internal/util.js:100 throw new ERR_NO_CRYPTO(); ^ Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support at assertCrypto (internal/util.js:100:11) at crypto.js:31:1 at NativeModule.compile (internal/bootstrap/loaders.js:235:7) at Function.NativeModule.require (internal/bootstrap/loaders.js:155:18) at Function.Module._load (internal/modules/cjs/loader.js:530:25) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (/node/tools/remark-cli/node_modules/math-random/node.js:1:76) at Module._compile (internal/modules/cjs/loader.js:702:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10) make[1]: *** [tools/.miscmdlintstamp] Error 1 make: *** [lint] Error 2 This commit adds a check for crypto to avoid this error when node has been configured without crypto support. The alternative was to try to fix this in randomatic but that lead to another dependency failing (uuid) and felt like this might be simpler. PR-URL: #21326 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent a40e062 commit 6ced651

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,11 +1046,17 @@ ifneq ("","$(wildcard tools/remark-cli/node_modules/)")
10461046

10471047
LINT_MD_DOC_FILES = $(shell ls doc/*.md doc/**/*.md)
10481048
run-lint-doc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_DOC_FILES)
1049+
node_use_openssl = $(shell $(call available-node,"-p" \
1050+
"process.versions.openssl != undefined"))
10491051
# Lint all changed markdown files under doc/
10501052
tools/.docmdlintstamp: $(LINT_MD_DOC_FILES)
1053+
ifeq ($(node_use_openssl),true)
10511054
@echo "Running Markdown linter on docs..."
10521055
@$(call available-node,$(run-lint-doc-md))
10531056
@touch $@
1057+
else
1058+
@echo "Skipping Markdown linter on docs (no crypto)"
1059+
endif
10541060

10551061
LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu
10561062
LINT_MD_ROOT_DOCS := $(wildcard *.md)
@@ -1059,9 +1065,13 @@ LINT_MD_MISC_FILES := $(shell find $(LINT_MD_TARGETS) -type f \
10591065
run-lint-misc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_MISC_FILES)
10601066
# Lint other changed markdown files maintained by us
10611067
tools/.miscmdlintstamp: $(LINT_MD_MISC_FILES)
1068+
ifeq ($(node_use_openssl),true)
10621069
@echo "Running Markdown linter on misc docs..."
10631070
@$(call available-node,$(run-lint-misc-md))
10641071
@touch $@
1072+
else
1073+
@echo "Skipping Markdown linter on misc docs (no crypto)"
1074+
endif
10651075

10661076
tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp
10671077

0 commit comments

Comments
 (0)