Skip to content

Commit a425c4d

Browse files
addaleaxFishrock123
authored andcommitted
build: run npm install for doc builds in tarball
Run `npm install` before building the documentation from release tarballs. The doctool currently depends on `js-yaml`, which is imported from the `tools/eslint` subtree; however, release tarballs don’t contain that directory. Running `npm install` is clearly not a beautiful solution, but it works. Fixes: #7872 PR-URL: #8413 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Johan Bergström <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent f2f6353 commit a425c4d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ EXEEXT := $(shell $(PYTHON) -c \
3939
NODE_EXE = node$(EXEEXT)
4040
NODE ?= ./$(NODE_EXE)
4141
NODE_G_EXE = node_g$(EXEEXT)
42+
NPM ?= ./deps/npm/bin/npm-cli.js
4243

4344
# Flags for packaging.
4445
BUILD_DOWNLOAD_FLAGS ?= --download=all
@@ -311,11 +312,25 @@ out/doc/%: doc/%
311312
# check if ./node is actually set, else use user pre-installed binary
312313
gen-json = tools/doc/generate.js --format=json $< > $@
313314
out/doc/api/%.json: doc/api/%.md
315+
[ -e tools/doc/node_modules/js-yaml/package.json ] || \
316+
[ -e tools/eslint/node_modules/js-yaml/package.json ] || \
317+
if [ -x $(NODE) ]; then \
318+
cd tools/doc && ../../$(NODE) ../../$(NPM) install; \
319+
else \
320+
cd tools/doc && node ../../$(NPM) install; \
321+
fi
314322
[ -x $(NODE) ] && $(NODE) $(gen-json) || node $(gen-json)
315323

316324
# check if ./node is actually set, else use user pre-installed binary
317325
gen-html = tools/doc/generate.js --node-version=$(FULLVERSION) --format=html --template=doc/template.html $< > $@
318326
out/doc/api/%.html: doc/api/%.md
327+
[ -e tools/doc/node_modules/js-yaml/package.json ] || \
328+
[ -e tools/eslint/node_modules/js-yaml/package.json ] || \
329+
if [ -x $(NODE) ]; then \
330+
cd tools/doc && ../../$(NODE) ../../$(NPM) install; \
331+
else \
332+
cd tools/doc && node ../../$(NPM) install; \
333+
fi
319334
[ -x $(NODE) ] && $(NODE) $(gen-html) || node $(gen-html)
320335

321336
docopen: out/doc/api/all.html

0 commit comments

Comments
 (0)