Skip to content

Commit 50cfea0

Browse files
addaleaxMylesBorins
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 57921eb commit 50cfea0

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
@@ -35,6 +35,7 @@ EXEEXT := $(shell $(PYTHON) -c \
3535
NODE_EXE = node$(EXEEXT)
3636
NODE ?= ./$(NODE_EXE)
3737
NODE_G_EXE = node_g$(EXEEXT)
38+
NPM ?= ./deps/npm/bin/npm-cli.js
3839

3940
# Flags for packaging.
4041
BUILD_DOWNLOAD_FLAGS ?= --download=all
@@ -286,11 +287,25 @@ out/doc/%: doc/%
286287
# check if ./node is actually set, else use user pre-installed binary
287288
gen-json = tools/doc/generate.js --format=json $< > $@
288289
out/doc/api/%.json: doc/api/%.md
290+
[ -e tools/doc/node_modules/js-yaml/package.json ] || \
291+
[ -e tools/eslint/node_modules/js-yaml/package.json ] || \
292+
if [ -x $(NODE) ]; then \
293+
cd tools/doc && ../../$(NODE) ../../$(NPM) install; \
294+
else \
295+
cd tools/doc && node ../../$(NPM) install; \
296+
fi
289297
[ -x $(NODE) ] && $(NODE) $(gen-json) || node $(gen-json)
290298

291299
# check if ./node is actually set, else use user pre-installed binary
292300
gen-html = tools/doc/generate.js --node-version=$(FULLVERSION) --format=html --template=doc/template.html $< > $@
293301
out/doc/api/%.html: doc/api/%.md
302+
[ -e tools/doc/node_modules/js-yaml/package.json ] || \
303+
[ -e tools/eslint/node_modules/js-yaml/package.json ] || \
304+
if [ -x $(NODE) ]; then \
305+
cd tools/doc && ../../$(NODE) ../../$(NPM) install; \
306+
else \
307+
cd tools/doc && node ../../$(NPM) install; \
308+
fi
294309
[ -x $(NODE) ] && $(NODE) $(gen-html) || node $(gen-html)
295310

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

0 commit comments

Comments
 (0)