From 6ced651b6c3da64727bce260ecf55b8d86ec6cc3 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 14 Jun 2018 08:11:05 +0200 Subject: [PATCH] build: add crypto check to markdown lint target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. (/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: https://github.com/nodejs/node/pull/21326 Reviewed-By: Ujjwal Sharma Reviewed-By: Ben Noordhuis Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Refael Ackermann Reviewed-By: James M Snell --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 49bcf11016b91f..f6b20baf231350 100644 --- a/Makefile +++ b/Makefile @@ -1046,11 +1046,17 @@ ifneq ("","$(wildcard tools/remark-cli/node_modules/)") LINT_MD_DOC_FILES = $(shell ls doc/*.md doc/**/*.md) run-lint-doc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_DOC_FILES) +node_use_openssl = $(shell $(call available-node,"-p" \ + "process.versions.openssl != undefined")) # Lint all changed markdown files under doc/ tools/.docmdlintstamp: $(LINT_MD_DOC_FILES) +ifeq ($(node_use_openssl),true) @echo "Running Markdown linter on docs..." @$(call available-node,$(run-lint-doc-md)) @touch $@ +else + @echo "Skipping Markdown linter on docs (no crypto)" +endif LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu LINT_MD_ROOT_DOCS := $(wildcard *.md) @@ -1059,9 +1065,13 @@ LINT_MD_MISC_FILES := $(shell find $(LINT_MD_TARGETS) -type f \ run-lint-misc-md = tools/remark-cli/cli.js -q -f $(LINT_MD_MISC_FILES) # Lint other changed markdown files maintained by us tools/.miscmdlintstamp: $(LINT_MD_MISC_FILES) +ifeq ($(node_use_openssl),true) @echo "Running Markdown linter on misc docs..." @$(call available-node,$(run-lint-misc-md)) @touch $@ +else + @echo "Skipping Markdown linter on misc docs (no crypto)" +endif tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp